Search Mailing List Archives
[protege-discussion] a simple questions about owl programming
Timothy Redmond
tredmond at stanford.edu
Tue Nov 23 09:16:11 PST 2010
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
> 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/20101123/bdd19a4c/attachment.html>
More information about the protege-discussion
mailing list