Created
November 23, 2021 13:51
-
-
Save BruJu/499a35b3d37d439547fbb468c58ed129 to your computer and use it in GitHub Desktop.
findAllOccurrencesOfTerms
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
/** | |
* Return all occurences of the given terms in a DStar Dataset | |
* @see https://github.com/BruJu/PREC | |
*/ | |
function findAllOccurrencesOfTerms(graph: DStar, terms: RDF.Term[]): RDF.Quad[] { | |
return terms.flatMap(term => [ | |
...graph.getQuads(term, null, null, $defaultGraph), | |
...graph.getQuads(null, term, null, $defaultGraph), | |
...graph.getQuads(null, null, term, $defaultGraph), | |
...graph.getRDFStarQuads().filter(q => QuadStar.containsTerm(q, term)) | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment