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] Resources downloaded via internet

Timothy Redmond tredmond at stanford.edu
Tue Nov 23 08:29:39 PST 2010


>
> I would really like to make my application not having to depend on 
> being connected to the internet (or that the 3rd party servers are up, 
> for that matter).

Yes - this is an important and standard requirement.  The answer is to 
use repositories.  Repositories tell Protege where to find copies of 
imported files.

I think that these particular ontologies are all included in the 
standard Protege repositories so I will include using this as one of my 
options.  There are three ways to arrange that you use the appropriate 
repository.

Method 1: you can use a creator and explicitly set up the repository 
programatically.  Thus I tested the following code:

     public static void main(String[] args) throws OntologyLoadException {
         OwlProjectFromUriCreator creator = new OwlProjectFromUriCreator();
         creator.setOntologyUri("file:/home/tredmond/Shared/ontologies/Epoch0.97/knowledgebases/clinicalTrials/DemoTrials/DemoTrial_Blind.owl");
         LocalFolderRepository repository = new LocalFolderRepository(new File("/home/tredmond/Shared/ontologies/Epoch0.97"), true, true);
         creator.addRepository(repository);
         List errors = new ArrayList();
         creator.create(errors);
         if (!errors.isEmpty()) {
             throw new RuntimeException("Ontology load failed");
         }
         OWLModel model = creator.getOwlModel();
     }

Sorry for the explicit paths but Epoch is an ontology with many 
imports.  This method of loading the ontology loaded the imports from 
the file system.

Method 2: you can first open the project in Protege and set up the 
repositories in Protege.   When this process is done you will have a 
pprj file and a .repository file.  Then you can open the Project 
programatically

    Project p = new Project("...path...");
    OWLModel model = (OWLModel) p.getKnowledgeBase();


Method 3:  In your case I think that this will also work.  If your 
application can somewhere include a Protege distribution then setting 
the protege.dir system variable to point to that location will find the 
standard Protege repositories.  What happens is that it looks in the 
directory

    ...protege distribution.../plugins/edu.stanford.smi.protegex.owl


to find the needed repositories.

-Timothy

On 11/23/2010 01:06 AM, Jon Vassbø wrote:
> Hello,
>
> I am creating a java application that uses protege and protege-owl 
> libraries (version 3.4.4) for connecting to a Protege instance.
> I have noticed that during Ontology loading, several files are 
> requested via internet in the method 
> AbstractOWLModel.loadImportedAssertions(), more specifically:
> http://protege.stanford.edu/plugins/owl/dc/protege-dc.owl
> http://purl.org/dc/elements/1.1/
> http://swrl.stanford.edu/ontologies/3.3/swrla.owl
> http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
>
> Is there any way to avoid this, and storing these resources locally? I 
> see that the URLs are hardcoded in several java classes, which makes 
> me worry that there is no way around this...
>
> I would really like to make my application not having to depend on 
> being connected to the internet (or that the 3rd party servers are up, 
> for that matter).
>
> Any help greatly appreciated!
>
>
> -
> Jon Vassbo
>
>
> _______________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20101123/b9bafdb9/attachment.html>


More information about the protege-owl mailing list