This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const op = require('/MarkLogic/optic'); | |
/** | |
* relationIRIString the string representation of the predicate in a relationship triple | |
* The relationship triple must be of the form <leftIRI> <relationIRIPredicateString> <rightIRI> and there must | |
* be RDF triples relating each <iri> to the doc URI via <hasURI>. | |
* side1CTS - a cts.query that consntrains documents on the left of the overall join | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helper function to get all method names including prototype inherited | |
function getMethods(obj) { | |
let ms = getMethodsDups(obj) | |
let uniq = ms.filter( | |
(item, pos, self) => { | |
return self.indexOf(item) == pos; | |
} | |
) | |
return uniq | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** Random sampling of arrays or sequences. | |
Limitations: not 100% random. Tries to not start at 0 all the time, or get items at the exact end of list, but there are some biases. | |
Intended to get random blocks of contiguous items. Blocks are used for two reasons | |
1. it is sometimes nice to only get ranges, then get the data later to avoid a huge URI or ID pull up front. | |
2. each chunk is one pass through a loop, including random generation and adjustments. fewer/larger chunks goes faster than chunksize=1. | |
*/ |