org.semanticweb.owlapi.model.OWLDisjointClassesAxiom Java Examples

The following examples show how to use org.semanticweb.owlapi.model.OWLDisjointClassesAxiom. 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: OwlClassAxiomVisitor.java    From OWL2VOWL with MIT License 6 votes vote down vote up
@Override
public void visit(OWLDisjointClassesAxiom axiom) {
	// tested for memory release[x]
	Collection<OWLDisjointClassesAxiom> odca= axiom.asPairwiseAxioms();
	for (OWLDisjointClassesAxiom pairwiseAxiom : odca) {
		IRI[] domainRange = new IRI[2];
		int index = 0;
		
		for (OWLClassExpression aClassEX : pairwiseAxiom.classExpressions().collect(Collectors.toSet())){
			OWLClass cls=aClassEX.asOWLClass();
			domainRange[index++] = cls.getIRI();
		}
		if (!vowlData.getSearcher().containsDisjoint(domainRange[0], domainRange[1])) {
			vowlData.getGenerator().generateDisjointProperty(domainRange[0], domainRange[1]);
		}
		domainRange=null;
	}
}
 
Example #2
Source File: AbstractOwlAxiomConverterVisitor.java    From elk-reasoner with Apache License 2.0 5 votes vote down vote up
@Override
public T visit(OWLDisjointClassesAxiom axiom) {
	throw new IllegalArgumentException(
			OWLDisjointClassesAxiom.class.getSimpleName()
					+ " cannot be converted to "
					+ getTargetClass().getSimpleName());
}
 
Example #3
Source File: Mooncat.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * For every pair X DisjointWith Y, generate an axiom
 * A and Y = Nothing
 * 
 * (may become deprecated after Elk supports disjoints)
 * 
 * @param ont
 * @param manager
 * @param dataFactory
 */
public static void translateDisjointsToEquivalents(OWLOntology ont, OWLOntologyManager manager, OWLDataFactory dataFactory) {
	for (OWLDisjointClassesAxiom dca : ont.getAxioms(AxiomType.DISJOINT_CLASSES, Imports.INCLUDED)) {
		for (OWLClassExpression ce1 : dca.getClassExpressions()) {
			for (OWLClassExpression ce2 : dca.getClassExpressions()) {
				if (ce1.compareTo(ce2) <= 0)
					continue;
				OWLEquivalentClassesAxiom eca = dataFactory.getOWLEquivalentClassesAxiom(dataFactory.getOWLNothing(),
						dataFactory.getOWLObjectIntersectionOf(ce1, ce2));
				manager.addAxiom(ont, eca);
				// TODO - remove if requested
			}
		}
	}
}
 
Example #4
Source File: GraphOwlVisitor.java    From SciGraph with Apache License 2.0 5 votes vote down vote up
@Override
public Void visit(OWLDisjointClassesAxiom axiom) {
  List<Long> nodes =
      transform(axiom.getClassExpressionsAsList(), new Function<OWLClassExpression, Long>() {

        @Override
        public Long apply(OWLClassExpression individual) {
          return getOrCreateNode(getIri(individual));
        }
      });

  getOrCreateRelationshipPairwise(nodes, OwlRelationships.OWL_DISJOINT_WITH);
  return null;
}
 
Example #5
Source File: ReasonerUtilTest.java    From SciGraph with Apache License 2.0 5 votes vote down vote up
@Test
public void doesNotReason_whenOntologyIsInconsistent() throws Exception{
  OWLClass c0 = dataFactory.getOWLClass(IRI.generateDocumentIRI());
  OWLClass c1 = dataFactory.getOWLClass(IRI.generateDocumentIRI());
  OWLDisjointClassesAxiom disjoint = dataFactory.getOWLDisjointClassesAxiom(c0, c1);
  OWLIndividual i1 = dataFactory.getOWLNamedIndividual(IRI.generateDocumentIRI());
  OWLClassAssertionAxiom a1 = dataFactory.getOWLClassAssertionAxiom(c0, i1);
  OWLClassAssertionAxiom a2 = dataFactory.getOWLClassAssertionAxiom(c1, i1);
  manager.addAxioms(ont, newHashSet(disjoint, a1, a2));
  util.flush();
  assertThat(util.shouldReason(), is(false));
}
 
Example #6
Source File: AbstractElkObjectConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public OWLDisjointClassesAxiom visit(ElkDisjointClassesAxiom axiom) {
	return owlFactory_.getOWLDisjointClassesAxiom(
			toClassExpressionSet(axiom.getClassExpressions()));
}
 
Example #7
Source File: OwlClassAxiomConverterVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public ElkClassAxiom visit(OWLDisjointClassesAxiom owlDisjointClasses) {
	return CONVERTER.convert(owlDisjointClasses);
}
 
Example #8
Source File: OwlConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("static-method")
public ElkDisjointClassesAxiom convert(
		OWLDisjointClassesAxiom owlDisjointClassesAxiom) {
	return new ElkDisjointClassesAxiomWrap<OWLDisjointClassesAxiom>(
			owlDisjointClassesAxiom);
}
 
Example #9
Source File: OwlAxiomConverterVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public ElkAxiom visit(OWLDisjointClassesAxiom owlDisjointClasses) {
	return CONVERTER.convert(owlDisjointClasses);
}
 
Example #10
Source File: FailingOwlAxiomVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(OWLDisjointClassesAxiom 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(OWLDisjointClassesAxiom axiom) {
	return factory.getOWLDisjointClassesAxiom(axiom.getClassExpressions(), 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(OWLDisjointClassesAxiom axiom) {
}