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-owl] domain (union of classes)

Timothy Redmond tredmond at stanford.edu
Sun Aug 3 17:44:04 PDT 2008


I think that your problem is your interpretation of

> As a result, the domain of each DP with a unionOf classes is  
> something like that:
>
> <rdfs:domain rdf:nodeID="A0"/>


Without more information it is not clear whether the domain wrote out  
as a union or not.  My suspicion is  that if you look for more  
statements about the resource with nodeID "A0" you will see the union  
statements.

As a test here I wrote the code

     public static void main(String[] args) throws  
OntologyLoadException, IOException {
         OWLModel owlModel = ProtegeOWL.createJenaOWLModel();
         OWLNamedClass a = owlModel.createOWLNamedClass("A");
         OWLNamedClass b = owlModel.createOWLNamedClass("B");
         OWLDatatypeProperty p =  
owlModel.createOWLDatatypeProperty("p");
         p.addUnionDomainClass(a);
         p.addUnionDomainClass(b);

         PrintWriter writer = new PrintWriter(System.out);
         OWLModelWriter modelWriter = new OWLModelWriter(owlModel,
                                                          
owlModel.getTripleStoreModel().getTopTripleStore(),
                                                         writer);
         modelWriter.write();
         writer.close();
     }

and got the output

<rdf:RDF xmlns="http://www.owl-ontologies.com/Ontology1217810145.owl#"
      xml:base="http://www.owl-ontologies.com/Ontology1217810145.owl"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
      xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
      xmlns:swrl="http://www.w3.org/2003/11/swrl#"
      xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
      xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:owl="http://www.w3.org/2002/07/owl#">
     <owl:Ontology rdf:about=""/>
     <owl:Class rdf:ID="A"/>
     <owl:DatatypeProperty rdf:ID="p">
         <rdfs:domain>
             <owl:Class>
                 <owl:unionOf rdf:parseType="Collection">
                     <owl:Class rdf:about="#A"/>
                     <owl:Class rdf:about="#B"/>
                 </owl:unionOf>
             </owl:Class>
         </rdfs:domain>
     </owl:DatatypeProperty>
     <owl:Class rdf:ID="B"/>
</rdf:RDF>


-Timothy


On Jul 30, 2008, at 4:53 PM, Agustina Buccella wrote:

> Hello, I am creating a new ontology based on two defined ontologies  
> (A1, A2)
>
> Both ontologies are OWL-DL, so unions in the domains and ranges are  
> possible... I have to get all classes and properties of ontology A1  
> and put them in some specific place in the ontology A2. So, I  
> firstly get the OWLNamedClasses of A1 (and create them in  A2) and I  
> secondly try to obtain all datatype properties and create them again  
> in A2.
>
> The problem is when the domain of the datatype properties (DP) are  
> unions.... I made a lot of proofs but I cant find the way to do  
> so... Here is my code:
>
>      while  (c.hasNext()){
>
>             //I get the classes...
>             String slaclase= (String) c.next();
>             OWLNamedClass laclase =  
> userModel.getOWLNamedClass(slaclase);
>
>             //I get the properties of the classes
>
>              aproperty =  
> getProperties(laclase.getUnionDomainProperties());
>
>             for (Iterator dp = aproperty.iterator(); dp.hasNext();){
>                 adp = (OWLDatatypeProperty) dp.next();
>
>                 //when the domain is an UnionClass
>                 if (adp.getDomain(true) instanceof OWLUnionClass){
>
>                 //creating the property without domain and range...
>                 anewdp =  
> newModel.createOWLDatatypeProperty(adp.getBrowserText());
>
>                 //creating a collection with the union of classes
>                 Collection union= adp.getUnionDomain(false);
>                 for (Iterator j = union.iterator(); j.hasNext();){
>                             OWLNamedClass undominio =  
> (OWLNamedClass) j.next();
>
>                             //here is where I want to add each class  
> of the domain as domain of "anewdp"
>
>                              
> anewdp 
> .addUnionDomainClass 
> (newModel.getOWLNamedClass(undominio.getBrowserText()));
>
>                         }
>                         anewdp.setRange(adp.getRange());
>                 }
>         }
>
> As a result, the domain of each DP with a unionOf classes is  
> something like that:
>
> <rdfs:domain rdf:nodeID="A0"/>
>
> Am I using an incorrect method?
>
>
> Thanks
> Agustina
>
>
> ¡Buscá desde tu celular! Yahoo! oneSEARCH ahora está en Claro
> http://ar.mobile.yahoo.com/onesearch_______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03




More information about the protege-owl mailing list