attributes and optional attributes
authorLuc Moreau <l.moreau@ecs.soton.ac.uk>
Fri, 30 Mar 2012 12:15:35 +0100
changeset 2122 b53a31fe314f
parent 2121 8f084e3b9e64 (current diff)
parent 2120 74772c6e52e1 (diff)
child 2123 c23313c0672f
attributes and optional attributes
--- a/examples/eg-20-collections-exercise/rdf/eg-20-collections-exercise.ttl	Fri Mar 30 12:15:08 2012 +0100
+++ b/examples/eg-20-collections-exercise/rdf/eg-20-collections-exercise.ttl	Fri Mar 30 12:15:35 2012 +0100
@@ -22,75 +22,73 @@
 prov:EmptyCollection a owl:Class ;
    rdfs:subClassOf prov:Collection .
 
-# could be a subClassOf prov:Derivation     # TL: Not needed after we've flattened the Involvement hierarchy.
-prov:DerivationByInsertion a owl:Class ;
-   rdfs:subClassOf prov:EntityInvolvement . # TL: I added the one subclass that I think this should be.
-
-# could be a subClassOf prov:Derivation
-prov:DerivationByRemoval a owl:Class ;
-   rdfs:subClassOf prov:EntityInvolvement . # TL: I added the one subclass that I think this should be.
-
-prov:Membership a owl:Class .
+prov:CollectionInvolvement a owl:Class ;
+    # To avoid confusion we don't make it a subclass of
+    # EntityInvolvement. See prov:AgentInvolvement argument
+    rdfs:subClassOf prov:Involvement .
 
-prov:KeyEntityPair a owl:Class .
+prov:Insertion a owl:Class ;
+   rdfs:subClassOf prov:CollectionInvolvement .
 
-# OWL DL replacements for rdf:Bag
-prov:ObjectSet a owl:Class .
-prov:LiteralSet a owl:Class .
+prov:Removal a owl:Class ;
+   rdfs:subClassOf prov:CollectionInvolvement .
 
-prov:KeyEntitySet a owl:Class ;
-   rdfs:subClassOf prov:ObjectSet .
+prov:KeyValuePair a owl:Class .
 
-prov:KeySet a owl:Class ;
-   rdfs:subClassOf prov:LiteralSet .
 
 ### object properties ###
 
-prov:derivedByRemoval a owl:ObjectProperty ;
-   rdfs:domain prov:Collection ;
-   rdfs:range prov:DerivationByRemoval .
-
-prov:derivedByInsertion a owl:ObjectProperty ;
-   rdfs:domain prov:Collection ;
-   rdfs:range prov:DerivationByInsertion .
-
-prov:knownMembership a owl:ObjectProperty ;
-   rdfs:domain prov:Collection ;
-   rdfs:range prov:Membership .
+prov:collection a owl:ObjectProperty ;
+    rdfs:domain prov:CollectionInvolvement ;
+    rdfs:range prov:Collection .
 
-# change to previousState? previousCollection?
-prov:beforeDerivation a owl:ObjectProperty ;
-   rdfs:range prov:Collection .
+prov:inserted a owl:ObjectProperty ;
+    rdfs:domain prov:Insertion ;
+    rdfs:range prov:KeyValuePair .
 
-# not needed; could be inferred
-prov:afterDerivation a owl:ObjectProperty ;
-   rdfs:range prov:Collection .
-
-prov:hasKeyEntitySet a owl:ObjectProperty ;
-   rdfs:range prov:KeyEntitySet .
-
-prov:hasKeySet a owl:ObjectProperty ;
-   rdfs:range prov:KeySet .
+prov:removed a owl:ObjectProperty ;
+    rdfs:domain prov:Insertion ;
+    rdfs:range prov:KeyValuePair .
 
 prov:value a owl:ObjectProperty ;
-   rdfs:domain prov:KeyEntitySet . # TL: Did you leave this off intentionally?
+    rdfs:domain prov:KeyValuePair ;
+    rdfs:range prov:Entity .
 
