[Pellet-users] Multiple Cardinality Question

Alan Ruttenberg alanruttenberg at gmail.com
Thu Sep 27 03:15:49 UTC 2007


A non-text attachment was scrubbed...
Name: friends.owl
Type: application/octet-stream
Size: 2247 bytes
Desc: not available
Url : http://lists.owldl.com/pipermail/pellet-users/attachments/20070927/2fbfc5c8/attachment.obj 
-------------- next part --------------

Following is an example (pardon the funny lispy abstract syntax)[2].  
The RDF/XML file is attached.
It shows that you can use the Pellet API to compute what you are  
interested in. The (instances) function is  defined using  
org.mindswap.pellet.KnowledgeBase.getInstances. It's defined in [1]  
along with a number of other queries using the Pellet API.

The probe class/ SPARQL query shows that in principal one can do the  
query in SPARQL. What's needed is an OWL-DL aware SPARQL processor,  
and a substitution in the query replacing ex:probe with a blank node  
and a series of triples which is the RDF representation of the probe  
class expression. Some versions of Pellet's SPARQL processor can  
handle this - I forget which ones.

Hope this helps,
Regards,
Alan

(with-ontology friends ()
     ((object-property !hasFriends (range !Person))
      (object-property !haveFriends (inverse-of !haveFriendsInverse)  
(range !Person))
      (class !Person :partial)
      (class !Myself :partial)
      (individual !Foo (type !Person)
		 (value !hasFriends !Bar)
		 (value !hasFriends !Mike))
      (individual !Jane (type !Person)
		 (value !hasFriends !Foo)
		 (value !hasFriends !Bar)
		 (value !hasFriends !Mike))
      (individual !Jack (type !Person)
		 (value !hasFriends !Mike)
		 (value !hasFriends !Jane))
      (individual !I (type !Myself)
		 (value !haveFriends !Foo)
		 (value !haveFriends !Bar)
		 (value !haveFriends !Jill))
      (class !probe :complete
	    (restriction !hasFriends
			 (some-values-from
			  (restriction !haveFriendsInverse (has-value !I)))))
      )
   (print-db (instances
	     (restriction !hasFriends
			  (some-values-from
			   (restriction !haveFriendsInverse (has-value !I))))))
   (sparql '(:select (?person)()
	    (?person :a !probe)) :trace t)
   (write-rdfxml friends)
   )

Which prints:

(instances
    (restriction !ex:hasFriends
       (some-values-from (restriction !ex:haveFriendsInverse (has- 
value !ex:I)))))
=>
(!ex:Foo !ex:Jane)


PREFIX ex: <http://example.com/#>
SELECT ?person
WHERE {
?person a ex:probe . }
Results:
!ex:Jane
!ex:Foo

[1] http://svn.mumble.net:8080/svn/lsw/trunk/owl/dig-query.lisp
[2] http://svn.mumble.net:8080/svn/lsw/trunk/owl/tests/friends- 
subset.lisp

On Sep 26, 2007, at 7:59 PM, Jacobs, Jay wrote:

> Hi,
>
> We're trying to use Pellet with an ontology class containing slots  
> with
> multiple cardinality. We want to match on slot value subsets. Using  
> the
> following example:
>
> Foo hasFriends Bar
> Foo hasFriends Mike
>
> Jane hasFriends Foo
> Jane hasFriends Bar
> Jane hasFriends Mike
>
> Jack hasFriends Mike
> Jack hasFriends Jane
>
> I haveFriend Foo
> I haveFriend Bar
> I haveFriend Jill
>
> Foo, Jane, and Jack are individuals of a Person class which has a  
> hasFriends
> slot relation with a max cardinality of * and a range of Person. I  
> is an
> individual of class Myself which has a haveFriends slot relation  
> with a max
> cardinality of * and a range of Person. I'd like to ask pellet  
> which Person
> individuals have a subset of friends of Myself.  In this example,  
> it should
> return a set of { Foo, Jane } but not Jack. I don't think this is  
> possible
> using SPARQL but am wondering if I can do this programmatically  
> with the
> pellet API.
>
> Thanks!
>
> --Jay
>
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
>
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/



More information about the Pellet-users mailing list