examples/eg-20-collections-exercise/rdf/eg-20-collections-exercise.ttl
author Paul Groth <p.t.groth@vu.nl>
Fri, 07 Jun 2013 20:21:19 +0200
changeset 6412 600c6fd1fdb4
parent 2214 68a398405105
parent 2215 37c18bc0cd2b
permissions -rw-r--r--
minor updates to address dong's comments
     1 @prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
     2 @prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
     3 @prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
     4 @prefix owl:     <http://www.w3.org/2002/07/owl#> .
     5 @prefix dcterms: <http://purl.org/dc/terms/> .
     6 @prefix sd:      <http://www.w3.org/ns/sparql-service-description#> .
     7 @prefix dcat:    <http://www.w3.org/ns/dcat#> .
     8 @prefix void:    <http://rdfs.org/ns/void#> .
     9 @prefix foaf:    <http://xmlns.com/foaf/0.1/> .
    10 @prefix prov:    <http://www.w3.org/ns/prov#> .
    11 @prefix ex:      <http://example.com/>
    12 @prefix :        <http://dvcs.w3.org/hg/prov/raw-file/tip/examples/eg-20-collections-exercise/rdf/eg-20-collections-exercise.ttl#> .
    13 
    14 ### already in prov, added to test OWL profile ###
    15 
    16 prov:Entity a owl:Class .
    17 
    18 prov:Involvement a owl:Class .
    19 
    20 prov:Membership a owl:Class .
    21 
    22 prov:qualifiedForm a owl:AnnotationProperty .
    23 
    24 prov:wasDerivedFrom a owl:ObjectProperty .
    25 
    26 prov:Membership a owl:Class .
    27 
    28 ### classes ###
    29 
    30 prov:Collection a owl:Class ;
    31    rdfs:subClassOf prov:Entity .
    32 
    33 prov:EmptyCollection a owl:Class ;
    34    rdfs:subClassOf prov:Collection .
    35 
    36 prov:CollectionInvolvement a owl:Class ;
    37     # To avoid confusion we don't make it a subclass of
    38     # EntityInvolvement. See prov:AgentInvolvement argument
    39     rdfs:subClassOf prov:Involvement .
    40 
    41 prov:Insertion a owl:Class ;
    42    rdfs:subClassOf prov:CollectionInvolvement .
    43 
    44 prov:Removal a owl:Class ;
    45    rdfs:subClassOf prov:CollectionInvolvement .
    46 
    47 prov:KeyValuePair a owl:Class .
    48 
    49 
    50 ### object properties ###
    51 
    52 prov:collection a owl:ObjectProperty ;
    53     rdfs:domain prov:CollectionInvolvement ;
    54     rdfs:range prov:Collection .
    55 
    56 prov:inserted a owl:ObjectProperty ;
    57     rdfs:domain prov:Insertion ;
    58     rdfs:range prov:KeyValuePair .
    59 
    60 prov:value a owl:ObjectProperty, owl:FunctionalProperty ;
    61     rdfs:domain prov:KeyValuePair ;
    62     rdfs:range prov:Entity .
    63 
    64 prov:knownMembership a owl:ObjectProperty ;
    65 	rdfs:domain prov:Collection ;
    66 	rdfs:range prov:Membership .
    67 
    68 prov:member a owl:ObjectProperty ;
    69 	rdfs:domain prov:Membership ;
    70 	rdfs:range prov:KeyValuePair .
    71 
    72 prov:derivedByInsertionFrom a owl:ObjectProperty ;
    73     rdfs:subPropertyOf prov:wasDerivedFrom ;
    74     rdfs:domain prov:Collection ;    
    75     rdfs:range prov:Collection ;
    76     prov:qualifiedForm prov:qualifiedInsertion .
    77 
    78 prov:derivedByRemovalFrom a owl:ObjectProperty ;
    79     rdfs:subPropertyOf prov:wasDerivedFrom ;
    80     rdfs:domain prov:Collection ;    
    81     rdfs:range prov:Collection ;
    82     prov:qualifiedForm prov:qualifiedRemoval .
    83 
    84 prov:qualifiedInsertion a owl:ObjectProperty ;
    85     rdfs:domain prov:Collection ;    
    86     rdfs:range prov:Insertion .
    87 
    88 prov:qualifiedRemoval a owl:ObjectProperty ;
    89     rdfs:domain prov:Collection ;    
    90     rdfs:range prov:Removal .
    91 
    92 ### datatype properties ###
    93 
    94 prov:key a owl:DatatypeProperty, owl:FunctionalProperty ;
    95    rdfs:domain prov:KeyValuePair . 
    96 
    97 prov:removedKey a owl:DatatypeProperty ;
    98     rdfs:domain prov:Removal .
    99 
   100 ### examples ###
   101 
   102 
   103 ## Insertion ##
   104 
   105 #entity(c, [prov:type="prov:EmptyCollection"])
   106 :c a prov:EmptyCollection .
   107 
   108 #entity(e1)
   109 :e1 a prov:Entity .
   110 
   111 #entity(e2)
   112 :e2 a prov:Entity .
   113 
   114 #entity(e3)
   115 :e3 a prov:Entity .
   116 
   117 #entity(c1, [prov:type="prov:Collection"])
   118 :c1 a prov:Collection .
   119 
   120 #entity(c2, [prov:type="prov:Collection"])
   121 :c2 a prov:Collection .
   122   
   123 #derivedByInsertionFrom(c1, c,  {("k1", e1), ("k2", e2)})
   124 :c1 prov:derivedByInsertionFrom :c ;
   125     prov:qualifiedInsertion 
   126    [ a prov:Insertion ;  
   127      # Just keep it simple and stay closer to PROV-DM than to formal
   128      # collection semantics stuff. Readable RDF wins.
   129      prov:collection :c ;
   130      prov:inserted [ a prov:KeyValuePair;
   131            prov:key "k1"^^xsd:string ;
   132            prov:value :e1 ;
   133          ], [ a prov:KeyValuePair ;
   134            prov:key "k2"^^xsd:string ;
   135            prov:value :e2 ;
   136          ]
   137    ] .
   138 
   139    
   140 #derivedByInsertionFrom(c2, c1, {("k3", e3)})
   141 :c2 prov:derivedByInsertionFrom :c1 ;
   142     prov:qualifiedInsertion 
   143    [ a prov:Insertion ;  
   144      prov:collection :c ;
   145      prov:inserted [ a prov:KeyValuePair;
   146            prov:key "k3"^^xsd:string ;
   147            prov:value :e3 ;
   148          ]
   149    ] .
   150 
   151 ## Removal ##
   152 
   153 
   154 #entity(c3, [prov:type="prov:Collection"])
   155 :c3 a prov:Collection .
   156 
   157 #derivedByRemovalFrom(c3, c2, {k1, k3})
   158 :c3 prov:derivedByRemovalFrom :c2 ;
   159     prov:qualifiedRemoval 
   160    [ a prov:Removal ;
   161      prov:collection :c2 ;
   162      prov:removedKey "k1"^^xsd:string, "k3"^^xsd:string 
   163    ] .  
   164 
   165 
   166 ## Membership ##
   167 
   168 
   169 # memberOf(c1, {("k1", e1), ("k2", e2)} )  
   170 :c1 prov:knownMembership [ a prov:Membership ;
   171     prov:member [ a prov:KeyValuePair;
   172         prov:key "k1"^^xsd:string ;
   173         prov:value :e1
   174       ] , [ a prov:KeyValuePair;
   175         prov:key "k2"^^xsd:string ;
   176         prov:value :e2
   177       ] .
   178 
   179