How to use the rdflib.Statement function in rdflib

To help you get started, we’ve selected a few rdflib 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 fletcher91 / link-redux / src / components / __tests__ / PropertyBase.spec.ts View on Github external
it("uses the render store to resolve", () => {
            const opts = ctx.fullCW(subject);

            const comp = getComp();
            const elem = mount(opts.wrapComponent(comp)).find(CustomClass).instance();

            expect(elem.getLinkedObjectPropertyRaw()).toEqual([
                new Statement(subject, label, new Literal("title"), NS.example("default")),
            ]);
        });
github fletcher91 / link-redux / src / components / __tests__ / LinkedResourceContainer.spec.ts View on Github external
it("renders blank nodes", () => {
        const bn = new BlankNode();
        const opts = ctx.chargeLRS(
            [
                new Statement(bn, defaultNS.rdf("type"), defaultNS.schema("Thing")),
                new Statement(bn, defaultNS.schema("name"), new Literal("title")),
            ],
            bn,
        );

        const comp = createTestElement();
        opts.lrs.registerAll(LinkedRenderStore.registerRenderer(comp, defaultNS.schema("Thing")));
        const elem = mount(
            opts.wrapComponent(createElement(LinkedResourceContainer, {
                loadLinkedObject,
                subject: bn,
            })),
        );

        expect(elem.find("span.testComponent")).toExist();
    });
github fletcher91 / link-redux / src / components / __tests__ / LinkedResourceContainer.spec.ts View on Github external
it("renders blank nodes", () => {
        const bn = new BlankNode();
        const opts = ctx.chargeLRS(
            [
                new Statement(bn, defaultNS.rdf("type"), defaultNS.schema("Thing")),
                new Statement(bn, defaultNS.schema("name"), new Literal("title")),
            ],
            bn,
        );

        const comp = createTestElement();
        opts.lrs.registerAll(LinkedRenderStore.registerRenderer(comp, defaultNS.schema("Thing")));
        const elem = mount(
            opts.wrapComponent(createElement(LinkedResourceContainer, {
                loadLinkedObject,
                subject: bn,
            })),
        );

        expect(elem.find("span.testComponent")).toExist();
    });
github fletcher91 / link-redux / src / components / __tests__ / PropertyBase.spec.ts View on Github external
it("allows the property to be passed", () => {
            const opts = ctx.fullCW(subject);

            const comp = getComp();
            const elem = mount(opts.wrapComponent(comp)).find(CustomClass).instance();

            expect(elem.getLinkedObjectPropertyRaw(NS.example("tags"))).toEqual([
                new Statement(subject, NS.example("tags"), NS.example("tag/0"), NS.example("default")),
                new Statement(subject, NS.example("tags"), NS.example("tag/1"), NS.example("default")),
                new Statement(subject, NS.example("tags"), NS.example("tag/2"), NS.example("default")),
                new Statement(subject, NS.example("tags"), NS.example("tag/3"), NS.example("default")),
            ]);
        });
    });
github fletcher91 / link-redux / test / fixtures.ts View on Github external
const sTitle = (id: NamedNode, title: string) => [
    new Statement(id, NS.schema("name"), new Literal(title)),
];
github fletcher91 / link-redux / test / fixtures.js View on Github external
const typeObject = id => [
  new rdf.Statement(exNS(id), defaultNS.rdf('type'), schema('CreativeWork')),
];
github fletcher91 / link-redux / test / fixtures.ts View on Github external
const sFull = (id: NamedNode, attrs: Test) => {
    return [
        typeObject(id)[0],
        new Statement(id, NS.schema("name"), new Literal(attrs.title || "title"), NS.example("default")),
        new Statement(id, NS.schema("text"), new Literal(attrs.text || "text"), NS.example("default")),
        new Statement(id, NS.schema("author"), new NamedNode(attrs.author || "http://example.org/people/0"), NS.example("default")),
        new Statement(id, NS.schema("dateCreated"), Literal.fromDate(new Date("2019-01-01")), NS.example("default")),
        new Statement(id, NS.ex("timesRead"), Literal.fromValue(5), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/0"), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/1"), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/2"), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/3"), NS.example("default")),
    ];
};
github fletcher91 / link-redux / test / fixtures.ts View on Github external
const sFull = (id: NamedNode, attrs: Test) => {
    return [
        typeObject(id)[0],
        new Statement(id, NS.schema("name"), new Literal(attrs.title || "title"), NS.example("default")),
        new Statement(id, NS.schema("text"), new Literal(attrs.text || "text"), NS.example("default")),
        new Statement(id, NS.schema("author"), new NamedNode(attrs.author || "http://example.org/people/0"), NS.example("default")),
        new Statement(id, NS.schema("dateCreated"), Literal.fromDate(new Date("2019-01-01")), NS.example("default")),
        new Statement(id, NS.ex("timesRead"), Literal.fromValue(5), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/0"), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/1"), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/2"), NS.example("default")),
        new Statement(id, NS.example("tags"), NS.example("tag/3"), NS.example("default")),
    ];
};