NAME
rdf/resource - Lightweight RDF resource wrappers.
SYNOPSIS
from rdf/resource import RDFResource;
from rdf/term import rdf_iri, rdf_literal;
let alice := new RDFResource(
store: store,
term: rdf_iri("http://example.com/alice"),
);
alice.add(rdf_iri("http://example.com/name"), rdf_literal("Alice"));
DESCRIPTION
RDFResource wraps a subject term and store to make common resource operations concise. It does not cache results; every read calls the underlying store.
EXPORTS
Classes
RDFResourceConstruct with
storeandterm.values(predicate, graph := null)Returns all objects for the resource and predicate.
value(predicate, fallback := null, graph := null)Returns the first matching object, or
fallback.add(predicate, object, graph := null)Adds one quad using the wrapped term as subject and returns the resource.
remove(predicate := null, object := null, graph := null)Removes matching quads for the wrapped subject and returns the resource.
types(graph := null)Returns objects of
rdf:typestatements for the resource.has_type(type, graph := null)Returns true if the resource has the supplied
rdf:type.
COPYRIGHT AND LICENCE
rdf/resource is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.