public OWLClass getOWLClass(String curi, PrefixManager prefixManager) { return getOWLClass(prefixManager.getIRI(curi)); }
@Override public OWLClass getOWLClass(String abbreviatedIRI, @Nonnull PrefixManager prefixManager) { checkNotNull(abbreviatedIRI, "iri cannot be null"); checkNotNull(prefixManager, "prefixManager cannot be null"); return getOWLClass(prefixManager.getIRI(abbreviatedIRI)); }
@Override public OWLClass getOWLClass(String iri, PrefixManager prefixManager) { checkNull(iri, IRI2); checkNull(prefixManager, PREFIX_MANAGER); return getOWLClass(prefixManager.getIRI(iri)); }
/** * Gets an entity that has the specified IRI and is of the specified type. * * @param entityType The type of the entity that will be returned * @param iri The IRI of the entity that will be returned * @return An entity that has the same IRI as this entity and is of the specified type */ public <E extends OWLEntity> E getOWLEntity(EntityType<E> entityType, IRI iri) { if (entityType.equals(EntityType.CLASS)) { return (E) getOWLClass(iri); } else if (entityType.equals(EntityType.OBJECT_PROPERTY)) { return (E) getOWLObjectProperty(iri); } else if (entityType.equals(EntityType.DATA_PROPERTY)) { return (E) getOWLDataProperty(iri); } else if (entityType.equals(EntityType.ANNOTATION_PROPERTY)) { return (E) getOWLAnnotationProperty(iri); } else if (entityType.equals(EntityType.NAMED_INDIVIDUAL)) { return (E) getOWLNamedIndividual(iri); } else if (entityType.equals(EntityType.DATATYPE)) { return (E) getOWLDatatype(iri); } else { throw new OWLRuntimeException("Unknown entity type: " + entityType); } }
@Nonnull @Override @SuppressWarnings("unchecked") public <E extends OWLEntity> E getOWLEntity( @Nonnull EntityType<E> entityType, IRI iri) { checkNotNull(entityType, "entityType cannot be null"); checkNotNull(iri, "iri cannot be null"); E ret = null; if (entityType.equals(EntityType.CLASS)) { ret = (E) getOWLClass(iri); } else if (entityType.equals(EntityType.OBJECT_PROPERTY)) { ret = (E) getOWLObjectProperty(iri); } else if (entityType.equals(EntityType.DATA_PROPERTY)) { ret = (E) getOWLDataProperty(iri); } else if (entityType.equals(EntityType.ANNOTATION_PROPERTY)) { ret = (E) getOWLAnnotationProperty(iri); } else if (entityType.equals(EntityType.NAMED_INDIVIDUAL)) { ret = (E) getOWLNamedIndividual(iri); } else if (entityType.equals(EntityType.DATATYPE)) { ret = (E) getOWLDatatype(iri); } if (ret != null) { return ret; } throw new OWLRuntimeException("Entity type not recognized: " + entityType + " for iri " + iri); }
@Override @SuppressWarnings("unchecked") public <E extends OWLEntity> E getOWLEntity(EntityType<E> entityType, IRI iri) { checkNull(entityType, "entityType"); checkNull(iri, IRI2); E ret = null; if (entityType.equals(EntityType.CLASS)) { ret = (E) getOWLClass(iri); } else if (entityType.equals(EntityType.OBJECT_PROPERTY)) { ret = (E) getOWLObjectProperty(iri); } else if (entityType.equals(EntityType.DATA_PROPERTY)) { ret = (E) getOWLDataProperty(iri); } else if (entityType.equals(EntityType.ANNOTATION_PROPERTY)) { ret = (E) getOWLAnnotationProperty(iri); } else if (entityType.equals(EntityType.NAMED_INDIVIDUAL)) { ret = (E) getOWLNamedIndividual(iri); } else if (entityType.equals(EntityType.DATATYPE)) { ret = (E) getOWLDatatype(iri); } return ret; }
OWLClass cls = df.getOWLClass(IRI.create("http://dbpedia.org/ontology/SoccerPlayer")); OWLAxiom pattern = df.getOWLSubClassOfAxiom(df.getOWLClass("A", pm), df.getOWLObjectAllValuesFrom(df.getOWLObjectProperty("p", pm), df.getOWLClass("B", pm)));
public static void main(String[] args) throws Exception { StringRenderer.setRenderer(Rendering.MANCHESTER_SYNTAX); OWLDataFactoryImpl df = new OWLDataFactoryImpl(); PrefixManager pm = new DefaultPrefixManager(); pm.setDefaultPrefix(":"); OWLClass A = df.getOWLClass("A", pm ); OWLDataProperty s = df.getOWLDataProperty("s", pm); OWLDataProperty t = df.getOWLDataProperty("t", pm); OWLDatatypeRestriction dr1 = df.getOWLDatatypeMinMaxInclusiveRestriction(1.0, 2.0); OWLDatatypeRestriction dr2 = df.getOWLDatatypeMinMaxInclusiveRestriction(15, 100); OWLClassExpression ce = df.getOWLObjectIntersectionOf(A, df.getOWLDataSomeValuesFrom(s, dr1), df.getOWLDataSomeValuesFrom(t, dr2) ); Set<OWLClassExpression> expressions = ce.accept(new ClassExpressionLiteralCombination()); for (OWLClassExpression expr : expressions) { System.out.println(expr); } }