Refine search
public void visit(OWLDataProperty prop) { if ( prop.isOWLTopDataProperty() ) { term = ATermUtils.TOP_DATA_PROPERTY; } else if (prop.isOWLBottomDataProperty() ) { term = ATermUtils.BOTTOM_DATA_PROPERTY; } else { term = ATermUtils.makeTermAppl( prop.getIRI().toString() ); if( addAxioms ) { kb.addDatatypeProperty( term ); } } }
@Nonnull public Node<OWLDataProperty> getEquivalentDataProperties(@Nonnull OWLDataProperty pe) throws InconsistentOntologyException, ReasonerInterruptedException, TimeOutException { if (pe.isAnonymous()) { return new OWLDataPropertyNode(); } else { return new OWLDataPropertyNode(pe.asOWLDataProperty()); } }
protected void reservedForDataProperty(OWLDataProperty property) { if (!property.isOWLTopDataProperty() && !property.isOWLBottomDataProperty() && property.getIRI().isReservedVocabulary()) { violations.add(new UseOfReservedVocabularyForDataPropertyIRI(getCurrentOntology(), getCurrentAxiom(), property)); } }
inds.addAll(ont.getIndividualsInSignature()); OWLNamedIndividual pun = ind.asOWLNamedIndividual(); for (OWLOntology ont : onts) { for (OWLDataPropertyAssertionAxiom ax : ont.getDataPropertyAssertionAxioms(pun)) { if (!ax.getProperty().isAnonymous()) { changes.add(new RemoveAxiom(ont, ax)); OWLAnnotationProperty aProp = df.getOWLAnnotationProperty(ax.getProperty().asOWLDataProperty().getIRI()); OWLAnnotation anno = df.getOWLAnnotation(aProp, ax.getObject()); OWLAnnotationAssertionAxiom annoAx = df.getOWLAnnotationAssertionAxiom(pun.getIRI(), anno); changes.add(new AddAxiom(ont, annoAx)); props.add((OWLDataProperty) ax.getProperty()); for (OWLAxiom ax : ont.getDeclarationAxioms(pun)) { changes.add(new RemoveAxiom(ont, ax));
private ImmutableMap<IRI, PredicateType> extractPredicates(OWLOntology ontology) { ImmutableMap.Builder<IRI, PredicateType> predicateMapBuilder = ImmutableMap.builder(); for (OWLClass owlClass : ontology.getClassesInSignature()) { predicateMapBuilder.put(owlClass.getIRI(), PredicateType.CLASS); } for (OWLDataProperty owlDataProperty : ontology.getDataPropertiesInSignature()) { predicateMapBuilder.put(owlDataProperty.getIRI(), PredicateType.DATA_PROPERTY); } for(OWLObjectProperty owlObjectProperty: ontology.getObjectPropertiesInSignature()){ predicateMapBuilder.put(owlObjectProperty.getIRI(), PredicateType.OBJECT_PROPERTY); } for (OWLAnnotationProperty owlAnnotationProperty : ontology.getAnnotationPropertiesInSignature()) { predicateMapBuilder.put(owlAnnotationProperty.getIRI(), PredicateType.ANNOTATION_PROPERTY); } return predicateMapBuilder.build(); }
protected boolean isSubDataPropertyOf(OWLDataProperty subDataProperty,OWLDataProperty superDataProperty) { checkPreConditions(subDataProperty,superDataProperty); if (!m_isConsistent.booleanValue() || subDataProperty.isOWLBottomDataProperty() || superDataProperty.isOWLTopDataProperty()) return true; AtomicRole subrole=H(subDataProperty); AtomicRole superrole=H(superDataProperty); if (m_dataRoleHierarchy!=null && !containsFreshEntities(subDataProperty,superDataProperty)) { HierarchyNode<AtomicRole> subroleNode=m_dataRoleHierarchy.getNodeForElement(subrole); return subroleNode.isEquivalentElement(superrole) || subroleNode.isAncestorElement(superrole); } else { OWLDataFactory factory=getDataFactory(); OWLIndividual individual=factory.getOWLAnonymousIndividual("fresh-individual"); OWLLiteral freshConstant=factory.getOWLLiteral("internal:fresh-constant",factory.getOWLDatatype(IRI.create("internal:anonymous-constants"))); OWLDataProperty negatedSuperDataProperty=factory.getOWLDataProperty(IRI.create("internal:negated-superproperty")); OWLAxiom subpropertyAssertion=factory.getOWLDataPropertyAssertionAxiom(subDataProperty,individual,freshConstant); OWLAxiom negatedSuperpropertyAssertion=factory.getOWLDataPropertyAssertionAxiom(negatedSuperDataProperty,individual,freshConstant); OWLAxiom superpropertyAxiomatization=factory.getOWLDisjointDataPropertiesAxiom(superDataProperty,negatedSuperDataProperty); Tableau tableau=getTableau(subpropertyAssertion,negatedSuperpropertyAssertion,superpropertyAxiomatization); boolean result=tableau.isSatisfiable(true,null,null,null,null,null,ReasoningTaskDescription.isRoleSubsumedBy(subrole,superrole,false)); tableau.clearAdditionalDLOntology(); return !result; } } @Override
private void initialiseDataPropertyFrameSections() { //@formatter:off initialiseSection(new AnnAxiom<OWLDataProperty, OWLDataPropertyExpression>(x -> parseDataProperty(), SUB_PROPERTY_OF, (s, o, anns) -> df.getOWLSubDataPropertyOfAxiom(s, o, anns)), dataPropertyFrameSections); initialiseSection(new AnnAxiom<OWLDataProperty, OWLDataPropertyExpression>(x -> parseDataProperty(), EQUIVALENT_TO, (s, o, anns) -> df.getOWLEquivalentDataPropertiesAxiom(s,o, anns)), dataPropertyFrameSections); initialiseSection(new AnnAxiom<OWLDataProperty, OWLDataPropertyExpression>(x -> parseDataProperty(), DISJOINT_WITH, (s, o, anns) -> df.getOWLDisjointDataPropertiesAxiom(s,o, anns)), dataPropertyFrameSections); initialiseSection(new AnnAxiom<OWLDataProperty, OWLClassExpression>(x -> parseUnion(), DOMAIN, (s, o, anns) -> df.getOWLDataPropertyDomainAxiom(s, o, anns)), dataPropertyFrameSections); initialiseSection(new AnnAxiom<OWLDataProperty, OWLDataRange>(x -> parseDataRange(), RANGE, (s, o, anns) -> df.getOWLDataPropertyRangeAxiom(s, o, anns)), dataPropertyFrameSections); initialiseSection(new AnnAxiom<OWLDataProperty, OWLDataPropertyCharacteristicAxiom>(this::parseDataPropertyCharacteristic, CHARACTERISTICS, (s, o, anns) -> o.getAnnotatedAxiom(anns)), dataPropertyFrameSections); initialiseSection(new AnnAxiom<OWLDataProperty, OWLAnnotation>(x -> parseAnnotation(), ANNOTATIONS, (s, o, anns) -> df.getOWLAnnotationAssertionAxiom(s.getIRI(), o, anns)), dataPropertyFrameSections); //@formatter:on }
individuals.addAll(ont.getIndividualsInSignature()); boolean punned = false; for (OWLOntology ont : ontologies) { if (ont.containsClassInSignature(ind.getIRI())) { punned = true; break; for (OWLDataPropertyAssertionAxiom ax : ont.getDataPropertyAssertionAxioms(ind)) { if (!ax.getProperty().isAnonymous()) { changes.add(new RemoveAxiom(ont, ax)); OWLDataFactory df = getDataFactory(); OWLAnnotation anno = df.getOWLAnnotation(df.getOWLAnnotationProperty(ax.getProperty().asOWLDataProperty().getIRI()), ax.getObject()); OWLAnnotationAssertionAxiom annoAx = df.getOWLAnnotationAssertionAxiom(ind.getIRI(), anno); changes.add(new AddAxiom(ont, annoAx)); convertedDataProperties.add((OWLDataProperty) ax.getProperty());
OWLNamedIndividual tom = factory.getOWLNamedIndividual( IRI.create( ns+"Tom" )); OWLObjectProperty likes = factory.getOWLObjectProperty( IRI.create( ns+"likes" )); OWLDataProperty age = factory.getOWLDataProperty( IRI.create( ns+"age" )); OWLNamedIndividual anna = factory.getOWLNamedIndividual( IRI.create( ns+"Anna" )); consumer.handle( tom.getIRI(), age.getIRI(), factory.getOWLLiteral( 35 ));
dlClauses.add(dlClause); if (axioms.m_dataPropertyInclusions.contains(factory.getOWLDataProperty(IRI.create(AtomicRole.BOTTOM_DATA_ROLE.getIRI())))) { Atom bodyAtom=Atom.create(AtomicRole.BOTTOM_DATA_ROLE,X,Y); dlClauses.add(DLClause.create(new Atom[] {},new Atom[] { bodyAtom })); Set<AtomicRole> atomicDataRoles=new HashSet<AtomicRole>(); for (OWLClass owlClass : axioms.m_classes) atomicConcepts.add(AtomicConcept.create(owlClass.getIRI().toString())); Set<Individual> individuals=new HashSet<Individual>(); for (OWLNamedIndividual owlIndividual : axioms.m_namedIndividuals) { Individual individual=Individual.create(owlIndividual.getIRI().toString()); individuals.add(individual); complexObjectRoles.add(getRole(objectPropertyExpression)); for (OWLDataProperty dataProperty : axioms.m_dataProperties) atomicDataRoles.add(AtomicRole.create(dataProperty.getIRI().toString()));
public void importsClosureChanged() { // NOTE: This method only gets called when the ontology being parsed adds a direct import. This is enough // for resolving the imports closure. // We cache IRIs of various entities here. // We also mop up any triples that weren't parsed and consumed in the imports closure. for (OWLOntology ont : owlOntologyManager.getImportsClosure(ontology)) { for (OWLAnnotationProperty prop : ont.getAnnotationPropertiesInSignature()) { annotationPropertyIRIs.add(prop.getIRI()); } for (OWLDataProperty prop : ont.getDataPropertiesInSignature()) { dataPropertyExpressionIRIs.add(prop.getIRI()); } for (OWLObjectProperty prop : ont.getObjectPropertiesInSignature()) { objectPropertyExpressionIRIs.add(prop.getIRI()); } for (OWLClass cls : ont.getClassesInSignature()) { classExpressionIRIs.add(cls.getIRI()); } for (OWLDatatype datatype : ont.getDatatypesInSignature()) { dataRangeIRIs.add(datatype.getIRI()); } for (OWLNamedIndividual ind : ont.getIndividualsInSignature()) { individualIRIs.add(ind.getIRI()); } } }
public ExistInverseDataPropertyAnnotatedPredicate( OWLDataProperty prop, OWLDataFactory fac) { super(fac.getOWLObjectSomeValuesFrom( fac.getOWLObjectProperty(prop.getIRI()).getInverseProperty().getSimplified(), fac.getOWLThing())); this.prop = prop; this.fac = fac; }
OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.createOntology(IRI .create("http://www.semanticweb.org/owlapi/ontologies/ontology")); OWLDeclarationAxiom declarationAxiom = factory.getOWLDeclarationAxiom(data); manager.addAxiom(ontology, declarationAxiom); return jenamodel.getDatatypeProperty(data.getIRI().toString()); } catch (OWLOntologyCreationException eoc) { System.err.print("DataPropOwlToJena::: ");
private void resetAllowedLabels() { Set<String> uriStrings = new HashSet<>(); for (OWLOntology ont : getActiveOntologies()){ for (OWLAnnotationProperty p : ont.getAnnotationPropertiesInSignature()){ uriStrings.add(p.getIRI().toString()); } } getProperties().setAllowedValues(ServerProperty.optionLabelUri, new ArrayList<>(uriStrings)); Set<String> dataPropStrings = new HashSet<>(); for (OWLOntology ont : getActiveOntologies()){ for (OWLDataProperty p : ont.getDataPropertiesInSignature()){ dataPropStrings.add(p.getIRI().toString()); } } getProperties().setAllowedValues(ServerProperty.optionLabelPropertyUri, new ArrayList<>(dataPropStrings)); }
/** * Imports closure changed. */ protected final void importsClosureChanged() { // NOTE: This method only gets called when the ontology being parsed // adds a direct import. This is enough // for resolving the imports closure. // We cache IRIs of various entities here. // We also mop up any triples that weren't parsed and consumed in the // imports closure. ontology.annotationPropertiesInSignature(INCLUDED) .forEach(e -> annPropertyIRIs.add(e.getIRI())); ontology.dataPropertiesInSignature(INCLUDED).forEach(e -> dataPropertyIRIs.add(e.getIRI())); ontology.objectPropertiesInSignature(INCLUDED) .forEach(e -> objectPropertyIRIs.add(e.getIRI())); ontology.classesInSignature(INCLUDED).forEach(e -> classIRIs.add(e.getIRI())); ontology.datatypesInSignature(INCLUDED).forEach(e -> dataRangeIRIs.add(e.getIRI())); ontology.individualsInSignature(INCLUDED).forEach(e -> individualIRIs.add(e.getIRI())); }
for (OWLOntology ont : onts) { for (OWLDataProperty pe : props.keySet()) { axioms.add(new OntologyAxiomPair(ont, dataFactory.getOWLSubDataPropertyOfAxiom(prop, pe, props.get(pe)))); for (OWLOntology ont : onts) { for (OWLDataProperty pe : props.keySet()) { axioms.add(new OntologyAxiomPair(ont, dataFactory.getOWLEquivalentDataPropertiesAxiom(CollectionFactory.createSet(prop, pe), props.get(pe)))); for (OWLOntology ont : onts) { for (OWLDataProperty pe : props.keySet()) { axioms.add(new OntologyAxiomPair(ont, dataFactory.getOWLDisjointDataPropertiesAxiom(CollectionFactory.createSet(prop, pe), props.get(pe)))); axioms.addAll(parseAnnotations(prop.getIRI()));
/** * Method to find data properties that are new, i.e., that appear in ont2 but not in ont1 * @param ont1 old version of the ontology * @param ont2 new version of the ontology * @return */ private ArrayList<OWLAxiomInfo> findNewDataProperties(OWLOntology ont1, OWLOntology ont2) { ArrayList<OWLAxiomInfo> newC = new ArrayList<OWLAxiomInfo>(); for (OWLDataProperty ont2Prop : ont2.getDataPropertiesInSignature()) { if (!ont1.containsDataPropertyInSignature(ont2Prop.getIRI())) { Set<Object> newDataProprAxiomsSet = new HashSet<Object>(ont2.getAxioms(ont2Prop)); OWLAxiomInfo tempNewProp = new OWLAxiomInfo(ont2Prop.getIRI(), newDataProprAxiomsSet,null); newC.add(tempNewProp); } } return newC; }
private void testExportDataProperty(String typeIri, String expectedType) { SortedMap<String, String> sortedValues = new TreeMap<>(); SortedMap<String, String> sortedIntents = new TreeMap<>(); IRI documentIri = IRI.create("http://visallo.org/test"); when(dataProperty.getIRI()).thenReturn(IRI.create("http://visallo.org/test#prop")); dataPropertyRange = new OWLDatatypeImpl(IRI.create(typeIri)); owlToJava.exportDataProperty(sortedValues, sortedIntents, documentIri, o, dataProperty); assertEquals(1, sortedValues.size()); assertEquals("public static final " + expectedType + " PROP = new " + expectedType + "(\"http://visallo.org/test#prop\");", sortedValues.get("PROP").trim()); }
@Override public Boolean visit(OWLDataProperty property) { return !modelManager.getActiveOntology().getAxioms(property, Imports.EXCLUDED).isEmpty() || !modelManager.getActiveOntology().getAnnotationAssertionAxioms(property.getIRI()).isEmpty(); }