org.semanticweb.owlapi.model.OWLDisjointObjectPropertiesAxiom Java Examples

The following examples show how to use org.semanticweb.owlapi.model.OWLDisjointObjectPropertiesAxiom. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractElkObjectConverter.java    From elk-reasoner with Apache License 2.0 5 votes vote down vote up
@Override
public OWLDisjointObjectPropertiesAxiom visit(
		ElkDisjointObjectPropertiesAxiom axiom) {
	return owlFactory_.getOWLDisjointObjectPropertiesAxiom(
			toObjectPropertyExpressionSet(
					axiom.getObjectPropertyExpressions()));
}
 
Example #2
Source File: AbstractOwlAxiomConverterVisitor.java    From elk-reasoner with Apache License 2.0 5 votes vote down vote up
@Override
public T visit(OWLDisjointObjectPropertiesAxiom axiom) {
	throw new IllegalArgumentException(
			OWLDisjointObjectPropertiesAxiom.class.getSimpleName()
					+ " cannot be converted to "
					+ getTargetClass().getSimpleName());
}
 
Example #3
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * negative concept inclusion in the negative closure
 */
public Set<OWLSubClassOfAxiom> getNegativeInclInNegClosure() {
	if (negIncAxInNegClos ==null) {
		negIncAxInNegClos = new HashSet<OWLSubClassOfAxiom>();
		negObjectSubPropAxInNegClos = new HashSet<OWLDisjointObjectPropertiesAxiom>();
		negDataSubPropAxInNegClos = new HashSet<OWLDisjointDataPropertiesAxiom>();
		organizeNegativeClosure(negativeInclClosure, negIncAxInNegClos, negObjectSubPropAxInNegClos, negDataSubPropAxInNegClos);
	}
	return negIncAxInNegClos;
}
 
Example #4
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * negative object property inclusion axioms in the negative closure
 */
protected Set<OWLDisjointObjectPropertiesAxiom> getNegativeObjectSubPropInNegClosure() {
	if (negObjectSubPropAxInNegClos ==null) {
		negIncAxInNegClos = new HashSet<OWLSubClassOfAxiom>();
		negObjectSubPropAxInNegClos = new HashSet<OWLDisjointObjectPropertiesAxiom>();
		negDataSubPropAxInNegClos = new HashSet<OWLDisjointDataPropertiesAxiom>();
		organizeNegativeClosure(negativeInclClosure, negIncAxInNegClos, negObjectSubPropAxInNegClos, negDataSubPropAxInNegClos);
	}
	return negObjectSubPropAxInNegClos;
}
 
Example #5
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * negative data property inclusion axioms in the negative closure
 */
protected Set<OWLDisjointDataPropertiesAxiom> getNegativeDataSubPropAxInClosure() {
	if (negDataSubPropAxInNegClos == null) {
		negIncAxInNegClos = new HashSet<OWLSubClassOfAxiom>();
		negObjectSubPropAxInNegClos = new HashSet<OWLDisjointObjectPropertiesAxiom>();
		negDataSubPropAxInNegClos = new HashSet<OWLDisjointDataPropertiesAxiom>();
		organizeNegativeClosure(negativeInclClosure, negIncAxInNegClos, negObjectSubPropAxInNegClos, negDataSubPropAxInNegClos);
	}
	return negDataSubPropAxInNegClos ;
}
 
Example #6
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
private static void organizeNegativeClosure(Collection<OWLAxiom> normalizedNegClosureAxioms, Collection<OWLSubClassOfAxiom> negIncAxInNegClos,
		Collection<OWLDisjointObjectPropertiesAxiom> negObjectSubPropAxInNegClos, Collection<OWLDisjointDataPropertiesAxiom> negDataSubPropAxInNegClos) {
		organizeTboxAxioms(normalizedNegClosureAxioms, negIncAxInNegClos, negObjectSubPropAxInNegClos, negDataSubPropAxInNegClos,
				new HashSet<OWLSubClassOfAxiom>(), new HashSet<OWLSubPropertyAxiom>(), 
				new HashSet<OWLObjectProperty>(), new HashSet<OWLObjectProperty>(),
				new HashMap<String, Set<OWLSubClassOfAxiom>>(), new HashMap<String, Set<OWLSubPropertyAxiom>>());
}
 
