org.semanticweb.owlapi.model.OWLObjectAllValuesFrom Java Examples

The following examples show how to use org.semanticweb.owlapi.model.OWLObjectAllValuesFrom. 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: TBoxUnFoldingTool.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public OWLObjectAllValuesFrom visit(OWLObjectAllValuesFrom ce) {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Unfolding all_values_from: "+ce);
	}
	
	OWLClassExpression filler = ce.getFiller();
	if (filler != null) {
		OWLClassExpression unfold = filler.accept(this);
		if (unfold != null) {
			return factory.getOWLObjectAllValuesFrom(ce.getProperty(), unfold);
		}
	}
	return null;
}
 
Example #2
Source File: GraphOwlVisitor.java    From SciGraph with Apache License 2.0 5 votes vote down vote up
@Override
public Void visit(OWLObjectAllValuesFrom desc) {
  long restriction =
      getOrCreateNode(getIri(desc), OwlLabels.OWL_ALL_VALUES_FROM, OwlLabels.OWL_ANONYMOUS);
  if (!desc.getProperty().isAnonymous()) {
    long property = getOrCreateNode(getIri(desc.getProperty()));
    getOrCreateRelationship(restriction, property, OwlRelationships.PROPERTY);
    long cls = getOrCreateNode(getIri(desc.getFiller()));
    getOrCreateRelationship(restriction, cls, OwlRelationships.FILLER);
  }
  return null;
}
 
Example #3
Source File: AbstractElkObjectConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public OWLObjectAllValuesFrom visit(ElkObjectAllValuesFrom expression) {
	return owlFactory_.getOWLObjectAllValuesFrom(
			convert(expression.getProperty()),
			convert(expression.getFiller()));
}
 
Example #4
Source File: OwlClassExpressionConverterVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public ElkObjectAllValuesFrom visit(
		OWLObjectAllValuesFrom owlObjectAllValuesFrom) {
	return CONVERTER.convert(owlObjectAllValuesFrom);
}
 
Example #5
Source File: OwlConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("static-method")
public ElkObjectAllValuesFrom convert(
		OWLObjectAllValuesFrom owlObjectAllValuesFrom) {
	return new ElkObjectAllValuesFromWrap<OWLObjectAllValuesFrom>(
			owlObjectAllValuesFrom);
}
 
Example #6
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 #7
Source File: DescriptionTreeSimilarity.java    From owltools with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * makes a reduced union expression.
 * 
 * Uses the following two reduction rules:
 * 
 * (r1 some X) U (r2 some Y) ==> lcs(r1,r2) some MakeUnionOf(X,Y)
 * (r1 some X) U X ==> reflexive-version-of-r1 some X
 * 
 * TODO: test for (r some r some X) u (r some X) cases. needs to be done over final expression.
 *  
 * if a reduced form cannot be made, returns null
 * 
 * @param xa
 * @param xb
 * @return class expression
 */
private OWLClassExpression makeUnionUsingReflexiveProperty(OWLClassExpression xa, OWLClassExpression xb) {
	LOG.info("testing if there is a more compact union expression for "+xa+" ++ "+xb);
	OWLDataFactory df = graph.getDataFactory();
	if (xa instanceof OWLQuantifiedRestriction) {
		// TODO - check before casting
		OWLObjectProperty prop = (OWLObjectProperty) ((OWLQuantifiedRestriction) xa).getProperty();
		OWLClassExpression xaRest = (OWLClassExpression) ((OWLQuantifiedRestriction)xa).getFiller();
		if (xb instanceof OWLQuantifiedRestriction) {
			OWLObjectPropertyExpression p2 =
				propertySubsumer(prop, 
					((OWLQuantifiedObjectRestriction) xb).getProperty());
			
			if (p2 != null) {
				OWLClassExpression xbRest = (OWLClassExpression) ((OWLQuantifiedRestriction)xb).getFiller();
				OWLClassExpression x = makeUnionWithReduction(xaRest,xbRest);
				// todo - mixing some and all
				if (xa instanceof OWLObjectSomeValuesFrom)
					return df.getOWLObjectSomeValuesFrom(p2,x);
				else if (xa instanceof OWLObjectAllValuesFrom)
					return df.getOWLObjectAllValuesFrom(p2, x);
			}
		}
		LOG.info("  test: "+xaRest+" == "+xb);
		

		if (xaRest.equals(xb)) {
			LOG.info("     TRUE: "+xaRest+" == "+xb);

			OWLObjectProperty rprop = null;
			if (graph.getIsReflexive(prop)) {
				rprop = prop;
			}
			if (forceReflexivePropertyCreation) {
				OWLOntologyManager manager = graph.getManager();
				OWLOntology ont = graph.getSourceOntology();
				rprop = 
					df.getOWLObjectProperty(IRI.create(prop.getIRI().toString()+"_reflexive"));
				manager.applyChange(new AddAxiom(ont, df.getOWLSubObjectPropertyOfAxiom(prop, rprop)));
				manager.applyChange(new AddAxiom(ont, df.getOWLTransitiveObjectPropertyAxiom(rprop)));
				LOG.info("  reflexive prop:"+rprop);

			}
			if (rprop != null) {
				if (xa instanceof OWLObjectSomeValuesFrom)
					return df.getOWLObjectSomeValuesFrom(rprop,xb);
				else if (xa instanceof OWLObjectAllValuesFrom)
					return df.getOWLObjectAllValuesFrom(rprop, xb);
			}

		}
	}
	return null;
}
 
Example #8
Source File: CardinalityContraintsTools.java    From owltools with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public HandlerResult visit(OWLObjectAllValuesFrom ce) {
	return ce.getFiller().accept(this);
}
 
Example #9
Source File: RestrictionVisitor.java    From BioSolr with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(@NotNull OWLObjectAllValuesFrom values) {
	allValues.add(values);
}
 
Example #10
Source File: RestrictionVisitor.java    From BioSolr with Apache License 2.0 4 votes vote down vote up
/**
 * @return the allValues
 */
public Set<OWLObjectAllValuesFrom> getAllValues() {
	return allValues;
}