[Pellet-users] restrictions

Matthew Horridge matthew.horridge at cs.man.ac.uk
Mon Mar 5 13:53:18 UTC 2007


Hi,

There is no "getOnProperty" method in the API.

The previous line,

"OWLProperty prop = ((OWLRestriction) desc).getProperty(); "

gets the property.

Cheers,

Matthew

On 28 Feb 2007, at 19:23, Simone Meixler wrote:

> Thank you for your fast answer but I don't get it to work.
>
> for (Iterator it = supers.iterator(); it.hasNext();
>        OWLDescription desc = (OWLDescription) it.next();
>        if (desc instanceof OWLClass){
>           System.out.println(desc);
>        }
>        else if(desc instanceof OWLRestriction) {
>            OWLRestriction restr =(OWLRestriction) desc;
>            OWLProperty prop = ((OWLRestriction) desc).getProperty();
>            restr.getOnProperty();
>        }
> }
>
> I always get following errormessage:
>     cannot find symbol
>    symbol  : method getOnProperty()
>    location: interface org.semanticweb.owl.model.OWLRestriction
>            restr.getOnProperty();
> I don't know why.  In the api I read that I can use this method on  
> an OWLRestriction object.
>
>
> 2007/2/27, Ibach, Brandon L < brandon.l.ibach at lmco.com>:
>     I don't do much Java development with Pellet (ok... I haven't  
> really done any...), so take my suggestions here with caution, but  
> the important point is that the Restriction is composed of a set of  
> triples in the RDF graph, just like everything else, so you should  
> be able to use standard methods to access them.  For instance, you  
> should be able to get the information you want with a SPARQL query  
> such as:
>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns #>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
> PREFIX my: <file:///home/ontology#>
>
> SELECT *
> WHERE { my:class1 rdfs:subClassOf ?r . ?r rdf:type owl:Restriction;  
> owl:onProperty ?p; owl:hasValue ?v }
> This queries the superclasses of your specified class, limiting the  
> results to only those superclasses that are of type  
> owl:Restriction, and returns the values of the owl:onProperty and  
> owl:hasValue properties of the Restriction.  If you may be dealing  
> with Restrictions of different types (someValuesFrom,  
> minCardinality, etc.), then you'll need to query the different  
> properties to see which are defined.
>     Now that I've gone on and on about all that, I finally got into  
> a copy of the OWL-API docs and see that you shouldn't even need to  
> worry about such details, as the API provides ready access to what  
> you're looking for.  In the case you mention, the OWLDescription  
> appears to actually be an OWLObjectValueRestrictionImpl object,  
> which, by virtue of implementing the OWLObjectValueRestriction and  
> OWLObjectRestriction interfaces, provides the getIndividual and  
> getObjectProperty methods, which should provide the information  
> you're after.  Check out the OWL-API javadocs (http://owl.man.ac.uk/ 
> api/javadoc.zip ) for more details.  You're on the right track, so  
> far. :)
> -Brandon :)
>
>
>
> From: pellet-users-bounces at lists.owldl.com [mailto:pellet-users- 
> bounces at lists.owldl.com] On Behalf Of Simone Meixler
> Sent: Tuesday, February 27, 2007 1:16 PM
> To: pellet-users at lists.owldl.com
> Subject: [Pellet-users] restrictions
>
> Hello
>
> I'm new to OWL and to Java. I'm trying to get some information out  
> of my OWL ontology.  But I have
> problems with the getSuperClasses function.  I want to get the  
> hasValue and onProperty Values of a Restriction. In the moment i'm  
> iterating over my superclasses like this:
>
>  OWLClass class1=ont.getClass((URI.create("file:///home/ 
> ontology#class1"));
> Set supers = class1.getSuperClasses( ont );
> for (Iterator it = supers.iterator (); it.hasNext(); ) {
>
>        OWLDescription desc = (OWLDescription) it.next();
>        if (desc instanceof OWLClass){
>          System.out.println(desc);
>        }
>       else{
>         System.out.println (desc);
>       }
> }
>
> But I dont't know  how I can get the Restriction and the  
> information like hasValue and  onPorperty.
> In the moment I only get somthing like  
> org.semanticweb.owl.impl.model.OWLObjectValueRestrictionImpl at 5d8ab0b7
> It would be great if someone could send me an example.
>
> _______________________________________________
> 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