-prov:objectMember a owl:ObjectProperty ;
-   rdfs:comment "used with prov:ObjectSet"^^xsd:string .
+prov:derivedByInsertionFrom a owl:ObjectProperty ;
+    rdfs:subPropertyOf prov:wasDerivedFrom ;
+    rdfs:domain prov:Collection ;    
+    rdfs:range prov:Collection ;
+    prov:qualifiedForm prov:qualifiedInsertion .
+
+prov:derivedByRemovalFrom a owl:ObjectProperty ;
+    rdfs:subPropertyOf prov:wasDerivedFrom ;
+    rdfs:domain prov:Collection ;    
+    rdfs:range prov:Collection ;
+    prov:qualifiedForm prov:qualifiedRemoval .
+
+prov:qualifiedInsertion a owl:ObjectProperty ;
+    rdfs:domain prov:Collection ;    
+    rdfs:range prov:Insertion .
+
+prov:qualifiedRemoval a owl:ObjectProperty ;
+    rdfs:domain prov:Collection ;    
+    rdfs:range prov:Removal .
 
 ### datatype properties ###
 
 prov:key a owl:DatatypeProperty ;
-   rdfs:domain prov:KeyEntitySet . # TL: Did you leave this off intentionally?
+   rdfs:domain prov:KeyValuePair . 
+   # CHECK: Is any literal OK, not just strings? How do "en"@en compare
+   # with "en"@fr ?  12 with 12.0 with "12"?
 
-prov:literalMember a owl:DatatypeProperty ;
-   rdfs:comment "used with prov:LiteralSet"^^xsd:string .
+
 
 ### examples ###
 
-### Insertion ###
 
-#entity(c, [prov:type="EmptyCollection"])
+## Insertion ##
+
+#entity(c, [prov:type="prov:EmptyCollection"])
 :c a prov:EmptyCollection .
 
 #entity(e1)
@@ -102,158 +100,66 @@
 #entity(e3)
 :e3 a prov:Entity .
 
-#entity(c1, [prov:type="Collection"])
+#entity(c1, [prov:type="prov:Collection"])
 :c1 a prov:Collection .
 
-#entity(c2, [prov:type="Collection"])
+#entity(c2, [prov:type="prov:Collection"])
 :c2 a prov:Collection .
   
 #derivedByInsertionFrom(c1, c,  {("k1", e1), ("k2", e2)})
