[Pellet-users] How to use taxonomy computeLCA(...)?
Evren Sirin
evren at clarkparsia.com
Wed Apr 16 20:35:47 UTC 2008
On 4/14/08 11:52 AM, Andrea Della Corte wrote:
> Could u pls help me by making an example code?
This function is not meant to be part of the public functions. It is
used internally for a specific purposes and known to cause problems in
more general cases. So use it at your own risk ;) Below I give some
information on how to use it but you might consider alternatives like
the one provided in Jena [1]. Though I have not personally used the Jena
function and I'm not sure if it does the same thing (Pellet returns a
list of classes as LCA since there might not always be a unique LCA but
I see that Jena function returns a single class. You might get help
about the Jena function on the Jena mailing list).
>
> For example, given this ontology
> http://protege.stanford.edu/plugins/owl/owl-library/koala.owl
>
> that has
>
> Thing
> |
> Habitat
> |
> |_ Forest
> |_ DryEucaliptForest
> |_ RainForest
>
> How do i prepare the input "aterm.ATermList list" (how do i give
> DryEucaliptForest and RainForest as input)?
Something along the lines of the following should work:
ATermAppl DryEucaliptForest = ATermUtils.makeTermAppl( namespace +
"DryEucaliptForest" );
ATermAppl RainForest = ATermUtils.makeTermAppl( namespace + "RainForest" );
ATermList list = ATermUtils.makeList( new ATermAppl[] {
DryEucaliptForest, RainForest } );
kb.getTaxonomy().computeLCA( list );
>
> I should have as output Forest - Habitat - Thing.
No. LCA is the *lowest* common ancestor so in this example there is a
single unique lowest ancestor which is Forect. I f you want to get all
common ancestors then you need to get the super classes of LCA. LCA
returns a list of classes only when the list elements have common
ancestor classes that are not subsumed by each other.
HTH,
Evren
[1]
http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/ontology/OntTools.html#getLCA(com.hp.hpl.jena.ontology.OntModel,%20com.hp.hpl.jena.ontology.OntClass,%20com.hp.hpl.jena.ontology.OntClass)
>
> Thanks,
>
> Andrea
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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