Re: Is there a name for this one weird trick?

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 ;
    ] .

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.
----
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>:

> 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>> 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
>> >.
>>
>>
>>     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/#Propert
>> y_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    paul.houle on Skype ontology2@gmail.com
>> <mailto:ontology2@gmail.com>
>>
>> Ontology2 Edition of DBpedia 2015-10
>> https://aws.amazon.com/marketplace/pp/B01HMUNH4Q/ <
>> http://basekb.com/gold/>
>> http://ontology2.com/the-book/o2dbpedia-info.html
>> http://ontology2.com/book/chapter2/part1/dbpedia-examples.html
>>
>> RDF: A new Slant
>> http://ontology2.com/the-book/rdf-a-new-slant.html
>> <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
>>
>
>
>

Received on Monday, 5 September 2016 05:49:36 UTC