简体   繁体   中英

Add imports in OWLAPI

I'd like to check the consistency of a number of triples by using a reasoner. There are around 700k triples to check, so for each of them I created a file with the triple and the direct types of its subject and object.

My problem is that if I don't import all the properties everytime I load one of the small file, all ObjectProperty statements are treated as AnnotationAxioms, which doesn't allow to spot any inconsistency. How can I import all the properties just once and add them to the file with the triples everytime I load one?

Thanks in advance!

Edit I add here an example of the small files I am analysing.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:wdt="http://www.wikidata.org/prop/direct/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://www.wikidata.org/entity/Q295376">
<rdf:type rdf:resource="http://www.wikidata.org/entity/Q5"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.wikidata.org/entity/Q21077119">
<rdf:type rdf:resource="http://www.wikidata.org/entity/Q17299750"/>
<wdt:P1346 rdf:resource="http://www.wikidata.org/entity/Q295376"/>
<rdf:type rdf:resource="http://www.wikidata.org/entity/Q4993329"/>
</rdf:Description>
</rdf:RDF>

The above lines do not include the import axioms. Thanks!

It will be much faster to not write the triple to disk. Create tee ontology with declarations for the properties and then add the axiom you wish to test. You can then create the reasoner, test for consistency, discard the reasoner and remove the axiom you just tested. The ontology is then available to be used with another axiom and a new reasoner.

However, you're checking each axiom in isolation; while the axioms might be consistent on their own, this does not provide assurances as to what the axioms will do together - assuming that they will appear in the same ontology after you finish your test.

Specifically on how to add an import to an ontology, see the OWLAPI documentation at https://github.com/owlcs/owlapi/wiki/Add-an-import-directive-to-an-ontology

I don't believe that's the best solution to your scenario, but it's the question you asked :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM