Is there a way using rdflib
or a similar package to validate a set of elements?
e.g.
from rdflib import Graph, Namespace, Literal
from rdflib.namespace import DCTERMS
n = Namespace("http://example.org/books/")
n.book
g = Graph()
g.bind("dc", DCTERMS)
g.bind("ex", n)
g.add((n["book"], DCTERMS["title"], Literal("Example Title"))) # Valid
g.add((n["book"], DCTERMS["tite"], Literal("Example Title"))) # Invalid
Or how it would look as a .ttl file:
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ex: <http://example.org/books/>
ex:book dc:title "Example Title" . # Valid
ex:book dc:tite "Example Title" . # Invalid
There's a good chance I'm approaching this from the wrong angle entirely so any help is appreciated.
@UninformedUser commented:
rdf:Property
in the other graph, as per:Or, just see if it's a subject in the graph (looser test):