Example #7
Source File: OwlConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("static-method")
public ElkDisjointObjectPropertiesAxiom convert(
		OWLDisjointObjectPropertiesAxiom owlDisjointObjectPropertiesAxiom) {
	return new ElkDisjointObjectPropertiesAxiomWrap<OWLDisjointObjectPropertiesAxiom>(
			owlDisjointObjectPropertiesAxiom);
}
 
Example #8
Source File: OwlAxiomConverterVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public ElkAxiom visit(
		OWLDisjointObjectPropertiesAxiom owlDisjointObjectPropertiesAxiom) {
	return CONVERTER.convert(owlDisjointObjectPropertiesAxiom);
}
 
Example #9
Source File: OwlObjectPropertyAxiomConverterVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public ElkObjectPropertyAxiom visit(
		OWLDisjointObjectPropertiesAxiom owlDisjointObjectPropertiesAxiom) {
	return CONVERTER.convert(owlDisjointObjectPropertiesAxiom);
}
 
Example #10
Source File: FailingOwlAxiomVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(OWLDisjointObjectPropertiesAxiom axiom) {
	defaultVisit(axiom);
}
 
Example #11
Source File: AxiomAnnotationTools.java    From owltools with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public OWLAxiom visit(OWLDisjointObjectPropertiesAxiom axiom) {
	return factory.getOWLDisjointObjectPropertiesAxiom(axiom.getProperties(), annotations);
}
 
Example #12
Source File: CardinalityContraintsTools.java    From owltools with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void visit(OWLDisjointObjectPropertiesAxiom axiom) {
}
 
Example #13
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * negative object property inclusion axioms in the tbox
 */
public Set<OWLDisjointObjectPropertiesAxiom> getNegativeObjectSubPropertyAxioms() {
	return negObjectSubPropAxInTbox;
}
 
Example #14
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
protected  Set<OWLAxiom> computeNegativeInclusionClosure(Set<OWLSubClassOfAxiom> deltaNegIncAx,
		Set<OWLDisjointObjectPropertiesAxiom> deltaNegObjSubPropAx,Set<OWLDisjointDataPropertiesAxiom> deltaNegDataSubPropAx,
		Set<OWLSubClassOfAxiom> deltaPosIncAx, Set<OWLSubPropertyAxiom> deltaPosSubPropAx) {
	
	return computeNegativeInclusionClosure(deltaNegIncAx, deltaNegObjSubPropAx, deltaNegDataSubPropAx, deltaPosIncAx, deltaPosSubPropAx, null);
}
 
