Closed zengkungan closed 2 years ago
It seems the problem comes from Prefix. Is there any way to redefine the Prefix?
Thanks!
You should be able to do that within the prefix panel in Protege (if you are using Protege).
What do your current prefixes look like? (You can post your OWL file.)
Thanks so much! Martin. This is the Prefix in OWL file:
Prefix(xsd:=http://www.w3.org/2001/XMLSchema#) Prefix(swrlb:=http://www.w3.org/2003/11/swrlb#) Prefix(owl:=http://www.w3.org/2002/07/owl#) Prefix(var:=<urn:swrl#>) Prefix(var2:=<urn:http://www.w3.org/2003/11/swrl#>) Prefix(:=http://localhost:8090/OntDLG/OntKB.owl#) Prefix(xml:=http://www.w3.org/XML/1998/namespace) Prefix(rdf:=http://www.w3.org/1999/02/22-rdf-syntax-ns#) Prefix(swrl:=http://www.w3.org/2003/11/swrl#) Prefix(rdfs:=http://www.w3.org/2000/01/rdf-schema#) Prefix(tutorial:=http://localhost:8090/OntDLG/OntKB.owl#) Ontology(http://localhost:8090/OntDLG/OntKB.owl Declaration(Class(tutorial:AbstractMeaningRepresentationParsing)) Declaration(Class(tutorial:Accuracy)) Declaration(Class(tutorial:AspectLevel)) Declaration(Class(tutorial:AutomaticEssayGrading)) Declaration(Class(tutorial:BLEU)) Declaration(Class(tutorial:CNN)) Declaration(Class(tutorial:CandiateArch))
Are you using the latest Protege 5.5 release and the latest 2.0.11 SWRLAPI?
Can you try generating an RDF/XML serialization. I know that some earlier versions of the SWRLAPI had issues with other serializations.
Also, can you post an example with a SWRL rule that works in Protege.
I tried it, but still the same problem. the new RDF/XML serialization: <?xml version="1.0"?> <rdf:RDF xmlns="http://localhost:8090/OntDLG/OntKB.owl#" xml:base="http://localhost:8090/OntDLG/OntKB.owl" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:var="urn:swrl#" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:swrl="http://www.w3.org/2003/11/swrl#" xmlns:var2="urn:http://www.w3.org/2003/11/swrl#" xmlns:swrla="http://swrl.stanford.edu/ontologies/3.3/swrla.owl#" xmlns:swrlb="http://www.w3.org/2003/11/swrlb#" xmlns:tutorial="http://localhost:8090/OntDLG/OntKB.owl#">
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Annotation properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled -->
<owl:AnnotationProperty rdf:about="http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://localhost:8090/OntDLG/OntKB.owl#CanHandle -->
<owl:ObjectProperty rdf:about="http://localhost:8090/OntDLG/OntKB.owl#CanHandle"/>
<!-- http://localhost:8090/OntDLG/OntKB.owl#IsComposed -->
<owl:ObjectProperty rdf:about="http://localhost:8090/OntDLG/OntKB.owl#IsComposed"/>
<!-- http://localhost:8090/OntDLG/OntKB.owl#IsOutput -->
<owl:ObjectProperty rdf:about="http://localhost:8090/OntDLG/OntKB.owl#IsOutput"/>
Can you post the file rather than inlining. You can change the extension from .owl to .txt so that GitHub accepts it.
The last line of the file should be something like:
<!-- Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi -->
I am having a hard time reproducing this. Can you post the full exception?
Sorry, the detailed exception didn't be captured and printed. I am also trying to run the code independently(separate it from the whole project). Thanks for your help! I'll post something new once I complete it.
The same query works in Protege, but when it is executed with queryEngine, I got these Exceptions. the code as shown: OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(BASE_URL));