Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get instances of OWL Class correctly - version 5.1.5 of OWL-API and Hermit - 1.4.1.513 #800

Closed
karanthpallavi opened this issue Nov 7, 2018 · 13 comments

Comments

@karanthpallavi
Copy link

Have used the following code to get instances of class Movie:

String base = "http://www.semanticweb.org/drkm/ontologies/2018/5/untitled-ontology-42#";
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLClass movieClass = dataFactory.getOWLClass(IRI.create(base+"Movie"));
System.out.println("Class "+movieClass);
Reasoner.ReasonerFactory factory = new Reasoner.ReasonerFactory();
Configuration configuration=new Configuration();
configuration.throwInconsistentOntologyException=false;
OWLReasoner reasoner=factory.createReasoner(ontology, configuration);
System.out.println("In Genre Coverage");
// Get individuals of class Movie
Set indivMovies = reasoner.getInstances(movieClass, true).getFlattened();
OWLObjectProperty hasCast = dataFactory.getOWLObjectProperty(IRI.create(base+"hasCast"));
Iterator iterMovie = indivMovies.iterator();
while(iterMovie.hasNext())
{
OWLNamedIndividual eachMovie = (OWLNamedIndividual) iterMovie.next();
// Get hasCast assertions of this individual
Set castOfThisMovie = reasoner.getObjectPropertyValues(eachMovie, hasCast).getFlattened();
System.out.println("Movie: "+eachMovie);
System.out.println("---------------------------------------------------------------------------");
for(OWLNamedIndividual eachCast: castOfThisMovie)
{
System.out.println("Cast "+ eachCast.getIRI().getShortForm());
}
System.out.println("---------------------------------------------------------------------------");
}

May I know what may be the issue?
It gives me instances of all classes and not just Movie class

@ignazio1977
Copy link
Contributor

What are the classes equivalent to Movie?

@karanthpallavi
Copy link
Author

karanthpallavi commented Nov 8, 2018 via email

@ignazio1977
Copy link
Contributor

Can you please add the ontology without the inferred axioms? It is impossible to figure out what is being expressed in this ontology due to the noise from irrelevant axioms.

We've been through how unnecessary it is to put the inferred axioms back in the ontology when using a reasoner in other issues.

@karanthpallavi
Copy link
Author

Movie_ABoxLoaded_PopularPage1.txt
Have attached as text the Ontology file

@ignazio1977
Copy link
Contributor

Issue owlcs/hermit-reasoner#3 might be related. This was fixed in HermiT 1.4.3.456 and 1.4.3.517. Trying your code with those versions I get back only Movies.

@karanthpallavi
Copy link
Author

Ok, thanks will use the latest version of Hermit then,
Thanks much for all the support

@karanthpallavi
Copy link
Author

Found an issue again with Hermit 1.4.3.517,

Though the ontology does not contain equivalent data properties, when i run my application, i get the following error:
Exception in thread "main" java.lang.IllegalArgumentException: Error: In OWL 2 DL, owl:topDataProperty is only allowed to occur in the super property position of SubDataPropertyOf axioms, but the ontology contains an axiom EquivalentDataProperties(owl:topDataProperty ) that violates this condition.
May i know if this can be resolved?

@karanthpallavi
Copy link
Author

Found an issue again with Hermit 1.4.3.517,

Though the ontology does not contain equivalent data properties, when i run my application, i get the following error:
Exception in thread "main" java.lang.IllegalArgumentException: Error: In OWL 2 DL, owl:topDataProperty is only allowed to occur in the super property position of SubDataPropertyOf axioms, but the ontology contains an axiom EquivalentDataProperties(owl:topDataProperty ) that violates this condition.
May i know if this can be resolved?

@ignazio1977
Copy link
Contributor

I don't get the same issue with the ontology attached to this issue. Which ontology causes the issue?

@karanthpallavi
Copy link
Author

karanthpallavi commented Nov 12, 2018 via email

@ignazio1977
Copy link
Contributor

Ok. As discussed a few times before, reasoners don't do well with reasoning on ontologies where inferred axioms are added back in. Also, reasoning again on ontologies where inferred axioms have been asserted is not useful - it just forces the reasoner to do the same work twice.

@ignazio1977
Copy link
Contributor

In particular, all inferred axioms that say property x subproperty of topDataProperty (or topObjectProperty) are useless axioms. They add no information to the ontology.

@karanthpallavi
Copy link
Author

Ok, i get it..
Will try on the non inferred version of ontology,
Thanks much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants