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] Importing one ontology to another in a java API

basariya basariya basariyamail at gmail.com
Wed Feb 22 05:47:24 PST 2012


dear experts,                         i created one ontology using
protege 3.x..now i want to create ui for that ontology..can any one
suggest the steps for creating user interface to extract data from
ontology..

On 2/22/12, samane abdi <samane.abdi at gmail.com> wrote:
> Hi Timothy,
> Thanks for your reply. I have added the line that you mentioned. It just
> shows that the ontology B was imported in the namespace window with prefix
> "myPrefix" . However, when I open the metadata tab or class tab or property
> tab, etc... there is no entity from ontology B(is not imported) in Ontology
> A. How can I see the imported entities in ontology A?
>  In addition, I do not know how to add "class b" from ontology B as a
> subclass of "class a" from ontology A. Is there any solution on this?
>
> Thanks,
> Samane
>
> On Tue, Feb 21, 2012 at 7:08 PM, Timothy Redmond
> <tredmond at stanford.edu>wrote:
>
>>
>> Actually your code seemed to work perfectly on the first try.  The one
>> thing that might be an issue is that perhaps you expected to find the
>> modified ontology on disk whereas your code simply loads it into memory.
>> I
>> added a
>>
>>
>> owlModel.save(URI.create("file:///Volumes/Shared/ontologies/simple/pizza-with-import.owl"));
>>
>>
>> line (your file path will differ) and was able to examine the modified
>> version of the ontology on the disk.
>>
>> -Timothy
>>
>>
>>
>> On 2/21/12 7:15 AM, samane abdi wrote:
>>
>> Dear Experts,
>>
>>  I built two ontologies A and B. I want to import ontology B to ontology
>> A and add "class b" and all its relations and individuals from Ontology B
>> as a subclass of "class a" from Ontology A. How can I encode this in a
>> java
>> API(such as Eclipse).
>>
>>  Here is a fragment of my code which does not give me the desired result.
>>
>>  "public static void main(String[] args) throws OntologyLoadException,
>> URISyntaxException {
>>  JenaOWLModel owlModel;
>>  //JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModel();
>>     String DAL2Ontology = "file:///home/A.owl";
>>  owlModel = ProtegeOWL.createJenaOWLModelFromURI(DAL2Ontology);
>>  //String medicalOntology =
>> "file:///home/sabdi/Applications/Protege3.4.8/MedicalOntology/Medical.owl"
>> ;
>>  //if you want to use a custom prefix for the namespace of the imported
>> ontology, uncomment the following line
>>  owlModel.getNamespaceManager().setPrefix(new URI("file:///home/B.owl#"),
>> "myPrefix");
>>
>>  //create the ImportHelper
>>  ImportHelper importHelper = new ImportHelper((JenaOWLModel)owlModel);
>>
>>  //this is the URI from where your ontology is created
>>  //URI importUri = URIUtilities.createURI(
>> "file:///home/sabdi/Applications/Protege3.4.8/test/DAL2.owl");
>>  URI importUri2 = URIUtilities.createURI("file:///home/B.owl");
>>  //add the import (multiple imports can be added here)
>>  //importHelper.addImport(importUri);
>>  importHelper.addImport(importUri2);
>>
>>  try {
>>     //do the actual import
>>  importHelper.importOntologies();
>>     //importHelper.importOntologies(true);
>>  } catch (Exception e) {
>>     e.printStackTrace();
>>  }
>>   }"
>>
>>
>>  Can you suggest me a solution or a tutorial for this?
>>
>>  Thanks,
>>  Samane
>>
>>  --
>> Samane
>>
>>
>> _______________________________________________
>> protege-owl mailing
>> listprotege-owl at lists.stanford.eduhttps://mailman.stanford.edu/mailman/listinfo/protege-owl
>>
>> Instructions for unsubscribing:
>> http://protege.stanford.edu/doc/faq.html#01a.03
>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> Samane
>


More information about the protege-owl mailing list