Skip to content

swap_primer

This is a simple primer using some of the example stuff in the Primer on N3:

http://www.w3.org/2000/10/swap/Primer

Attributes:

myNS module-attribute

myNS = Namespace('https://example.com/')

mySource module-attribute

mySource = '\n    @prefix : <https://example.com/> .\n    @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n    @prefix owl:  <http://www.w3.org/2002/07/owl#> .\n    @prefix dc:  <http://purl.org/dc/elements/1.1/> .\n    @prefix foo: <http://www.w3.org/2000/10/swap/Primer#>.\n    @prefix swap: <http://www.w3.org/2000/10/swap/>.\n\n    <> dc:title\n      "Primer - Getting into the Semantic Web and RDF using N3".\n\n    :pat    :knows          :jo .\n    :pat    :age            24 .\n    :al     :is_child_of    :pat .\n\n    :pat    :child          :al, :chaz, :mo ;\n            :age            24 ;\n            :eyecolor       "blue" .\n\n\n    :Person a rdfs:Class .\n\n    :Pat a :Person .\n\n    :Woman a rdfs:Class; rdfs:subClassOf :Person .\n\n    :sister a rdf:Property .\n\n    :sister rdfs:domain :Person ;\n            rdfs:range :Woman .\n\n    :Woman = foo:FemaleAdult .\n    :Title a rdf:Property; = dc:title .\n    '

primer module-attribute

primer = ConjunctiveGraph()

q module-attribute

q = 'SELECT ?child WHERE { :pat :child ?child }'