-:c1 prov:derivedByInsertionFrom :c . # TL: This would be expected as the unqualified form of the qualified form.
-:c1 prov:derivedByInsertion          # TL: Could this be renamed to prov:qualifiedInsertion to follow the qualified pattern?
-   [ a prov:DerivationByInsertion ;  # TL: Could this be renamed to prov:Insertion to keep it simple?
-     prov:beforeDerivation :c ;      # TL: Could this be renamed to prov:collection to follow the "rdf:object pattern"?
-     prov:hasKeyEntitySet            # TL: Why this extra level of indirection?
-      [ a prov:KeyEntitySet ;        #     Could we skip these two (hasKeyEntitySet/KeyEntitySet) and just let: [a Insertion; prov:objectMember [], []]?
-        prov:objectMember
-         [ a prov:KeyEntityPair ;    # TL: Rename to KeyValuePair to align with predicates?
+:c1 prov:derivedByInsertionFrom :c ;
+    prov:qualifiedInsertion 
+   [ a prov:Insertion ;  
+     # Just keep it simple and stay closer to PROV-DM than to formal
+     # collection semantics stuff. Readable RDF wins.
+     prov:collection :c ;
+     prov:inserted [ a prov:KeyValuePair;
            prov:key "k1"^^xsd:string ;
            prov:value :e1 ;
-         ] ;
-        prov:objectMember
-         [ a prov:KeyEntityPair ;
-           prov:key "k2"^^xsd:string ;
-           prov:value :e2 ;
-         ]
-      ]
-   ].
-   
-#derivedByInsertionFrom(c2, c1, {("k3", e3)})
-:c2 prov:derivedByInsertion
-   [ a prov:DerivationByInsertion ;
-     prov:beforeDerivation :c1 ;
-     prov:hasKeyEntitySet
-      [ a prov:KeyEntitySet ;
-        prov:objectMember
-         [ a prov:KeyEntityPair ;
-           prov:key "k3"^^xsd:string ;
-           prov:value :e3
-         ]
-      ]
-   ] .
-
-### Removal ###
-
-#entity(c, [prov:type="EmptyCollection"])
-:c a prov:EmptyCollection .
-
-#entity(e1)
-:e1 a prov:Entity .
-
-#entity(e2)
-:e2 a prov:Entity .
-
-#entity(e3)
-:e3 a prov:Entity .
-
-#entity(c1, [prov:type="Collection"])
-:c1 a prov:Collection .
-
-#entity(c2, [prov:type="Collection"])
-:c2 a prov:Collection .
-
-#derivedByInsertionFrom(c1, c, {("k1", e1), ("k2",e2)})
-:c1 prov:derivedByInsertion
-   [ a prov:DerivationByInsertion ;
-     prov:beforeDerivation :c ;
-     prov:hasKeyEntitySet 
-      [ a prov:KeyEntitySet ;
-        prov:objectMember
-         [ a prov:KeyEntityPair ;
-           prov:key "k1"^^xsd:string ;
-           prov:value :e1 ;
-         ] ;
-        prov:objectMember
-         [ a prov:KeyEntityPair ;
+         ], [ a prov:KeyEntityPair ;
            prov:key "k2"^^xsd:string ;
            prov:value :e2 ;
          ]
-      ]
-   ].
-
-#derivedByInsertionFrom(c2, c1, {("k3", e3)})
-:c2 prov:derivedByInsertion
-   [ a prov:DerivationByInsertion ;
-     prov:beforeDerivation :c1 ;
-     prov:hasKeyEntitySet
-      [ a prov:KeyEntitySet ;
-        prov:objectMember
-         [ a prov:KeyEntityPair ;
-           prov:key "k3"^^xsd:string ;
-           prov:value :e3
-         ]
-      ]
    ] .
 
-#entity(c3, [prov:type="Collection"])
+   
+#derivedByInsertionFrom(c2, c1, {("k3", e3)})
+:c2 prov:derivedByInsertionFrom :c1 ;
+    prov:qualifiedInsertion 
+   [ a prov:Insertion ;  
+     prov:collection :c ;
+     prov:inserted [ a prov:KeyValuePair;
+           prov:key "k3"^^xsd:string ;
+           prov:value :e3 ;
+         ]
+   ] .
+
+## Removal ##
+
+
+#entity(c3, [prov:type="prov:Collection"])
 :c3 a prov:Collection .
 
 #derivedByRemovalFrom(c3, c2, {k1, k3})
-:c3 prov:derivedByRemoval
-   [ a prov:DerivationByRemoval ;
-     prov:beforeDerivation :c2 ;
-     prov:hasKeySet
-      [ a prov:KeySet ;
-        rdf:literalMember "k1"^^xsd:string ;
-        rdf:literalMember "k3"^^xsd:string
-      ]
-   ].
-
-### Membership ###
-
-# entity(c, [prov:type="Collection"])
-:c a prov:Collection .
-
-# entity(e1)
-:e1 a prov:Entity .
-
-# entity(e2)
-:e2 a prov:Entity .
+:c3 prov:derivedByRemovalFrom :c2 ;
+    prov:qualifiedRemoval 
+   [ a prov:Removal ;
+     prov:collection :c2 ;
+     prov:removedKey "k1"^^xsd:string, "k3"^^xsd:string 
+   ] .  
 
-# memberOf(c, {("k1", e1), ("k2", e2)} )  
-:c prov:knownMembership 
-   [ a prov:Membership ;
-     prov:hasKeyEntitySet 
-      [ a prov:KeyEntitySet ;
-        prov:objectMember
-         [ a prov:KeyEntityPair ;
-           prov:key "k1"^^xsd:string ;
-           prov:value :e1
-         ] ;
-        prov:objectMember
-         [ a prov:KeyEntityPair ;
-            prov:key "k2"^^xsd:string ;
-            prov:value :e2
-         ]
-      ]
-   ] .
 
-# entity(e3)
-:e3 a prov:Entity .
-
-# entity(c1, [prov:type="Collection"])
-:c1 a prov:Collection .
+## Membership ##
 
-# derivedByInsertionFrom(c1, c, {("k3", e3)}) 
-:c1 prov:derivedByInsertion 
-   [ a prov:DerivationByInsertion ;
-     prov:beforeDerivation :c ;
-     prov:hasKeyEntitySet 
-      [ a prov:KeyEntitySet ;
-        prov:objectMember 
-         [ a prov:KeyEntityPair ;
-           prov:key "k3"^^xsd:string ;
-           prov:value :e3
-         ]
-      ] 
-   ] .
+
+# memberOf(c1, {("k1", e1), ("k2", e2)} )  
+:c1 prov:knownMember
+     [ a prov:KeyValuePair;
+       prov:key "k1"^^xsd:string ;
+       prov:value :e1
+     ] ,
+     [ a prov:KeyValuePair;
+        prov:key "k2"^^xsd:string ;
+        prov:value :e2
+     ] .
+