Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
var matchersElem = $("#matchers");
if (matchersElem[0]) {
if (matchersElem.attr("src")) {
console.warn("Using script element with src causes is not recommended, use 0) {
var matchersGraph = rdf.createGraph();
var currentLink = 0;
var processLink = function() {
var href = matcherLinks[currentLink++].href;
$.get(href, function (matchersTtl) {
rdf.parsers.parse('text/turtle', matchersTtl, null, window.location.toString().split('#')[0]).then(function (matchers) {
console.log(matchers.toString());
matchersGraph.addAll(matchers);
if (matcherLinks.length > currentLink) {
processLink();
} else {
resolve(matchersGraph);
}
});
});
};
processLink();
var blogContext = {
name: 'http://schema.org/name',
post: {
'@id': 'http://schema.org/post',
'@container': '@set'
},
headline: 'http://schema.org/headline',
content: 'http://schema.org/content'
}
var blogIri = 'http://example.org/blog'
var blogPostNode = rdf.createBlankNode()
var blogGraph = rdf.createGraph([
rdf.createTriple(
rdf.createNamedNode(blogIri),
rdf.createNamedNode('http://schema.org/name'),
rdf.createLiteral('simple blog')),
rdf.createTriple(
rdf.createNamedNode(blogIri),
rdf.createNamedNode('http://schema.org/post'),
blogPostNode),
rdf.createTriple(
blogPostNode,
rdf.createNamedNode('http://schema.org/headline'),
rdf.createLiteral('first blog post'))
])
var blogStore = rdf.createStore()
private getTypes(id: string): RDFGraph {
return createGraph(this.elementTypes[id]);
}
constructor (context, iri, graph) {
this._core = new SimpleCore(this)
this._handler = new SimpleHandler(this, this._core)
this._core.iri = SimpleCore.buildIri(iri)
this.context(context)
this.graph(graph || rdf.createGraph())
}
const graphs = Object.keys(this.rdfStorage.graphs).map(id => this.rdfStorage.graphs[id]);
for (const graph of graphs) {
for (const triple of graph._graph) {
for (const statement of statements) {
if (
((!statement.object) || statement.object === triple.object.nominalValue) &&
((!statement.predicate) || statement.predicate === triple.predicate.nominalValue) &&
((!statement.subject) || statement.subject === triple.subject.nominalValue)
) {
triples.push(triple);
continue;
}
}
}
}
return createGraph(triples);
}
}
private _getLabels(id: string): RDFGraph {
return createGraph(this.labelsMap[id]);
}
private combineGraphs(graphs: RDFGraph[]): RDFGraph {
const triples: Triple[] = [];
for (const graph of graphs) {
for (const triple of graph.toArray()) {
triples.push(triple);
}
}
return createGraph(triples);
}
getLabels(id: string): Promise {
return Promise.resolve(createGraph(this.labelsMap[id]));
}