Search Mailing List Archives
[protege-discussion] pprj file - WAS: (no subject)
Tania Tudorache
tudorache at stanford.edu
Mon Oct 1 19:05:02 PDT 2007
You can make a local copy of the pprj file with the following code:
KnowledgeBase internalKB = prj.getInternalProjectKnowledgeBase();
ArrayList errors = new ArrayList();
new ClipsKnowledgeBaseFactory().saveKnowledgeBase(internalKB, null,
"/tmp/saved_from_server.pprj", errors);
where prj is the remote project object.
I've tested this code with a remote project and it works. You can use
also the call setSourceFiles as described here [1] if you save locally
under a different name than on the server.
I hope this helps.
Tania
[1]: http://protege.cim3.net/cgi-bin/wiki.pl?SaveAs
Sjaak van Werkhoven wrote:
> Tania
>
> We have got a method that logs into a server project and writes a
> copy of the entire project
> locally in a pins and pont file on its hard drive every hour, using
> the exportProject method you've mentioned. But we also need a local
> copy of the entire server project. How can this be done?
>
> greetings
> Sjaak van Werkhoven
>
> 2007/9/26, Tania Tudorache <tudorache at stanford.edu>:
>
>> I am not sure what you mean by getting a copy of the pprj file. If you
>> want to make a copy of the existing project, we have this documented on
>> the wiki:
>>
>> http://protege.cim3.net/cgi-bin/wiki.pl?SaveAs
>>
>> Tania
>>
>>
>> Sjaak van Werkhoven wrote:
>>
>>> Dear list
>>>
>>> The classWriter and instanceWriter files mentioned are related to
>>> copies of the pins and pont files. Can someone tell me how i can get
>>> hold of a copy of the pprj file?
>>>
>>> greeting
>>>
>>> Sjaak van Werkhoven
>>>
>>>
>>>
>>>> Yes, that code is well hidden :)
>>>>
>>>> You'll find the code for the CLIPS export in
>>>>
>>>> edu.stanford.smi.protege.storage.clips.ClipsImportExportPlugin
>>>>
>>>> the method you're interested in is:
>>>>
>>>> private static void exportProject(Project project, String
>>>> clsesFileName, String instancesFileName) {
>>>> Collection errors = new ArrayList();
>>>> KnowledgeBase kb = project.getKnowledgeBase();
>>>> ClipsKnowledgeBaseFactory factory = new ClipsKnowledgeBaseFactory();
>>>> Writer clsesWriter = FileUtilities.getWriter(clsesFileName);
>>>> Writer instancesWriter = FileUtilities.getWriter(instancesFileName);
>>>> factory.saveKnowledgeBase(kb, clsesWriter, instancesWriter, errors);
>>>> handleErrors(errors);
>>>> }
>>>>
>>>> where "project" is the remote Project object. If you don't have a
>>>> reference for the remote project, you can get one pretty easy. This is
>>>> described here:
>>>>
>>>> http://protege.cim3.net/cgi-bin/wiki.pl?MultiUserTutorial#nid9AV
>>>>
>>>> (Use first method)
>>>>
>>>> Cheers,
>>>> Tania
>>>>
>>>> Henk-Jan Lebbink wrote:
>>>>
>>>>
>>>>> Dear List,
>>>>>
>>>>> In Protege 3.3.1 under 'file', 'Export to Format' we can export a loaded
>>>>> project to a clips-based file format, even when we are logged into a
>>>>> server project. I would like to write a method that logs into a server
>>>>> project (like any other user) and writes a copy of the entire project
>>>>> locally in a pins and pont file on its hard drive every hour. Basically,
>>>>> such a method is a simple backup server.
>>>>>
>>>>> Logging into a server is not difficult.
>>>>>
>>>>>
>>>>>
>>>>>> RemoteProjectManager rpm = RemoteProjectManager.getInstance();
>>>>>> Project p = rpm.getProject(machine, user, password, projectName, true);
>>>>>>
>>>>>>
>>>>>>
>>>>> My question: How can I save this project p as a clips project. I've
>>>>> searched the source code for the 'Export to Format' code, but I couldn't
>>>>> find it.
>>>>>
>>>>> Thanx in advance!
>>>>> Henk-Jan.
>>>>>
>>>>> _______________________________________________
>>>>> protege-discussion mailing list
>>>>> protege-discussion <at> lists.stanford.edu
>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>>>>
>>>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> protege-discussion mailing list
>>>> protege-discussion <at> lists.stanford.edu
>>>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>>>
>>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> protege-discussion mailing list
>>> protege-discussion at lists.stanford.edu
>>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>>
>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>
>>>
>>>
>> _______________________________________________
>> protege-discussion mailing list
>> protege-discussion at lists.stanford.edu
>> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>
>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>
>>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>
>
More information about the protege-discussion
mailing list