sszuev / ont-converter

A jvm tool to convert any rdf-ontology to owl2-ontology
23 stars 7 forks source link

Failed for custom datatype #1

Closed LorenzBuehmann closed 2 years ago

LorenzBuehmann commented 5 years ago

Tried the 1.0 release on some small DBpedia ABox dataset and got an exception due to a custom datatype (I guess):

Data (dummy.nt):

<http://dbpedia.org/resource/Belgium>   <http://dbpedia.org/ontology/PopulatedPlace/populationDensity>  "363.6"^^<http://dbpedia.org/datatype/inhabitantsPerSquareKilometre> .
<http://dbpedia.org/resource/Belgium>   <http://dbpedia.org/ontology/PopulatedPlace/populationDensity>  "363.58468065625044"^^<http://dbpedia.org/datatype/inhabitantsPerSquareKilometre> .
<http://dbpedia.org/resource/London>    <http://dbpedia.org/ontology/PopulatedPlace/populationDensity>  "5518.0"^^<http://dbpedia.org/datatype/inhabitantsPerSquareKilometre> .

Usage:

java -jar ont-converter.jar -i dummy.nt -o dummy.owl -of MANCHESTER_SYNTAX

Stacktrace:

Exception in thread "main" org.apache.jena.ontology.ConversionException: Can't wrap node http://dbpedia.org/datatype/inhabitantsPerSquareKilometre to class ru.avicomp.ontapi.jena.impl.OntDatatypeImpl
    at ru.avicomp.ontapi.jena.impl.conf.CommonOntObjectFactory.wrap(CommonOntObjectFactory.java:61)
    at org.apache.jena.enhanced.EnhNode.convertTo(EnhNode.java:152)
    at org.apache.jena.enhanced.EnhNode.convertTo(EnhNode.java:31)
    at org.apache.jena.enhanced.Polymorphic.asInternal(Polymorphic.java:62)
    at org.apache.jena.enhanced.EnhNode.as(EnhNode.java:107)
    at ru.avicomp.ontapi.internal.NoCacheDataFactory.get(NoCacheDataFactory.java:135)
    at ru.avicomp.ontapi.internal.DataPropertyAssertionTranslator.toAxiom(DataPropertyAssertionTranslator.java:63)
    at ru.avicomp.ontapi.internal.AxiomTranslator.lambda$translate$0(AxiomTranslator.java:93)
    at org.apache.jena.util.iterator.Map1Iterator.next(Map1Iterator.java:46)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
    at ru.avicomp.ontapi.internal.InternalModel$ObjectTriplesMap.create(InternalModel.java:809)
    at ru.avicomp.ontapi.internal.InternalModel.readAxiomTriples(InternalModel.java:595)
    at ru.avicomp.ontapi.internal.InternalModel.readObjectTriples(InternalModel.java:559)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3366)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2039)
    at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2037)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2020)
    at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112)
    at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:67)
    at ru.avicomp.ontapi.internal.InternalModel.getAxiomTripleStore(InternalModel.java:539)
    at ru.avicomp.ontapi.internal.InternalModel.lambda$listOWLAxioms$10(InternalModel.java:443)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:313)
    at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
    at ru.avicomp.ontapi.internal.InternalModel.readOWLObjects(InternalModel.java:307)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3366)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2039)
    at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2037)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2020)
    at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112)
    at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:67)
    at ru.avicomp.ontapi.internal.InternalModel.listOWLObjects(InternalModel.java:293)
    at ru.avicomp.ontapi.internal.InternalModel.listOWLAnnotationProperties(InternalModel.java:272)
    at ru.avicomp.ontapi.OntBaseModelImpl.annotationPropertiesInSignature(OntBaseModelImpl.java:258)
    at org.semanticweb.owlapi.manchestersyntax.renderer.ManchesterOWLSyntaxFrameRenderer.writeOntology(ManchesterOWLSyntaxFrameRenderer.java:252)
    at org.semanticweb.owlapi.manchestersyntax.renderer.ManchesterSyntaxStorer.storeOntology(ManchesterSyntaxStorer.java:39)
    at org.semanticweb.owlapi.util.AbstractOWLStorer.store(AbstractOWLStorer.java:85)
    at org.semanticweb.owlapi.util.AbstractOWLStorer.storeOntology(AbstractOWLStorer.java:72)
    at org.semanticweb.owlapi.util.AbstractOWLStorer.storeOntology(AbstractOWLStorer.java:111)
    at ru.avicomp.ontapi.OntologyManagerImpl.write(OntologyManagerImpl.java:1654)
    at ru.avicomp.ontapi.OntologyManagerImpl.saveOntology(OntologyManagerImpl.java:1605)
    at ru.avicomp.ontapi.OntologyManagerImpl.saveOntology(OntologyManagerImpl.java:1585)
    at com.github.sszuev.Main.save(Main.java:148)
    at com.github.sszuev.Main.processFile(Main.java:68)
    at com.github.sszuev.Main.process(Main.java:55)
    at com.github.sszuev.Main.main(Main.java:47)

Is this not supported yet or already solved in a the newer version of Ont-API? I can see that Ont-Converter still depends on the version 1.4.0-SNAPSHOT

sszuev commented 5 years ago

Thanks for the report. 1) Currently, this project is not maintaining. Although there are plans to reanimate the project (and remake it wisely), right now I have no time for it.

2) You are right, this is a bug of ONT-API internal transformers, related to handling custom datatypes. It is present even in the up-to-date version. Although it can be fixed easily, I can't do it right now. As a workaround you can add manually declarations for the http://dbpedia.org/ontology/PopulatedPlace/populationDensity and http://dbpedia.org/datatype/inhabitantsPerSquareKilometre:

<http://dbpedia.org/ontology/PopulatedPlace/populationDensity> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#DatatypeProperty> .
<http://dbpedia.org/datatype/inhabitantsPerSquareKilometre> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Datatype> .
sszuev commented 5 years ago

The root problem is fixed in the future release org.github.owlcs:ontapi:2.0.0.

sszuev commented 2 years ago

sure it is fixed in new v2.0 release