Example #15
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
private static void organizeTboxAxioms(Collection<OWLAxiom> normalizedAxioms, Collection<OWLSubClassOfAxiom> negIncAxInTbox,
		Collection<OWLDisjointObjectPropertiesAxiom> negObjectSubPropAxInTbox,Collection<OWLDisjointDataPropertiesAxiom> negDataSubPropAxInTbox,
		Collection<OWLSubClassOfAxiom> posIncAxInTbox, Collection<OWLSubPropertyAxiom> posSubPropAxInTbox,
		Collection<OWLObjectProperty> reflexivePropsInTbox, Collection<OWLObjectProperty> irreflexivePropsInTbox,
		 Map<String, Set<OWLSubClassOfAxiom>> iri2PosIncAxInTbox, Map<String, Set<OWLSubPropertyAxiom>> iri2PosSubPropAxInTbox) {
	// organize Tbox axioms per type
	for (OWLAxiom ax: normalizedAxioms ) {
		if (ax.getAxiomType().equals(AxiomType.SUBCLASS_OF)) {
			OWLSubClassOfAxiom subax = (OWLSubClassOfAxiom) ax;
			OWLClassExpression sub =  subax.getSubClass();
			OWLClassExpression superclass = subax.getSuperClass();
			if (!superclass.isAnonymous()
			|| superclass.getClassExpressionType().equals(ClassExpressionType.OBJECT_SOME_VALUES_FROM)
			|| superclass.getClassExpressionType().equals(ClassExpressionType.DATA_SOME_VALUES_FROM)) {
				posIncAxInTbox.add(subax);
				String key = getKey(superclass);
				Set<OWLSubClassOfAxiom> axs = iri2PosIncAxInTbox.get(key);
				if (axs==null) {
					axs = new HashSet<OWLSubClassOfAxiom>();
					iri2PosIncAxInTbox.put(key, axs);
				}
				axs.add(subax);
			} else {
				assert superclass.getClassExpressionType().equals(ClassExpressionType.OBJECT_ALL_VALUES_FROM)
				|| superclass.getClassExpressionType().equals(ClassExpressionType.DATA_ALL_VALUES_FROM)
				|| superclass.getClassExpressionType().equals(ClassExpressionType.OBJECT_COMPLEMENT_OF)
				: ax;
				negIncAxInTbox.add(subax);
			}
		} else if (ax.getAxiomType().equals(AxiomType.SUB_DATA_PROPERTY) 
				|| ax.getAxiomType().equals(AxiomType.SUB_OBJECT_PROPERTY)) {
			OWLSubPropertyAxiom subax = (OWLSubPropertyAxiom) ax;
			OWLPropertyExpression superprop = subax.getSuperProperty();
			posSubPropAxInTbox.add(subax);
			String key = getKey(superprop);
			Set<OWLSubPropertyAxiom> axs = iri2PosSubPropAxInTbox.get(key);
			if (axs==null) {
				axs = new HashSet<OWLSubPropertyAxiom>();
				iri2PosSubPropAxInTbox.put(key, axs);
			}
			axs.add(subax);				
		} else if (ax.getAxiomType().equals(AxiomType.DISJOINT_OBJECT_PROPERTIES)) {
			OWLDisjointObjectPropertiesAxiom dax = (OWLDisjointObjectPropertiesAxiom) ax;
			negObjectSubPropAxInTbox.add(dax);
		} else if (ax.getAxiomType().equals(AxiomType.DISJOINT_DATA_PROPERTIES)) {
			OWLDisjointDataPropertiesAxiom dax = (OWLDisjointDataPropertiesAxiom) ax;
			negDataSubPropAxInTbox.add(dax);
		} else if (ax.getAxiomType().equals(AxiomType.REFLEXIVE_OBJECT_PROPERTY)) {
			OWLReflexiveObjectPropertyAxiom rax = (OWLReflexiveObjectPropertyAxiom) ax;
			reflexivePropsInTbox.add(rax.getProperty().getNamedProperty());
		} else if (ax.getAxiomType().equals(AxiomType.IRREFLEXIVE_OBJECT_PROPERTY)) {
			OWLIrreflexiveObjectPropertyAxiom irrax = (OWLIrreflexiveObjectPropertyAxiom) ax;
			irreflexivePropsInTbox.add(irrax.getProperty().getNamedProperty());
		}
		else if (isAboxAxiom(ax)) {
			// abox assertions
			
		}  	else {
			assert false : "Unknown Normalized Axiom Type: " + ax;
		}
	}
}
 
