Hi June,
On 17/05/11 08:33, 朱曼 wrote:
> I repackaged the codes in the attachment, the last two packages lacks a
> Globals.java file, so it can't run directly~~sorry~~
>
> The followings are a detailed explanation about my problem, including
> some code samples~:
> 1.
> At first, I initialize an ontmodel as follows:
> OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
>
> The second time, I initialize the model as follows:
> m = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
>
> After read an .owl, I create a class and print it in its axiom form
> ObjectProperty prop = m
> .getObjectProperty(m.getNsPrefixURI("") + "part");
> OntClass owlThing = m.getOntClass(OWL.Thing.getURI());
> OntClass cls = m.createSomeValuesFromRestriction(null, prop,
> (null == prop.getRange()) ? owlThing : prop.getRange());
> String description = ConceptDescriptor
> .renderConceptAxiomDescription(cls);
> System.out.println(description);
>
> For the first time, the output is as follows:
> ∃part.Thing
> the second time, the output is:
> Exception in thread "main" java.lang.StackOverflowError
> at
> org.mindswap.pellet.jena.graph.loader.DefaultGraphLoader.node2term(DefaultGraphLoader.java:542)
> at
> org.mindswap.pellet.jena.graph.query.GraphQueryHandler$19.contains(GraphQueryHandler.java:540)
> at
When I tried it (nb, I changed your package names to usertests for
convenience of running on my computer), the rest of the stacktrace was
many copies of:
usertests.ConceptDescriptor.renderComplementClass(ConceptDescriptor.java:99)
at
usertests.ConceptDescriptor.renderConceptAxiomDescription(ConceptDescriptor.java:37)
at
usertests.ConceptDescriptor.renderComplementClass(ConceptDescriptor.java:99)
at
usertests.ConceptDescriptor.renderConceptAxiomDescription(ConceptDescriptor.java:37)
at
usertests.ConceptDescriptor.renderComplementClass(ConceptDescriptor.java:99)
at
usertests.ConceptDescriptor.renderConceptAxiomDescription(ConceptDescriptor.java:37)
at
usertests.ConceptDescriptor.renderComplementClass(ConceptDescriptor.java:99)
at
usertests.ConceptDescriptor.renderConceptAxiomDescription(ConceptDescriptor.java:37)
So it looks like when you get the additional triples inferred by Pellet,
your code goes into an infinite recursion.
> 2. The second problem is related to the following code:
> StringBuffer str = new StringBuffer();
> System.err
> .println("\nUnicode Character is not displayed properly
> when it follows immediately after more than 1 english characters");
> str.append("an");
> str.append("\u2293");
> System.err.println(str);
> System.out.print("an");
> System.out.println("\u2293");
> System.out.println("\u2293");
>
> when "\u2293" follows more than 1 English characters, it goes to a
> square, but it is expected to be "⊓"~
This works fine on my Linux system. I suspect it's something to do with
MS Windows. Anyway, it's a general Java problem not something specific
to Jena, so unless anyone else on the list has any suggestions, I
recommend you make the question as specific as you can and post it onto
stackoverflow.com, or similar programming Q&A site.
Ian
--
____________________________________________________________
Ian Dickinson Epimorphics Ltd, Bristol, UK
mailto:[email protected] http://www.epimorphics.com
cell: +44-7786-850536 landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd. is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
Portishead, Bristol BS20 6PT, UK