- From: Sandro Hawke <sandro@w3.org>
- Date: Fri, 17 Dec 2010 09:48:58 -0500
- To: nathan@webr3.org
- Cc: Melvin Carvalho <melvincarvalho@gmail.com>, Semantic Web <semantic-web@w3.org>
On Fri, 2010-12-17 at 10:04 +0000, Nathan wrote: > Melvin Carvalho wrote: > > Apologies if this has come up before. I was wondering the best way to > > model the following: > > > > Alice owns a dog. We choose to model it as follows. > > > > :Alice :owns a dbpedia:dog > > > > All is going well. > > > > Then Alice gets given a second dog. > > > > If we write: > > > > :Alice :owns a dbpedia:dog > > :Alice :owns a dbpedia:dog > > > > Since RDF is a set, the duplicate triple is disgarded. So Alice still > > is described as owning one dog. > > > > Is there a standard way to model Alice owning two dogs? > > Yup, you just be more descriptive, the statements you've made above are > probably better said as: > > :Alice a :DogOwner . > > As you can see (and ask) there's no detail involved, you've simply > asserted that :Alice is in the class of all :DogOwner's - thus you just > need to be a little more descriptive. > > :Alice :pet :Patch, :Spot . > :Spot a :Dog . > :Patch a Dog . > > Or more refined: > > :Alice :dog :Patch, :Spot . > > #where the property :dog is like.. > :dog rdfs:domain :Person ; > rdfs:range :Dog ; > rdfs:subPropertyOf :pet . > > Or the other way around: > > :Spot a :Dog, :owner :Alice . > :Patch a :Dog, :owner :Alice . > > Now, we can't just simply count those values, since :Spot and :Patch > could be two names for the same dog, so you'd need to say that: > > :Spot owl:differentFrom :Patch . > or > [ a owl:AllDifferent ; owl:members ( :Spot :Patch ) ] . > > > Then because we're dealing with open world semantics, we don't know that > :Alice only has exactly two dogs, so we could say something like: > > :Alice a [ > a owl:Restriction ; > owl:minCardinality 2 ; > owl:onProperty :dog . > ] . > > Which would be the class of anybody with 2 or more dogs, or use > owl:cardinality rather than minCardinality to say exactly 2 dogs. > > However, the easiest way, is probably just to do the following, and then > you can assert that you know Alice has 2 dogs, given the information you > currently have: > > :Alice :dog :Patch, :Spot . > :Spot owl:differentFrom :Patch . This is a great FAQ. I love the range of answers. Another one is to use distinguishing characteristic and then declare OWL keys [1]. For practical keys, one could use (owner, order-of-acquisition) as a key. (The dog I got first is necessarily different from the dog I got after him.) Or you could use some kind of registration number. In the US, some people register their dogs with akc.org; in my town, you also have to register dogs with the town each year, and you get a registration number, so (year-of-registration, town-of-registration, town-reg-number) would be a good key. Another option for a set of characteristics that would almost always be unambiguous would be (name, date-of-birth, owner of mother). I haven't actually used keys yet in practice, so I'm not going to try to provide a working example and get it wrong. :-) -- Sandro [1] http://www.w3.org/TR/owl2-primer/#Keys
Received on Friday, 17 December 2010 14:49:11 UTC