Example #16
Source File: NormalizedOWLQLTbox.java    From quetzal with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isSubClass(OWLClassExpression sub, OWLClassExpression sup) {
	// if sup is equivalent to Top return true
	if (sup.isOWLThing()) {
		return true;
	}
	if (sup.getClassExpressionType().equals(ClassExpressionType.OBJECT_COMPLEMENT_OF)
	&& 
	(
		((OWLObjectComplementOf) sup).getOperand().isOWLNothing()
		|| getUnsatisfiableNamedClasses().contains(((OWLObjectComplementOf) sup).getOperand()) 
	)  ) {
		return true;
	}
	//
	
	// if sub is equivalent to Bottom return true
	if (sub.isOWLNothing() || getUnsatisfiableNamedClasses().contains(sub)) {
		return true;
	}
	if (sub.getClassExpressionType().equals(ClassExpressionType.OBJECT_COMPLEMENT_OF)
	&& ((OWLObjectComplementOf) sub).getOperand().isOWLThing()) {
		return true;
	}
	if ( (sub.getClassExpressionType().equals(ClassExpressionType.OBJECT_SOME_VALUES_FROM)
	|| sub.getClassExpressionType().equals(ClassExpressionType.DATA_SOME_VALUES_FROM))
		&&
	(((OWLQuantifiedRestriction) sub).getProperty().isOWLBottomObjectProperty()
		||((OWLQuantifiedRestriction) sub).getProperty().isOWLBottomDataProperty()
		|| getUnsatisfiableProperties().contains(((OWLQuantifiedRestriction) sub).getProperty()))) {
		return true;
	}
	//

	// check that tbox union {subclass(NC, sub), sublcass(NC, not(sup)), NC(Nind)}
	// is inconsistent. NC: new concept, Nind: new individual
	
	List<OWLAxiom> newAxioms = new LinkedList<OWLAxiom>();
	NormalizedOWLQLTbox ret = this;//copy();
	OWLClass newConcept = ret.getNormalizer().createNewNamedClass();
	newAxioms.add(fac.getOWLSubClassOfAxiom(newConcept, sub.getNNF()));
	newAxioms.add(fac.getOWLSubClassOfAxiom(newConcept, sup.getComplementNNF()));
	List<OWLAxiom> newNonOWLQLAxioms = new LinkedList<OWLAxiom>();
	
	Set<OWLAxiom> normalizedAxioms = ret.getNormalizer().toQLNormalForm(newAxioms, newNonOWLQLAxioms);
	if (!newNonOWLQLAxioms.isEmpty()) {
		throw new RuntimeException("Both concepts  must be OWL QL valid concepts");
	}
	List<OWLSubClassOfAxiom> deltaNegIncAx = new LinkedList<OWLSubClassOfAxiom>();
	List<OWLDisjointObjectPropertiesAxiom> deltaNegObjSubPropAx = new LinkedList<OWLDisjointObjectPropertiesAxiom>();
	List<OWLDisjointDataPropertiesAxiom> deltaNegDataSubPropAx = new LinkedList<OWLDisjointDataPropertiesAxiom>();
	List<OWLSubClassOfAxiom> deltaPosIncAx = new LinkedList<OWLSubClassOfAxiom>();
	List<OWLSubPropertyAxiom> deltaPosSubPropAx = new LinkedList<OWLSubPropertyAxiom>();
	organizeTboxAxioms(normalizedAxioms, deltaNegIncAx, deltaNegObjSubPropAx, deltaNegDataSubPropAx,deltaPosIncAx, deltaPosSubPropAx,
			new HashSet<OWLObjectProperty>(), new HashSet<OWLObjectProperty>(),
			new HashMap<String, Set<OWLSubClassOfAxiom>>(), new HashMap<String, Set<OWLSubPropertyAxiom>>());
	// inconsistent iff subclass(NC, not(NC)) is in the negative closure 
	OWLAxiom inconsistencyWitness = fac.getOWLSubClassOfAxiom(newConcept, newConcept.getComplementNNF());
	Set<OWLAxiom> newNegClos = ret.computeNegativeInclusionClosure(deltaNegIncAx, deltaNegObjSubPropAx, deltaNegDataSubPropAx, 
			deltaPosIncAx, deltaPosSubPropAx, inconsistencyWitness);
	//assert newNegClos == null || !newNegClos.contains(inconsistencyWitness) : newNegClos;
	// 
	
	return newNegClos == null;
	
}