org.semanticweb.owlapi.model.OWLObjectExactCardinality Java Examples

The following examples show how to use org.semanticweb.owlapi.model.OWLObjectExactCardinality. 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: CardinalityContraintsTools.java    From owltools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public HandlerResult visit(OWLObjectExactCardinality ce) {
	if (ce.getCardinality() == 0) {
		// remove the ce if the max cardinality is zero
		return HandlerResult.remove();
	}
	final OWLClassExpression filler = ce.getFiller();
	final HandlerResult recursive = filler.accept(this);
	OWLObjectSomeValuesFrom newCE;
	if (recursive == null) {
		newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), filler);
	}
	else if (recursive.remove) {
		return HandlerResult.remove();
	}
	else {
		newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), recursive.modified);
	}
	return HandlerResult.modified(newCE);
}
 
Example #2
Source File: OwlConverter.java    From elk-reasoner with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("static-method")
public ElkObjectExactCardinality convert(
		OWLObjectExactCardinality owlObjectExactCardinality) {
	if (owlObjectExactCardinality.isQualified())
		return new ElkObjectExactCardinalityQualifiedWrap<OWLObjectExactCardinality>(
				owlObjectExactCardinality);
	// else
	return new ElkObjectExactCardinalityUnqualifiedWrap<OWLObjectExactCardinality>(
			owlObjectExactCardinality);
}
 
Example #3
Source File: TBoxUnFoldingTool.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public OWLObjectExactCardinality visit(OWLObjectExactCardinality ce) {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Unfolding exact_cardinality: "+ce);
	}
	
	OWLClassExpression filler = ce.getFiller();
	if (filler != null) {
		OWLClassExpression unfold = filler.accept(this);
		if (unfold != null) {
			return factory.getOWLObjectExactCardinality(ce.getCardinality(), ce.getProperty(), unfold);
		}
	}
	return null;
}
 
Example #4
Source File: AbstractElkObjectConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public OWLObjectExactCardinality visit(
		ElkObjectExactCardinalityQualified expression) {
	return owlFactory_.getOWLObjectExactCardinality(
			expression.getCardinality(), convert(expression.getProperty()));
}
 
Example #5
Source File: AbstractElkObjectConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public OWLObjectExactCardinality visit(
		ElkObjectExactCardinalityUnqualified expression) {
	return owlFactory_.getOWLObjectExactCardinality(
			expression.getCardinality(), convert(expression.getProperty()));
}
 
Example #6
Source File: OwlClassExpressionConverterVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public ElkObjectExactCardinality visit(
		OWLObjectExactCardinality owlObjectExactCardinality) {
	return CONVERTER.convert(owlObjectExactCardinality);
}
 
Example #7
Source File: ManchesterOWLSyntaxObjectHTMLRenderer.java    From robot with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Given an OWLClassExpression, determine the particular type of OWLClassExpression that it is,
 * and then call the appropriate visit() function for it.
 */
public void visit(OWLClassExpression ce) throws ClassNotFoundException {
  if (ce instanceof OWLClass) {
    visit((OWLClass) ce);
  } else if (ce instanceof OWLObjectSomeValuesFrom) {
    visit((OWLObjectSomeValuesFrom) ce);
  } else if (ce instanceof OWLObjectAllValuesFrom) {
    visit((OWLObjectAllValuesFrom) ce);
  } else if (ce instanceof OWLObjectMinCardinality) {
    visit((OWLObjectMinCardinality) ce);
  } else if (ce instanceof OWLObjectMaxCardinality) {
    visit((OWLObjectMaxCardinality) ce);
  } else if (ce instanceof OWLObjectExactCardinality) {
    visit((OWLObjectExactCardinality) ce);
  } else if (ce instanceof OWLObjectHasValue) {
    visit((OWLObjectHasValue) ce);
  } else if (ce instanceof OWLObjectHasSelf) {
    visit((OWLObjectHasSelf) ce);
  } else if (ce instanceof OWLDataSomeValuesFrom) {
    visit((OWLDataSomeValuesFrom) ce);
  } else if (ce instanceof OWLDataAllValuesFrom) {
    visit((OWLDataAllValuesFrom) ce);
  } else if (ce instanceof OWLDataMinCardinality) {
    visit((OWLDataMinCardinality) ce);
  } else if (ce instanceof OWLDataMaxCardinality) {
    visit((OWLDataMaxCardinality) ce);
  } else if (ce instanceof OWLDataExactCardinality) {
    visit((OWLDataExactCardinality) ce);
  } else if (ce instanceof OWLDataHasValue) {
    visit((OWLDataHasValue) ce);
  } else if (ce instanceof OWLObjectIntersectionOf) {
    visit((OWLObjectIntersectionOf) ce);
  } else if (ce instanceof OWLObjectUnionOf) {
    visit((OWLObjectUnionOf) ce);
  } else if (ce instanceof OWLObjectComplementOf) {
    visit((OWLObjectComplementOf) ce);
  } else if (ce instanceof OWLObjectOneOf) {
    visit((OWLObjectOneOf) ce);
  } else {
    logger.error(
        "Could not visit class expression: {} of type: {}",
        ce.toString(),
        ce.getClass().toString());
  }
}
 
Example #8
Source File: GraphOwlVisitor.java    From SciGraph with Apache License 2.0 4 votes vote down vote up
@Override
public Void visit(OWLObjectExactCardinality desc) {
  long restriction = addCardinalityRestriction(desc);
  graph.addLabel(restriction, OwlLabels.OWL_QUALIFIED_CARDINALITY);
  return null;
}