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-discussion] a simple questions about owl programming

Timothy Redmond tredmond at stanford.edu
Wed Nov 24 07:41:53 PST 2010


>  So the last solutions I used is copy the whole text of 
> newversion.owl, and paste it into the familyCopy_changed.owl(delete 
> existing text to make a blank page), and it really works. although the 
> newversion.owl is created by protege 4.1 and I didn't find any 
> differences about structures between newversion.owl and 
> familyCopy_changed.owl. that is weird.

I didn't have any problems with your version of newversion.owl.  I had 
to modify the PropertyValue program in order to see anything interesting 
but it worked fine.

I do have a theory though.  The newversion.owl uses an international 
character set and it looks like it is correctly encoded in utf-8.   In 
order to read this file correctly in the OWL api you need to set the 
system property -Dfile.encoding=utf-8.  It is possible that when you run 
the program in eclipse or from the command line you are using a 
different encoding and therefore things get confused.  (If you use 
eclipse, this setting can be put in the VM arguments section of the 
Arguments section of the run command.)  It is also possible to pass the 
OWL api file readers and you should be able to set the encoding there.

In fact by deliberately setting a bogus encoding here I was able to get 
an error that might be a variation of your error:

> Parser: RDFXMLParser
> org.semanticweb.owlapi.rdf.syntax.RDFParserException: 
> [line=55:column=118] IRI 'http://www.semanticweb.org/ontologies/2010 
> /10 /Ontology1290427703464.owl#省会' cannot be resolved against curent 
> base IRI 
> http://www.semanticweb.org/ontologies/2010/10/Ontology1290427703464.owl
>
> ----

It is a different error than yours but it was obtained by running the 
exact same program with the exact same ontology with a different file 
encoding set.

You also said

> the operations on protege can't be mapped on the owl files. for 
> example: I delete a property for individual using the interface, and 
> when I open the owl file using text editor, it's still here. and some 
> other false operation also can happen sometimes when a lot of classes 
> and individuals included. 

I haven't ever seen this issue before.  A step by step example would be 
nice.

> and I wonder what size for owl  files can be beared by protege or owlapi.

I just loaded a moderate sized ontology in about 25 seconds.  The source 
file was about 198 megabytes and it had over 84000 classes.  When the 
ontologies get bigger you may need to adjust the java memory settings 
though (-Xmx).


Finally, it seems that using international characters in java code is 
not as simple as it could be.  On some machines, the javac parser 
accepts utf-8 in the source code by default but this does not work 
across machines.  In order to use non-ascii characters in java source 
code, it seems that you need to know the unicode codes.  So Protégé 
would be encoded in a java file as

    "Prot\u00E9g\u00E9"


-Timothy



