Closed zzw95 closed 7 years ago
The error does not correspond to the query. The parser is complaining about a reference to an OWL entity A that is not present in the associated ontology.
I would just add to @cedaradmin 's comment that you should tell us in which line is the exception thrown, because it is not obvious.
Also it would be very helpful if we could see the ontologies, because the problem may lie there.
And finally, if the map.owl
ontology imports the other two, than you will need to assign some prefixes to the namespaces of entities in family.owl
and familyA.owl
ontologies (if you haven't already), and use the prefixed name of the entities in your SWRL rule. For example, if you define the prefix fam
for http://semanticweb.org/zzw/ontologies/2016/10/family#
, and fama
for http://semanticweb.org/zzw/ontologies/2016/11/familyA#
, your SWRL rule should like like:
fam:People(?p)->fama:PeopleA(?p)
Thanks! I make it if I assign the prefixes of impogies
@zzw95 some parts of your message got lost. Should we understand that it works if you set prefixes for your imported ontologies, and use those prefixes in your rule? If so, can you please close this issue? (Or tell us and we will close it)
Hello,
I am a research student and new to ontology, protege, SWRL and SQWRL.
I saw this code in github and test it to see if I could use the ideas from this code to solve my problem but I am having the following runtime errors: I will be grateful for any help to solve this problem.
Kind regards Ebiye James
Runtime error Exception in thread "main" org.swrlapi.sqwrl.exceptions.SQWRLInvalidColumnNameException: invalid column name name at org.swrlapi.factory.DefaultSQWRLResultManager.checkColumnName(DefaultSQWRLResultManager.java:949) at org.swrlapi.factory.DefaultSQWRLResultManager.getColumnIndex(DefaultSQWRLResultManager.java:674) at org.swrlapi.factory.DefaultSQWRLResultManager.getValue(DefaultSQWRLResultManager.java:370) at org.swrlapi.factory.DefaultSQWRLResultManager.hasNamedIndividualValue(DefaultSQWRLResultManager.java:520) at org.swrlapi.factory.DefaultSQWRLResultManager.getNamedIndividual(DefaultSQWRLResultManager.java:404) at SQWRLQuery.main(SQWRLQuery.java:29)
See code public class SQWRLQuery { public static void main(String[] args) throws OWLOntologyCreationException, SQWRLException, SWRLParseException{ OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = ontologyManager.loadOntologyFromOntologyDocument(new File("MyPerson.owl"));
SQWRLQueryEngine queryEngine = SWRLAPIFactory.createSQWRLQueryEngine(ontology);
queryEngine.createSQWRLQuery("Q1", "Person(?p) -> sqwrl:select(?p)");
SQWRLResult result = queryEngine.runSQWRLQuery("Q1");
while (result.next()) {
//SQWRLNamedIndividualResultValue nameValue = result.getNamedIndividual("name");
//SQWRLNamedIndividualResultValue salaryValue = result.getNamedIndividual("salary");
System.out.println("Name: " + ((Object) result.getNamedIndividual("name")).toString());
System.out.println("Name: " + "has committed");
System.out.println("Name: " + ((Object) result.getNamedIndividual("name")).toString());
}
}
}
The example on the wiki for result processing was a little misleading. I have updated it here:
https://github.com/protegeproject/swrlapi/wiki/SQWRLQueryAPI#processing-sqwrl-query-results
You need to match the names of the columns to the variables used in the select statement.
Hi, There is a class People in family.owl and a class PeopleA in familyA.owl, and map.owl imports family.owl and familyA.owl .And I want to map the content in between (family -> familyA) .So I create some swrl rules in map.owl. But there is an exception like "Exception in thread "main" org.swrlapi.parser.SWRLParseException: Invalid SWRL atom predicate 'A'". Cheers.
Code: