How to use the rdf-ext.createGraph function in rdf-ext

To help you get started, we’ve selected a few rdf-ext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rdf2h / ld2h / dist / ld2h.js View on Github external
}
        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();
github simplerdf / simplerdf / examples / get-save.js View on Github external
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()
github metaphacts / ontodia / src / ontodia / data / rdf / rdfCacheableStore.ts View on Github external
private getTypes(id: string): RDFGraph {
        return createGraph(this.elementTypes[id]);
    }
github simplerdf / simplerdf / lite.js View on Github external
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())
  }
github metaphacts / ontodia / src / ontodia / data / rdf / rdfCacheableStore.ts View on Github external
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);
    }
}
github metaphacts / ontodia / src / ontodia / data / rdf / rdfCacheableStore.ts View on Github external
private _getLabels(id: string): RDFGraph {
        return createGraph(this.labelsMap[id]);
    }
github metaphacts / ontodia / src / ontodia / data / rdf / rdfCacheableStore.ts View on Github external
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);
    }
github metaphacts / ontodia / src / ontodia / data / rdf / rdfCacheableStore.ts View on Github external
getLabels(id: string): Promise {
        return Promise.resolve(createGraph(this.labelsMap[id]));
    }