Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] a simple questions about owl programming

Thomas Russ tar at isi.edu
Wed Nov 17 11:46:48 PST 2010


On Nov 17, 2010, at 7:20 AM, tingyu li wrote:

> hi Thomas, thanks for your response. but I still very confused by  
> these methods...and I have read all the samples posted on the  
> website, but I don't find any solutions for my problems, a very  
> similar question is about query all resources that have a certain  
> property value. the code on website is like this:
> RDFProperty subClassOfProperty =  
> owlModel.getRDFProperty(RDFSNames.Slot.SUB_CLASS_OF);
>
> OWLNamedClass owlThingClass = owlModel.getOWLThingClass();
> Collection results =  
> owlModel.getRDFResourcesWithPropertyValue(subClassOfProperty,  
> owlThingClass);
> System.out.println("Subclasses of owl:Thing:");
>
> for (Iterator it = results.iterator(); it.hasNext();) {
>     RDFResource resource = (RDFResource) it.next();
>     System.out.println(" - " + resource.getBrowserText());
> }
> but, actually, there are no slot on the new version owl files. and I  
> think RDFProperty is not very fit for my file. by the way, I use  
> protege 4.0 to develop a owl file and save it as format: RDF/XML.  
> the file  is like this:

You have to look at the class hierarchy in the Java code.
OWLObjectProperty and OWLIndividual are all subclasses of RDFPropery  
and RDFResource, so those methods will be applicable.

But if you are going to be using Protege 4, then you should be using  
the OWLAPI to work with the ontology rather than the Protege-OWL API.   
That is the underlying code that the Protege 4 code uses.   OWLAPIv3  
is used in Protege 4.1

So the place to start for OWLAPI programming are the following  
documents:

   http://owlapi.sourceforge.net/documentation.html

All of the assertion information would be retrieved in the form of  
different kinds of axioms that you would get for a particular  
individual (like Jim) by calling the method with signature:

    OWLOntology.getAxioms(OWLIndividual)

and then filtering the results in to different classes of axiom such as

    OWLPropertyAssertionAxiom which supports getProperty() and  
getObject() to tell you which property and value it has.

The usages would seem to be returned by

    OWLOntology.getReferencingAxioms(OWLEntity)


>
>     <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2010/0/family.owl#isUncleOf 
> ">
>         <rdfs:range rdf:resource="http://www.semanticweb.org/ontologies/2010/0/family.owl#family_member 
> "/>
>         <rdfs:domain rdf:resource="http://www.semanticweb.org/ontologies/2010/0/family.owl#male_family_member 
> "/>
>     </owl:ObjectProperty>
> I want get the similar result as the probem I described above. in  
> other words, if I click Jim as the picture, I can get the result as  
> the rigt part of the picture displayed, Usage and Property  
> assertions:Jim
>
> thanks.
>




More information about the protege-discussion mailing list