[Pellet-users] class -> properties which have this class as domain

Alan Ruttenberg alanruttenberg at gmail.com
Thu Sep 13 05:32:12 UTC 2007


I have used functions like these to inquire as to domains and ranges.

(defun class-might-be-in-domain-of (class property kb)
   (let ((domain (#"getDomain" (#"getRole" (#"getRBox" (kb-kb kb))  
(get-entity property kb)))))
     (if (null domain)
	t
	(satisfiable-concept? (intersection-of domain class) kb)
	)))

The #"functions" are pellet api java calls. Apologies for the lispy  
java syntax. The KB is the pellet KnowledgeBase instance.

This function takes a class, a property, and a kb and determines  
whether any elements of the class could be in the domain of the  
property.

In your case you would want to take each of your classes, and for  
each, iterate over all properties, and then, perhaps, count how many  
times this function returns true. If you don't like the "might be"  
aspect of this test, you could use a stricter test, say, that the  
domain subsumes the class.

This and similar functions are in http://svn.mumble.net:8080/svn/lsw/ 
trunk/owl/dig-query.lisp

To get all object properties, I have used:

(defun all-object-properties (kb)
   (loop for prop in (set-to-list (#"getRoleNames" (#"getRBox" (kb-kb  
kb))))
      for name = (#"getName" prop)
      with kb-kb = (kb-kb kb)
      when (and (#"isObjectProperty" kb-kb prop) (not (equal name  
"inv")))
      collect (make-uri name)))

This from pellet.lisp in the same directory as the previous.

Let me know if this doesn't help and if I can decode something so it  
is more understandable.

-alan





On Sep 12, 2007, at 5:59 PM, Can Kayali wrote:

> Hi all,
>
> I want to write a function which measures the similarity of two  
> classes by
> considering the properties (object datatype) which use this classes as
> domain.
>
> The OntClass.listDeclaredProperties does not succeed, since it  
> retrieves all
> properties.
>
> Any Idea how to do that?
>
> Best,
> Can
>
> _______________________________________________
> 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