Java Code Examples for org.semanticweb.owlapi.model.OWLEntity#isOWLObjectProperty()

The following examples show how to use org.semanticweb.owlapi.model.OWLEntity#isOWLObjectProperty() . 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: QuotedEntityChecker.java    From robot with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Given an entity, return the right map for it.
 *
 * @param entity the entity to find a map for
 * @return the right map for the entity, or null
 */
private Map<String, IRI> pickMap(OWLEntity entity) {
  Map<String, IRI> map = null;
  if (entity.isOWLAnnotationProperty()) {
    map = annotationProperties;
  } else if (entity.isOWLObjectProperty()) {
    map = objectProperties;
  } else if (entity.isOWLDataProperty()) {
    map = dataProperties;
  } else if (entity.isOWLDatatype()) {
    map = datatypes;
  } else if (entity.isOWLClass()) {
    map = classes;
  } else if (entity.isOWLNamedIndividual()) {
    map = namedIndividuals;
  }
  return map;
}
 
Example 2
Source File: PredicateVariableExtractor.java    From neo4j-sparql-extension with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Extracts {@link PredicateVariableExtractor} rules.
 * 
 * @param ot ontology
 * @return extracted rules
 */
@Override
public List<Rule> extract(OWLOntology ot) {
	List<Rule> list = new ArrayList<>();
	// list of predicates in ontology
	List<String> ps = new ArrayList<>();
	ps.add(TOPOBJ);
	ps.add(TOPDATA);
	OWLEntity e;
	String op;
	// check all declarations
	for (OWLDeclarationAxiom a : ot.getAxioms(AxiomType.DECLARATION)) {
		e = a.getEntity();
		if (e.isOWLObjectProperty()) {
			// if it is a object property declaration, add it to the list
			// and also add it as subproperty of owl:topObjectProperty
			op = getString(e.asOWLObjectProperty());
			ps.add(op);
			list.add(new SubPropertyOf(op, TOPOBJ));
		} else if (e.isOWLDataProperty()) {
			// if it is a data property declaration, add it to the list
			// and also add it as subproperty of owl:topDataProperty
			op = getString(e.asOWLDataProperty());
			ps.add(op);
			list.add(new SubPropertyOf(op, TOPDATA));
		}
	}
	list.add(new PredicateVariable(ps));
	return list;
}