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

Equivalent classes not correctly inferred #16

Open
matentzn opened this issue May 11, 2017 · 1 comment
Open

Equivalent classes not correctly inferred #16

matentzn opened this issue May 11, 2017 · 1 comment

Comments

@matentzn
Copy link

matentzn commented May 11, 2017

Two equal definitions are not inferred to be equivalent.

Tried with jfact 4.0.1 and 5.0.1 (and the latest OWL API versions for those, 5.0.5 and 4.3.1).
Used fr Pellet:

net.sourceforge.owlapi
pellet-owlapi-ignazio1977
2.4.0-ignazio1977


owlapi-distribution
net.sourceforge.owlapi

public static void main(String[] args) {


		try {
			OWLOntologyManager man = OWLManager.createOWLOntologyManager();
			OWLDataFactory df = man.getOWLDataFactory();
			IRI base = IRI.create("http://owl.api.tutorial#");
			
			OWLOntology o = man.createOntology();

			// Classes
			OWLClass pizza = df.getOWLClass(IRI.create(base + "Pizza"));
			OWLClass meatPizza = df.getOWLClass(IRI.create(base + "MeatPizza1"));
			OWLClass meatTopping = df.getOWLClass(IRI.create(base + "MeatTopping"));
			OWLClass meatPizza2 = df.getOWLClass(IRI.create(base + "MeatPizza2"));
			OWLObjectProperty hasTopping = df.getOWLObjectProperty(IRI.create(base + "hasTopping"));

			OWLEquivalentClassesAxiom meatPizza_def = df.getOWLEquivalentClassesAxiom(meatPizza,
					df.getOWLObjectIntersectionOf(pizza, df.getOWLObjectSomeValuesFrom(hasTopping, meatTopping)));

			OWLEquivalentClassesAxiom meatPizza_def2 = df.getOWLEquivalentClassesAxiom(meatPizza2,
					df.getOWLObjectIntersectionOf(pizza, df.getOWLObjectSomeValuesFrom(hasTopping, meatTopping)));

			man.addAxiom(o,meatPizza_def);
			man.addAxiom(o,meatPizza_def2);

			OWLReasoner r = new JFactFactory().createReasoner(o);
			r.precomputeInferences(InferenceType.CLASS_HIERARCHY);

			System.out.println("Equivalent classes of MeatPizza:");
			r.getEquivalentClasses(meatPizza).getEntities().forEach(System.out::println);
			System.out.println(r.isEntailed(df.getOWLEquivalentClassesAxiom(meatPizza, meatPizza2)));
			
			
			r = new PelletReasonerFactory().createReasoner(o);
			r.precomputeInferences(InferenceType.CLASS_HIERARCHY);

			System.out.println("Equivalent classes of MeatPizza:");
			r.getEquivalentClasses(meatPizza).getEntities().forEach(System.out::println);
			System.out.println(r.isEntailed(df.getOWLEquivalentClassesAxiom(meatPizza, meatPizza2)));

			//saveOntology(man, o, IRI.create(new File("D:\\onto\\test2.owl").toURI()));

		} catch (OWLOntologyCreationException e) {
			e.printStackTrace();
		}
	}

@ignazio1977
Copy link
Contributor

The problem is with the anonymous intersection class. The second axiom using it is erasing the first axiom using it - looking up for its equivalent classes only beings up MeatPizza2.
Using a named class in place of the intersection makes the issue disappear.

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