Search Mailing List Archives
[protege-discussion] C#, OWL & SAVE ISSUE!
Timothy Redmond
tredmond at stanford.edu
Thu Aug 20 13:25:34 PDT 2009
I am not expert on C#/Java integration but I do understand some things
about Protege and Java.
> Here when everything got worse, I needed to transfer the new library
> ( protégé-owl ) which contains the JenaOWLModel so I get the save
> command while I should still keep working with the old one (Jena
> Ontology) because the JenaOWLModel.save takes the OntModel as one of
> it argurments to save the ontology...
>
If you get a Protege distribution then you should include the
protege.jar and all the jars found in the
edu.stanford.smi.protegex.owl plugin directory. In particular this
includes the jena library.
> 2. Import the Protégé-owl library and keep the old one; I am
> getting coflict between the tow libraries.. (ex: Interface Statement
> exists in both edu.stanford.smi.protegex.owl.jena
> &com.hp.hpl.jena.ontology)
This is not a conflict. If the package is different then they are
different classes. I don't know whether there will be any c#/Java
integration problems with this.
> 3. Work only with Protégé-owl library (this seems to be
> perfect soultion, but unfortuantely I getting this error:
> org
> .apache
> .xerces
> .parsers
> .SAXParser
> .<init>(Lorg.apache.xerces.xni.parser.XMLParserConfiguration;)V
> Description: An unhandled exception occurred during the execution of
> the current web request. Please review the stack trace for more
> information about the error and where it originated in the code.
>
You are missing the xml-apis.jar and xerces.jar files that can be
found in the owl plugin directory of a distribution.
> (I also tried protégé 4 API found in this page http://protege.stanford.edu/download/protege/4.0/zip/?C=N;O=D
> Is this what i need?!). I do the transfer using “ikvm-0.34.0.2”.
>
Protege 4 uses an entirely different owl api than Protege 3.
-Timothy
On Aug 20, 2009, at 12:48 AM, Alaa Tadmori wrote:
> Hello everyone,
>
> I am an asp.net developer; I have been trying to use the Jena
> library to make a use of Semantic Web. As you know, Jena is Java
> based (I don’t know much JavaL) so I tried to transfer the library
> to C# to be able to work against it using asp.net. Everything was
> going just fine, I was able to programmatically input the ontology,
> add, edit & delete new classes & instances & query it. Almost in the
> end, as expected, I needed a way to save the in-memory ontology I
> have created or modified, I tried:
>
> ontModel.writeAll(outputStream, null, null) (with all its
> vairations) But it didn’t work out.
>
> When I checked your mainling list I found that many people are
> asking this question, like how to save the ontology or how to save
> the inferred statements, the answer was to use
>
> jenaOWLModel.save(…)
>
> Here when everything got worse, I needed to transfer the new library
> ( protégé-owl ) which contains the JenaOWLModel so I get the save
> command while I should still keep working with the old one (Jena
> Ontology) because the JenaOWLModel.save takes the OntModel as one of
> it argurments to save the ontology...
>
> The problem is that when I transfered both of the libraries and
> imported them to Visual Studio they seem to conflict with each
> other. To cut it short (I’m sorry that it is already long) these
> were my unsuccessful solutions:
>
> 1. Use ontModel.writeAll(…) Doesn’t save any new additions in
> case I upload the ontology from a URI, it only writes the model
> itself.
> 2. Import the Protégé-owl library and keep the old one; I am
> getting coflict between the tow libraries.. (ex: Interface Statement
> exists in both edu.stanford.smi.protegex.owl.jena
> &com.hp.hpl.jena.ontology)
>
>
> 3. Work only with Protégé-owl library (this seems to be
> perfect soultion, but unfortuantely I getting this error:
> org
> .apache
> .xerces
> .parsers
> .SAXParser
> .<init>(Lorg.apache.xerces.xni.parser.XMLParserConfiguration;)V
> Description: An unhandled exception occurred during the execution of
> the current web request. Please review the stack trace for more
> information about the error and where it originated in the code.
>
> Exception Details: java.lang.NoSuchMethodError:
> org
> .apache
> .xerces
> .parsers
> .SAXParser
> .<init>(Lorg.apache.xerces.xni.parser.XMLParserConfiguration;)V
> Source Error:
> Line 23: public static void GetModel(string filePath)
> Line 24: {
> Line 25: model = ModelFactory.createOntologyModel();
> Line 26:
> Line 27: inputstream = FileManager.get().open(filePath);
> (This error drove me crazy, please Java foxes what is this:
> java.lang.NoSuchMethodError:
> org
> .apache
> .xerces
> .parsers
> .SAXParser
> .<init>(Lorg.apache.xerces.xni.parser.XMLParserConfiguration;)V
>
>
> An important thing to mention is that I’m transferring the library
> of Jena Ontology using the zip file that contains all the jar files
> of the API but for the protégé-owl I coun’t find such a thing, I
> transferred the library using the jar files I found in the
> Protege_3.3.1\plugins folder (I also tried protégé 4 API found in
> this page http://protege.stanford.edu/download/protege/4.0/zip/?C=N;O=D
> Is this what i need?!). I do the transfer using “ikvm-0.34.0.2”.
>
> So this is my problem which I’m trying to solve for over than 3
> weaks, more than 7 hours a day. I hope you have a solution or any
> recommendation on how to solve this tricky problem.
>
> I appreciate your patience, thank you so much for your cooperation.
>
>
> _______________________________________________
> 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