On 11/23/2010 11:49 PM, tingyu li wrote:
> hi,
> this three mails just refer one question, as I described in the last 
> mail, " Protege 3 can work with the ontology but the Manchester OWL 
> finds a syntax error". in the third mail from the end, I send the 
> error "unknown protocol: c", and I explained it in the second mail 
> from the end, that because I forget add prefix file:/// in the front 
> of the path string. but the problem still doesn't fix. and in order to 
> avoid any encoding or any unknown or unexpected error, I create a new 
> rdf/xml files using protege 4.1 beta.and I didn't do any change by 
> editing the owl file with a text editor(I'm pretty sure about that).
> and I tried a lot of methods to test the files. as I send you the 
> attachment in the last three mails, I copy  the parts  of ontology 
> newversion including "rdf:resource" associated with an element type 
> "rdfs:subClassOf" into familyCopy_changed.owl, and it still can be 
> loaded correctly. and  the rest part of this newversion.owl still 
> doesn't work.  and I think it must has some encoding errors. So the 
> last solutions I used is copy the whole text of newversion.owl, and 
> paste it into the familyCopy_changed.owl(delete existing text to make 
> a blank page), and it really works. although the newversion.owl is 
> created by protege 4.1 and I didn't find any differences about 
> structures between newversion.owl and familyCopy_changed.owl. that is 
> weird.
> and I also find that protege is not stable based on windows OS. 
> sometimes, the operations on protege can't be mapped on the owl files. 
> for example: I delete a property for individual using the interface, 
> and when I open the owl file using text editor, it's still here. and 
> some other false operation also can happen sometimes when a lot of 
> classes and individuals included. and I wonder what size for owl  
> files can be beared by protege or owlapi.
> Thanks.
> by the way, the ontology newversion.owl and familyCopy_changed.owl can 
> be found in the last mail I send to you as an attachment.
> 2010/11/24 Timothy Redmond <tredmond at stanford.edu 
> <mailto:tredmond at stanford.edu>>
>
>
>     I see you have some questions spanning a few days - I will go
>     through them in reverse order.
>
>
>>      but it can't be processed by the codes PropertyValuee.java, as
>>     the same time family.owl can be. I'm so confused by this.  does
>>     anybody give me a hint? And the error code is :
>
>     The errors that you are reporting are syntax errors coming from
>     the Manchester OWL api. Your first snippet of code is based on the
>     Protege 3 OWL api.  It is a bit surprising but not amazing that
>     Protege 3 can work with the ontology but the Manchester OWL finds
>     a syntax error.  I believe that the Manchester OWL api is probably
>     right - there is a problem with the ontology that it is trying to
>     parse.  In particular the rdf error is probably the right one:
>
>
>>     Parser: RDFXMLParser
>>     org.xml.sax.SAXParseException: The value of attribute
>>     "rdf:resource" associated with an element type "rdfs:subClassOf"
>>     must not contain the '<' character.
>
>     If you send the ontology that the Manchester OWL api is trying to
>     parse at this point I can give you more information.
>
>     I am not sure but I am guessing that some of your problems come
>     from editing an ontology with a text editor.  We all do this but
>     it is a dangerous practice.
>
>     -Timothy
>
>
>
>     On 11/22/2010 06:06 AM, tingyu li wrote:
>>
>>     OK. Lst's forget the problems above, and I have simplified the
>>     questions. a new owl files (newversion.owl) has been created, and
>>     it can be processed by the codes below, and So does the
>>     familyCopy_changed.owl :
>>
>>         String uri =
>>         "file:///C://Users//Li//ontologies//newversion.owl";
>>
>>
>>                 OWLModel owlModel =
>>         ProtegeOWL.createJenaOWLModelFromURI(uri);
>>
>>                 Collection classes =
>>         owlModel.getUserDefinedOWLNamedClasses();
>>                 //OWLNamedClass destinationClass =
>>         owlModel.getOWLNamedClass("family");
>>                 for (Iterator it = classes.iterator(); it.hasNext();) {
>>                     OWLNamedClass cls = (OWLNamedClass) it.next();
>>                     Collection instances = cls.getInstances(false);
>>                     System.out.println("Class " +
>>         cls.getBrowserText() + " (" + instances.size() + ")");
>>                     for (Iterator jt = instances.iterator();
>>         jt.hasNext();) {
>>                         OWLIndividual individual = (OWLIndividual)
>>         jt.next();
>>                         System.out.println(" - " +
>>         individual.getBrowserText());
>>                     }
>>                 }
>>
>>      but it can't be processed by the codes PropertyValuee.java, as
>>     the same time family.owl can be. I'm so confused by this.  does
>>     anybody give me a hint? And the error code is :
>>
>>         detailed logs:
>>         --------------------------------------------------------------------------------
>>         Parser: RDFXMLParser
>>         org.xml.sax.SAXParseException: The value of attribute
>>         "rdf:resource" associated with an element type
>>         "rdfs:subClassOf" must not contain the '<' character.
>>
>>         --------------------------------------------------------------------------------
>>         Parser: OWLXMLParser
>>         Attribute not found: IRI (Line 30)
>>
>>         --------------------------------------------------------------------------------
>>         Parser: OWLFunctionalSyntaxOWLParser
>>         Encountered " <ERROR> "< "" at line 1, column 1.
>>         Was expecting:
>>             "Ontology" ...
>>              (Line 0)
>>
>>         --------------------------------------------------------------------------------
>>         Parser: TurtleOntologyParser
>>         uk.ac.manchester.cs.owl.owlapi.turtle.parser.ParseException:
>>         Encountered "" at line 1, column 1.
>>         Was expecting one of:
>>
>>
>>         --------------------------------------------------------------------------------
>>         Parser: OWLOBOParser
>>         org.coode.owlapi.obo.parser.ParseException: Encountered
>>         "<!DOCTYPE rdf" at line 4, column 1.
>>         Was expecting:
>>             "\n" ...
>>              (Line 1)
>>
>>         --------------------------------------------------------------------------------
>>         Parser: KRSS2OWLParser
>>         de.uulm.ecs.ai.owlapi.krssparser.ParseException: Encountered
>>         "<?xml version=\"1.0\"?>" at line 1, column 1.
>>         Was expecting:
>>         <EOF>
>>
>>
>>         --------------------------------------------------------------------------------
>>         Parser: ManchesterOWLSyntaxOntologyParser
>>         Encountered '<?xml version="1.0"?>' at line 1 column 1. 
>>         Expected either 'Ontology:' or 'Prefix:' (Line 1)
>>
>>
>>             at
>>         uk.ac.manchester.cs.owl.owlapi.ParsableOWLOntologyFactory.loadOWLOntology(ParsableOWLOntologyFactory.java:197)
>>             at
>>         uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:619)
>>             at
>>         uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:585)
>>             at
>>         uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:589)
>>             at
>>         com.demo.application.PropertyValuee.main(PropertyValuee.java:26)
>>
>>
>>
>>
>>
>>     -- 
>>     Li
>>
>>
>>     _______________________________________________
>>     protege-discussion mailing list
>>     protege-discussion at lists.stanford.edu
>>     <mailto: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
>     <mailto: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
>
>
>
>
> -- 
> Li
>
>
> _______________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101124/3c69a1f4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newversion.owl
Type: application/rdf+xml
Size: 7435 bytes
Desc: not available
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101124/3c69a1f4/attachment.owl>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PropertyValue.java
Type: text/x-java
Size: 1500 bytes
Desc: not available
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101124/3c69a1f4/attachment.java>


More information about the protege-discussion mailing list