examples.md 1.7 KB

Examples

User input and storage layout for a newly created resource

The following triples constitute a user data payload for a new resource, organized in named graphs.

Note the relative URIs used for the subject, since the URI of the resource is unknown before creation:

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rsrc: <urn:lsres:> .
@prefix ext: <http://example.org/onto#> .

GRAPH <#usr1> {
  <.>
    a foaf:Person ;
    foaf:knows <http://example.org/onto#bob> .
}

GRAPH <#usr2> {
  <.>
    foaf:nick "alice" ;
    foaf:givenName "Alice" ;
    foaf:familyName "Liddell" .
}

Once the resource is created, the following triples are added to the repo, assuming that the new resource URI is rsrc:abc (in reality it would be a UUID4 formatted URN):

@prefix lsup: <urn:lsup:> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rsrc: <urn:lsres:> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

GRAPH rsrc:abc#__admin {
  <.>
    a lsup:Resource , lsup:DescriptiveResource ;
    lsup:created "2023-01-10T21:28:15Z"^^xsd:dateTime ;
    lsup:lastUpdated "2023-01-10T21:28:15Z"^^xsd:dateTime .
}

GRAPH rsrc:abc#usr1 {
  <.>
    a foaf:Person ;
    foaf:knows <http://example.org/onto#bob> .
}

GRAPH rsrc:abc#usr2 {
  <.>
    foaf:nick "alice" ;
    foaf:givenName "Alice" ;
    foaf:familyName "Liddell" .
}

GRAPH rsrc:abc#__main {
  <#__admin>
    a lsup:Metadata , lsup:AdminMetadata ;
    foaf:topic <.> .
  <#usr1>
    a lsup:UserData ;
    foaf:topic <.> .
  <#usr2>
    a lsup:UserData ;
    foaf:topic <.> .
}

That makes it easy to retrieve all triples about the created resource: the result is the union of all graphs whose URIs have rsrc:abc as their foaf:topic.