-
Notifications
You must be signed in to change notification settings - Fork 7
Document hierarchy
AtomGraph Processor does not require a specific RDF dataset layout. It includes however a useful one that extends the core AtomGraph Processor vocabulary and uses container/item membership properties from SIOC to describe a resource hierarchy, which is very common in web applications and filesystems.
In the dataset, a structure of this wiki could be described like this:
@base <https://github.com/AtomGraph/> .
@prefix gp: <http://graphity.org/gp#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix sioc: <http://rdfs.org/sioc/ns#> .
# webapp root resource
<> a gp:Container .
# 1st level container
<graphity-client> a gp:Container ;
sioc:has_parent <> .
# 1st level container
<graphity-core> a gp:Container ;
sioc:has_parent <> .
# 1st level container
<graphity-processor> a gp:Container ;
sioc:has_parent <> .
# 2nd level container
<graphity-processor/wiki> a gp:Container ;
sioc:has_parent <graphity-processor> .
# 2nd level item
<graphity-processor/wiki/Data-hierarchy> a gp:Document ;
sioc:has_container <graphity-processor/wiki> .
# 1st level item
<graphity-processor/pulse> a gp:Document ;
sioc:has_container <graphity-processor> .
And so on, deeper down into the container hierarchy where items are leaves - a parent/child relationship just like with folders and files in a file system.
Abstract concepts and things that cannot be directly accessed over HTTP but can still be described in RDF documents can be attached to the document hierarchy using foaf:isPrimaryTopicOf and foaf:primaryTopic properties:
@base <https://github.com/AtomGraph/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<> a foaf:Document ;
foaf:primaryTopic <#project> .
<#project> a doap:Project ;
dct:created "2011-09-13"^^xsd:date ;
foaf:isPrimaryTopicOf <> .
Here the example above is depicted as a resource tree, with resource URIs relative to their parents':
<>
+-- <graphity-client>
+-- <graphity-core>
+-- <graphity-processor>
| +-- <wiki>
| | +-- <Data-hierarchy>
| +-- <pulse>
All HTTP-accessible resources (which excludes hash URIs such as <graphity-processor#this>) are gp:Documents.
By convention, the slashes in the URI structure mark a SIOC parent/children relation in RDF.
In the sitemap ontology, the template for the parent/child relationships is expressed using rdfs:subClassOf and owl:Restrictions. Here is an example from the AtomGraph Processor vocabulary with hierarchy-related properties only:
@base <http://graphity.org/gp> .
<#Container> a rdfs:Class, owl:Class, <#Template> ;
rdfs:subClassOf foaf:Document, sioc:Container ,
[ a owl:Restriction ;
owl:onProperty sioc:has_parent ;
owl:allValuesFrom <#Container>
] ;
rdfs:label "Container" ;
rdfs:comment "Container that can have other containers and items as children" ;
rdfs:isDefinedBy <#> .
<#Item> a rdfs:Class, owl:Class, <#Template> ;
rdfs:subClassOf foaf:Document, sioc:Item,
[ a owl:Restriction ;
owl:onProperty sioc:has_container ;
owl:allValuesFrom <#Container>
] ;
rdfs:label "Item" ;
rdfs:comment "Child item of a container" ;
rdfs:isDefinedBy <#> .