- From: Antoine Zimmermann <antoine.zimmermann@emse.fr>
- Date: Mon, 05 Sep 2016 08:18:40 +0200
- To: Simon Steyskal <simon.steyskal@gmail.com>
- CC: Paul Houle <ontology2@gmail.com>, Graham Klyne <gk@ninebynine.org>, "semantic-web@w3.org" <semantic-web@w3.org>
Simon, SHACL may be a viable solution depending on what you want to do but it does not have the same meaning as the OWL axioms. OWL and SHACL serve different purposes. SHACL defines a graph structure, OWL defines some truth about the world and don't care about the shape of the graph. See the differences below. On 05/09/2016 07:49, Simon Steyskal wrote: > One could also use SHACL [1] for expressing such constraints, e.g.: > > ---- > ex:SingleValuedInstanceShape > a sh:Shape ; > sh:targetNode :instance07 ; > sh:property [ > sh:predicate :composedOf ; > sh:maxCount 1 ; > ] . sh:maxCount and owl:maxCardinality don't have the same meaning. maxCount is about the structure of the RDF graph, maxCardinality is about the semantics. Compare: :instance07 :composedOf :Lead, :Gold . --> the shape is violated. --> the statements are consistent with the OWL cardinality and allow us to infer that :Lead owl:sameAs :Gold. > This shape produces a validation result, if :instance07 has more than > one value for property :composedOf. > ---- > ex:JohnIsSingleChildShape > a sh:Shape ; > sh:targetNode :John ; > sh:not [ > a sh:Shape ; > sh:property [ > sh:predicate :sibling ; > sh:minCount 1 ; > ] ; > ] . > > This shape produces a validation result, if :John has not <1 (i.e., 0) > values for property :sibling. Again, this has a different meaning. :John a [ a owl:Restriction; owl:onProperty :sibling; owl:someValuesFrom owl:Thing ] . --> the shape is not violated (there is simply no value for :sibling) --> this is inconsistent wrt the ontology because we know that John has a sibling. > ---- > ex:ActorShape > a sh:Shape ; > sh:targetNode :Mike ; > sh:property [ > sh:predicate :approves ; > sh:shape [ > sh:property [ > sh:path [ sh:inversePath :actor ] ; > sh:hasValue :Deadpool_Movie ; > ] > ] > ] . > > This shape produces a validation result, if :Mike is approving someone > who isn't an :actor of :Deadpool_Movie. > ---- > > [1] http://w3c.github.io/data-shapes/shacl/ > > 2016-09-04 22:06 GMT+02:00 Antoine Zimmermann > <antoine.zimmermann@emse.fr <mailto:antoine.zimmermann@emse.fr>>: > > Paul, > > > If you want to say that :instance07 is only composed of Lead, then > you can write: > > :instance07 :composedOf :Lead; > a [ > a owl:Restriction; > owl:onProperty :composedOf; > owl:maxCardinality 1 > ] . > > If you want to say that :John has no sibling, you can say: > > :John a [ > a owl:Restriction; > owl:onProperty :sibling; > owl:allValuesFrom owl:Nothing > ] . > > (you could also use owl:cardinality 0) > > If you want to say that Mike approves all the actors that play in > Deadpool, you can say: > > [ a owl:Restriction; > owl:onProperty [ owl:inverseOf :actor ]; > owl:hasValue :Deadpool_Movie > ] rdfs:subClassOf [ > a owl:Restriction; > owl:onProperty [ owl:inverseOf :approves ]; > owl:hasValue :Mike > ] . > > Of course, there are legitimate reasons why one would not want to > use these axioms in their system. You can do all kinds of weird > tricks internally but if you want to publish the data on the Web, > it's better done with the standards. In turn, nothing prevent anyone > who consumes these axioms to rearrange the triples with all kinds of > internal tricks for convenience. > > > Best, > --AZ > > > On 04/09/2016 17:28, Paul Houle wrote: > > These particular examples *are* cardinality constraints but they are > applied to a single subject as applied to a class. Also the > thing I am > trying to name is the mechanism for > > "making a statement about all the set of all ?s ?p values" for > a given > (?s ?p) > > for instance > > :Deadpool_Movie :mikeApproves :actor . > > to state that Mike approves the actor list for the Deadpool > movie. It > competes with other ways of making "statements-about-statements" > except > it only lets you talk about ?s ?p pairs rather than ?s ?p ?o > triples. > It also competes with the conventional uses of schemas, except > schemas > tend to be a way of > > "making statements about ?s ?p pairs where ?s a ?c" > parameterized by (?c > and ?p) > > For instance if we were round tripping data to and from Java > objects, > and the target object looks like > > class Car { > Set<Key> key; > } > > at some point the system knows it is producing a certain Java > object and > it as clear as day that it is going to populate a Set object for > key. > That knowledge is implicit in the Java reflection data and could be > represented in RDF if that was desired. > > In the case of DynamoDB, for instance, there is a distinction > between > a String and a Set<String> that is necessary to make when you > create the > object, but this is not a function of a "class" but rather > something > which can be different for every instance because it isn't > enforced by a > schema. > > On Sun, Sep 4, 2016 at 6:23 AM, Graham Klyne <gk@ninebynine.org > <mailto:gk@ninebynine.org> > <mailto:gk@ninebynine.org <mailto:gk@ninebynine.org>>> wrote: > > Not sure if this helps... but OWL can define a notion of a > singleton > class - e.g. > https://lists.w3.org/Archives/Public/semantic-web/2014Nov/0100.html > <https://lists.w3.org/Archives/Public/semantic-web/2014Nov/0100.html> > > <https://lists.w3.org/Archives/Public/semantic-web/2014Nov/0100.html > <https://lists.w3.org/Archives/Public/semantic-web/2014Nov/0100.html>>. > > > I understand this is sometimes used for modelling > specific-values in > OWL or Description Logic domain descriptions. > > Or maybe what you describe is simply a cardinality constraint: > http://www.w3.org/TR/2012/REC-owl2-primer-20121211/#Property_Cardinality_Restrictions > <http://www.w3.org/TR/2012/REC-owl2-primer-20121211/#Property_Cardinality_Restrictions> > > <http://www.w3.org/TR/2012/REC-owl2-primer-20121211/#Property_Cardinality_Restrictions > <http://www.w3.org/TR/2012/REC-owl2-primer-20121211/#Property_Cardinality_Restrictions>> > > #g > -- > > > On 04/09/2016 01:33, Paul Houle wrote: > > Imagine I have some facts about an instance such as > > :instance07 :composedOf :Lead . > > and then I say something like > > :instance07 :singleValued :composedOf . > > to distinguish the case of "a single valued property" > from "a > set of of > property values which just happens to have one > member". The > difference > doesn't usually matter in RDF-world but if you have to > round > trip with > Lucene or DynamoDB you can attach supplementary data > with the > > "make a statement about an ?s ?p pair by writing ?s ?p1 ?p" > > This permits writing > > :John :hasNo :sibling . > > This is parallel to how people typically write RDF so > it does > not get in > the way, but it queries just fine with SPARQL, Jena > Rules and such. > > Is there a name for this trick? > > > > > > -- > Paul Houle > > (607) 539 6254 <tel:%28607%29%20539%206254> paul.houle on > Skype ontology2@gmail.com <mailto:ontology2@gmail.com> > <mailto:ontology2@gmail.com <mailto:ontology2@gmail.com>> > > Ontology2 Edition of DBpedia 2015-10 > https://aws.amazon.com/marketplace/pp/B01HMUNH4Q/ > <https://aws.amazon.com/marketplace/pp/B01HMUNH4Q/> > <http://basekb.com/gold/> > http://ontology2.com/the-book/o2dbpedia-info.html > <http://ontology2.com/the-book/o2dbpedia-info.html> > http://ontology2.com/book/chapter2/part1/dbpedia-examples.html > <http://ontology2.com/book/chapter2/part1/dbpedia-examples.html> > > RDF: A new Slant > http://ontology2.com/the-book/rdf-a-new-slant.html > <http://ontology2.com/the-book/rdf-a-new-slant.html> > <https://www.linkedin.com/grp/home?gid=8267275 > <https://www.linkedin.com/grp/home?gid=8267275>> > > Data Lakes, Data Ponds, and Data Droplets > http://ontology2.com/the-book/data-lakes-ponds-and-droplets.html > <http://ontology2.com/the-book/data-lakes-ponds-and-droplets.html> > > > >
Received on Monday, 5 September 2016 06:19:12 UTC