org.semanticweb.owlapi.model.OWLAxiom Java Examples
The following examples show how to use
org.semanticweb.owlapi.model.OWLAxiom.
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: OwlApiEntailmentQueryTest.java From elk-reasoner with Apache License 2.0 | 6 votes |
public OwlApiEntailmentQueryTest( final QueryTestManifest<OWLAxiom, Boolean> manifest) { super(manifest, new OwlApiReasoningTestDelegate<Boolean>(manifest) { @Override public Boolean getActualOutput() throws Exception { return getReasoner().isEntailed(manifest.getInput().getQuery()); } @Override public Class<? extends Exception> getInterruptionExceptionClass() { return ReasonerInterruptedException.class; } }); }
Example #2
Source File: OwlApiIncrementalReasoningTestDelegate.java From elk-reasoner with Apache License 2.0 | 6 votes |
@Override public Collection<OWLAxiom> load() throws Exception { final ArrayList<OWLAxiom> changingAxioms = new ArrayList<OWLAxiom>(); final OWLOntologyManager manager = TestOWLManager .createOWLOntologyManager(); final InputStream stream = getManifest().getInput().getUrl() .openStream(); testOntology_ = manager.loadOntologyFromOntologyDocument(stream); for (OWLAxiom axiom : testOntology_.getLogicalAxioms()) { if (DYNAMIC_AXIOM_TYPES.contains(axiom.getAxiomType())) { changingAxioms.add(axiom); } } return changingAxioms; }
Example #3
Source File: FilterOperation.java From robot with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Remove axioms from the input ontology. This version expects a set of OWLObjectProperties. * * @param ontology the ontology to filter * @param properties a set of OWLObjectProperties to retain */ public static void filter(OWLOntology ontology, Set<OWLObjectProperty> properties) { logger.debug("Filtering ontology for axioms with ObjectProperties " + properties); OWLOntologyManager manager = ontology.getOWLOntologyManager(); Set<OWLAxiom> axioms = ontology.getAxioms(); logger.debug("Ontology has {} axioms before filtering", axioms.size()); // For each axiom, get all its object properties, // then remove the properties that we're looking for. // If there are no object properties left, then we keep this axiom. // All annotation axioms, declarations, and subClass relations remains. for (OWLAxiom axiom : axioms) { Set<OWLObjectProperty> ps = axiom.getObjectPropertiesInSignature(); ps.removeAll(properties); if (ps.size() > 0) { manager.removeAxiom(ontology, axiom); } } logger.debug("Ontology has {} axioms after filtering", ontology.getAxioms().size()); }
Example #4
Source File: InlinedPropertyInclusionHierarchyStep.java From elk-reasoner with Apache License 2.0 | 6 votes |
@Override public Inference<OWLAxiom> getInference() { return new ElkOwlInference(FACTORY.getElkPropertyInclusionHierarchy( getElkSubClassOfAxiom(getPremises().get(0)) .getSubObjectPropertyExpression(), new AbstractList<ElkObjectPropertyExpression>() { @Override public ElkObjectPropertyExpression get(int index) { return getElkSubClassOfAxiom( getPremises().get(index - 1)) .getSuperObjectPropertyExpression(); } @Override public int size() { return getPremises().size(); } })); }
Example #5
Source File: EntailmentProofCompletenessTest.java From elk-reasoner with Apache License 2.0 | 6 votes |
public EntailmentProofCompletenessTest( final TestManifest<QueryTestInput<OWLAxiom>> manifest) { super(manifest, new OwlApiReasoningTestDelegate<Void>(manifest) { @Override public Void getActualOutput() throws Exception { // No output should be needed. throw new UnsupportedOperationException(); } @Override public Class<? extends Exception> getInterruptionExceptionClass() { // No exception should be needed. throw new UnsupportedOperationException(); } }); }
Example #6
Source File: RetrievingProofsForEntailment.java From elk-reasoner with Apache License 2.0 | 6 votes |
/** * @param args * @throws OWLOntologyCreationException */ public static void main(String[] args) throws OWLOntologyCreationException { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); // Load your ontology. OWLOntology ont = manager.loadOntologyFromOntologyDocument(new File("/path/to/your/ontology/ontology.owl")); // Create an instance of ELK ElkProverFactory proverFactory = new ElkProverFactory(); OWLProver prover = proverFactory.createReasoner(ont); // Pre-compute classification prover.precomputeInferences(InferenceType.CLASS_HIERARCHY); // Pick the entailment for which we are interested in proofs OWLAxiom entailment = getEntailment(); // Get the inferences used to prove the entailment DynamicProof<? extends Inference<OWLAxiom>> proof = prover.getProof(entailment); // Now we can recursively request inferences and their premises. Print them to std.out in this example. unwindProof(proof, entailment); // Terminate the worker threads used by the reasoner. prover.dispose(); }
Example #7
Source File: DiffUtil.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
private static Set<OWLAxiom> unannotateAxioms(Set<OWLAxiom> axioms, Map<OWLAxiom, Set<OWLAxiom>> umap, OWLDataFactory owlDataFactory, boolean isCompareUnannotatedForm) { Set<OWLAxiom> axiomsOut = new HashSet<>(); for (OWLAxiom axiom : axioms) { OWLAxiom axiomMapped = null; if (isCompareUnannotatedForm) { axiomMapped = removeAnotations(axiom, owlDataFactory); } else { axiomMapped = axiom; } if (!umap.containsKey(axiomMapped)) umap.put(axiomMapped, new HashSet<>()); umap.get(axiomMapped).add(axiom); axiomsOut.add(axiomMapped); } return axiomsOut; }
Example #8
Source File: BasicABox.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected void translateBioentity(Bioentity e) { OWLDataFactory fac = graph.getDataFactory(); Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); IRI iri = graph.getIRIByIdentifier(e.getId()); OWLNamedIndividual cls = graph.getDataFactory().getOWLNamedIndividual(iri); emap.put(e.getId(), cls); // --label--- axioms.add(fac.getOWLAnnotationAssertionAxiom(fac.getRDFSLabel(), cls.getIRI(), fac.getOWLLiteral(e.getSymbol()))); /* // --taxon-- OWLClass taxCls = getOWLClass(e.getNcbiTaxonId()); // todo - cache axioms.add(fac.getOWLSubClassOfAxiom(cls, fac.getOWLObjectSomeValuesFrom(getGeneAnnotationObjectProperty(Vocab.IN_TAXON), taxCls))); // TODO - other properties */ addAxioms(axioms); }
Example #9
Source File: OCUtils.java From quetzal with Eclipse Public License 2.0 | 6 votes |
public static OWLOntology createOWLThingTypeDeclForIndividuals(OWLOntology ont) throws OWLOntologyCreationException, IOException { OWLOntology ret = ont.getOntologyID()!=null && ont.getOntologyID().getOntologyIRI()!=null? ont.getOWLOntologyManager().createOntology(ont.getOntologyID().getOntologyIRI()): ont.getOWLOntologyManager().createOntology(); OWLDataFactory fac = ret.getOWLOntologyManager().getOWLDataFactory(); OWLClass owlThing = ret.getOWLOntologyManager().getOWLDataFactory().getOWLThing(); for (OWLNamedIndividual ind: ont.getIndividualsInSignature()) { OWLNamedIndividual ni = fac.getOWLNamedIndividual(ind.getIRI()); OWLAxiom ax = fac.getOWLClassAssertionAxiom(owlThing, ni); ret.getOWLOntologyManager().addAxiom(ret, ax); } return ret; }
Example #10
Source File: LinkMaker.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Check that the given subClass does not already has a matching subClass axiom. * * @param subCls * @param p * @param superCls * @return existing axiom or null */ private OWLAxiom hasLinks(OWLClass subCls, OWLObjectProperty p, OWLClass superCls) { for(OWLOntology o : allOntologies) { Set<OWLSubClassOfAxiom> subClsAxioms = o.getSubClassAxiomsForSubClass(subCls); for (OWLSubClassOfAxiom subClsAxiom : subClsAxioms) { OWLClassExpression ce = subClsAxiom.getSuperClass(); if (ce instanceof OWLObjectSomeValuesFrom) { OWLObjectSomeValuesFrom someValuesFrom = (OWLObjectSomeValuesFrom) ce; OWLObjectPropertyExpression property = someValuesFrom.getProperty(); if (p.equals(property)) { OWLClassExpression filler = someValuesFrom.getFiller(); if (superCls.equals(filler)) { return subClsAxiom; } } } } } return null; }
Example #11
Source File: InferenceBuilder.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
public Set<Set<OWLAxiom>> getExplaination(String c1, String c2, Quantifier quantifier){ /*OWLAxiom ax = null; OWLDataFactory dataFactory = graph.getDataFactory(); OWLClass cls1 = dataFactory.getOWLClass(IRI.create(c1)); OWLClass cls2 = dataFactory.getOWLClass(IRI.create(c2)); if(quantifier == Quantifier.EQUIVALENT){ ax = dataFactory.getOWLEquivalentClassesAxiom(cls1, cls2); }else{ ax = dataFactory.getOWLSubClassOfAxiom(cls1, cls2); } //graph.getManager().applyChange(new AddAxiom(graph.getSourceOntology(), ax)); DefaultExplanationGenerator gen = new DefaultExplanationGenerator(graph.getManager(), factory, infOntology, reasoner,null); return gen.getExplanations(ax);*/ return null; }
Example #12
Source File: PhenoSimHQEPreProcessor.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void expandInheresInPartOf() { LOG.info("Expanding IPO; axioms before="+outputOntology.getAxiomCount()); IRI ipoIRI = getIRIViaOBOSuffix(INHERES_IN_PART_OF); OWLAnnotationProperty eap = getOWLDataFactory().getOWLAnnotationProperty(IRI.create("http://purl.obolibrary.org/obo/IAO_0000424")); OWLAnnotationProperty aap = getOWLDataFactory().getOWLAnnotationProperty(IRI.create("http://purl.obolibrary.org/obo/IAO_0000425")); Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>(); for (OWLAnnotationAssertionAxiom ax : outputOntology.getAxioms(AxiomType.ANNOTATION_ASSERTION)) { if (ax.getProperty().equals(eap) || ax.getProperty().equals(aap)) { rmAxioms.add(ax); } } LOG.info("Clearing old expansions: "+rmAxioms.size()); getOWLOntologyManager().removeAxioms(outputOntology, rmAxioms); OWLAnnotationAssertionAxiom aaa = getOWLDataFactory().getOWLAnnotationAssertionAxiom(eap, ipoIRI, getOWLDataFactory().getOWLLiteral("BFO_0000052 some (BFO_0000050 some ?Y)")); addAxiomToOutput(aaa, false); MacroExpansionVisitor mev; mev = new MacroExpansionVisitor(outputOntology); mev.expandAll(); flush(); //mev.expandAll(); LOG.info("Expanded IPO; axioms after="+outputOntology.getAxiomCount()); }
Example #13
Source File: TransformationUtils.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void addLabel(OWLNamedIndividual i, OWLGraphWrapper g, OWLReasoner reasoner) { OWLOntology ontology = g.getSourceOntology(); Set<OWLClass> types = new HashSet<>(); if (reasoner == null) { for (OWLClassExpression x : OwlHelper.getTypes(i, ontology)) { if (!x.isAnonymous()) { types.add((OWLClass) x); } } } else { types = reasoner.getTypes(i, true).getFlattened(); } StringBuffer iLabel = null; for (OWLClass type : types) { String label = g.getLabel(type); if (iLabel == null) iLabel = new StringBuffer("a"); else iLabel.append(" & "); iLabel.append(" "+label); } OWLDataFactory df = g.getDataFactory(); OWLAxiom ax = df.getOWLAnnotationAssertionAxiom(df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()), i.getIRI(), df.getOWLLiteral(iLabel.toString())); g.getManager().addAxiom(ontology, ax); }
Example #14
Source File: SnomedTaxonomy.java From snomed-owl-toolkit with Apache License 2.0 | 5 votes |
public void addAxiom(String referencedComponentId, String axiomId, OWLAxiom owlAxiom) { // Manually remove any existing axiom by axiomId. // We can't use the natural behaviour of a Java Set because the OWLAxiom does not use the axiomId in the equals method. OWLAxiom existingAxiomVersion = axiomsById.get(axiomId); Set<OWLAxiom> conceptAxioms = conceptAxiomMap.computeIfAbsent(parseLong(referencedComponentId), id -> new HashSet<>()); if (existingAxiomVersion != null) { conceptAxioms.remove(existingAxiomVersion); } conceptAxioms.add(owlAxiom); axiomsById.put(axiomId, owlAxiom); }
Example #15
Source File: OwlChangesLoaderFactory.java From elk-reasoner with Apache License 2.0 | 5 votes |
Set<OWLAxiom> getPendingAxiomRemovals() { Set<OWLAxiom> removed = new HashSet<OWLAxiom>(); for (OWLOntologyChange change : pendingChanges_) { if (change instanceof RemoveAxiom) { removed.add(change.getAxiom()); } } return removed; }
Example #16
Source File: ElkOwlProof.java From elk-reasoner with Apache License 2.0 | 5 votes |
public static DynamicProof<ElkOwlInference> create(ElkReasoner reasoner, OWLAxiom entailment) throws UnsupportedEntailmentTypeException { if (reasoner == null) { return Proofs.emptyProof(); } // else final ElkOwlProof proof = new ElkOwlProof(reasoner, entailment); // If the entailment is not supported, throw the exceptions now. proof.ensureSync(); return proof; }
Example #17
Source File: OwlOntologyLoader.java From elk-reasoner with Apache License 2.0 | 5 votes |
private void initImportsClosure() { Set<OWLOntology> importsClosure = owlOntology_.getImportsClosure(); importsClosureIterator_ = importsClosure.iterator(); importsClosureCount_ = importsClosure.size(); importsClosureProcessed_ = 0; updateStatus(); if (importsClosureIterator_.hasNext()) initAxioms(importsClosureIterator_.next()); else axiomsIterator_ = Collections.<OWLAxiom> emptySet().iterator(); }
Example #18
Source File: OwlChangesLoaderFactory.java From elk-reasoner with Apache License 2.0 | 5 votes |
Set<OWLAxiom> getPendingAxiomAdditions() { Set<OWLAxiom> added = new HashSet<OWLAxiom>(); for (OWLOntologyChange change : pendingChanges_) { if (change instanceof AddAxiom) { added.add(change.getAxiom()); } } return added; }
Example #19
Source File: OWLGraphWrapperEdgesExtended.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create a new {@code OWLGraphEdge} going from {@code source}, to the target of * {@code targetEdge}, by merging the underling {@code OWLAxiom}s of {@code sourceEdge} * and {@code targetEdge} (as returned by {@link OWLGraphEdge#getAxioms()}), * and setting the {@code OWLOntology} of this new edge with the one of either * {@code sourceEdge} or {@code targetEdge}, as well as their gci_filler and gi_relation. * {@code OWLQuantifiedProperty}s are not set. * <p> * If both edges are GCI relations, and their GCI fillers and/or * GCI relations are related (see {@link #hasFirstEdgeMoreGeneralGCIParams(OWLGraphEdge, * OWLGraphEdge)}), the combined returned edge will have the most restrictive * GCI filler and GCI relation. If they are not related, the edges will not be combined. * * @param source The {@code OWLObject} which this new edge will originate from. * @param sourceEdge The {@code OWLGraphEdge} to merge with {@code targetEdge}. * @param targetEdge The {@code OWLGraphEdge} going to the target of the new edge * created, and to be merged with {@code sourceEdge}. * @return A newly created {@code OWLGraphEdge}, * with no {@code OWLQuantifiedProperty} set. */ private OWLGraphEdge createMergedEdgeWithGCI(OWLObject source, OWLGraphEdge sourceEdge, OWLGraphEdge targetEdge) { OWLClass gciFiller = null; OWLObjectPropertyExpression gciRel= null; if (sourceEdge.equalsGCI(targetEdge) || this.hasFirstEdgeMoreGeneralGCIParams(targetEdge, sourceEdge)) { //use GCI filler and rel from sourceEdge if GCI parameters are equal, //of if GCI parameters of sourceEdge are more restrictive gciFiller = sourceEdge.getGCIFiller(); gciRel = sourceEdge.getGCIRelation(); } else if (this.hasFirstEdgeMoreGeneralGCIParams(sourceEdge, targetEdge)) { //or if the GCI params of targetEdge are more restrictive, use them gciFiller = targetEdge.getGCIFiller(); gciRel = targetEdge.getGCIRelation(); } else { //otherwise, GCI params are not related and the edges cannot be combined return null; } //merges the underlying axioms of these edges Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(sourceEdge.getAxioms()); axioms.addAll(targetEdge.getAxioms()); return new OWLGraphEdge(source, targetEdge.getTarget(), (sourceEdge.getOntology() != null ? sourceEdge.getOntology() : targetEdge.getOntology()), axioms, gciFiller, gciRel); }
Example #20
Source File: ElkReasonerTest.java From elk-reasoner with Apache License 2.0 | 5 votes |
/** * @return the list of the axioms from the import closure of the given * ontology */ private static List<OWLAxiom> getAxioms(OWLOntology main) { List<OWLAxiom> axioms = new ArrayList<OWLAxiom>(); for (OWLOntology ont : main.getImportsClosure()) { axioms.addAll(ont.getAxioms()); } return axioms; }
Example #21
Source File: TemplatedTransformer.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
public Set<OWLOntologyChange> tr(OWLAxiom inAxiom, Mapping m) { Set<OWLOntologyChange> chgs = new HashSet<OWLOntologyChange>(); boolean isModified = false; OWLAxiom newAxiom = null; if (inAxiom instanceof OWLEquivalentClassesAxiom) { OWLEquivalentClassesAxiom aa = (OWLEquivalentClassesAxiom)inAxiom; Set<OWLClassExpression> xs = new HashSet<OWLClassExpression>(); for (OWLClassExpression x : aa.getClassExpressions()) { OWLClassExpression x2 = replace(x, m); if (x2 == null) { xs.add(x); } else { isModified = true; xs.add(x2); LOG.info(" TR : "+x+ " ---> "+x2); } } if (isModified) { newAxiom = getOWLDataFactory().getOWLEquivalentClassesAxiom(xs); } } if (isModified) { if (m.isReplace) { chgs.add(new RemoveAxiom(ontology, inAxiom)); } chgs.add(new AddAxiom(ontology, newAxiom)); } return chgs; }
Example #22
Source File: InlinedClassInclusionExistentialPropertyExpansionStep.java From elk-reasoner with Apache License 2.0 | 5 votes |
@Override public Inference<OWLAxiom> getInference() { return new ElkOwlInference( FACTORY.getElkClassInclusionExistentialTransitivity( getElkSuperClassExistential(getPremises().get(0)) .getProperty(), new AbstractList<ElkClassExpression>() { @Override public ElkClassExpression get(int index) { switch (index) { case 0: return getElkSubClassOfAxiom( getPremises().get(0)) .getSubClassExpression(); default: return getElkSuperClassExistential( getPremises().get(index - 1)) .getFiller(); } } @Override public int size() { return getPremises().size(); } })); }
Example #23
Source File: GenericReasonerValidationCheck.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param explanation * @param msgBuilder * @param pp */ private void appendExplanation(Set<OWLAxiom> explanation, StringBuilder msgBuilder, OWLPrettyPrinter pp) { if (explanation.isEmpty() == false) { msgBuilder.append(" Explanation: ["); for (Iterator<OWLAxiom> it = explanation.iterator(); it.hasNext();) { OWLAxiom axiom = it.next(); msgBuilder.append(pp.render(axiom)); if (it.hasNext()) { msgBuilder.append("; "); } } msgBuilder.append("]"); } }
Example #24
Source File: ModelAnnotationSolrDocumentLoader.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private Set<OWLAnnotation> getAnnotations(OWLAxiom ax, OWLNamedIndividual i) { Set<OWLAnnotation> all = new HashSet<OWLAnnotation>(); if (ax != null) { all.addAll(ax.getAnnotations()); } if (i != null) { Set<OWLAnnotationAssertionAxiom> aaas = model.getAnnotationAssertionAxioms(i.getIRI()); for(OWLAnnotationAssertionAxiom aaa : aaas) { all.add(aaa.getAnnotation()); } } return all; }
Example #25
Source File: OWLQLNormalizer.java From quetzal with Eclipse Public License 2.0 | 5 votes |
/** normalize quantified existential to the right * <p> normalize(subclass(B, some(R, C))) --> * <ul> * <li> subclass(B, some(R', Top) </li> * <li> subprop(R', R)</li> * <li> normalize(subclass(some(inv(R'), Top), C)) </li> * </ul> * @param ax * @return */ private Set<OWLAxiom> toQLNormalFormRightExistential(OWLSubClassOfAxiom ax) { Set<OWLAxiom> ret = new HashSet<OWLAxiom>(); OWLClassExpression subclass = ax.getSubClass(); OWLClassExpression superclass = ax.getSuperClass(); assert isValidOWLQLLeftConcept(subclass): subclass; assert superclass.getClassExpressionType().equals(ClassExpressionType.OBJECT_SOME_VALUES_FROM) : superclass; // OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) superclass; OWLObjectPropertyExpression r = some.getProperty(); OWLClassExpression c = some.getFiller(); OWLObjectProperty rPrime = createNewObjectProperty(); //subclass(B, some(R', Top) ret.add(fac.getOWLSubClassOfAxiom(subclass, fac.getOWLObjectSomeValuesFrom(rPrime, fac.getOWLThing()))); //subprop(R', R) ret.add(fac.getOWLSubObjectPropertyOfAxiom(rPrime, r)); //normalize(subclass(some(inv(R'), Top), C)) OWLSubClassOfAxiom axToNormalize= fac.getOWLSubClassOfAxiom(fac.getOWLObjectSomeValuesFrom(fac.getOWLObjectInverseOf(rPrime).getSimplified(), fac.getOWLThing()), c); if (!c.isAnonymous()) { ret.add(axToNormalize); } else if (c.getClassExpressionType().equals(ClassExpressionType.OBJECT_SOME_VALUES_FROM)) { Set<OWLAxiom> tpAxioms = toQLNormalFormRightExistential(axToNormalize); if (tpAxioms!=null) { ret.addAll(tpAxioms); } else { return null; } } else { return null; } return ret; }
Example #26
Source File: ProofTestUtils.java From elk-reasoner with Apache License 2.0 | 5 votes |
public static void proofCompletenessTest(final OWLProver prover, final OWLAxiom conclusion, final boolean mustNotBeATautology) { final OWLOntology ontology = prover.getRootOntology(); Proof<Inference<OWLAxiom>> proof = Proofs.removeAssertedInferences( prover.getProof(conclusion), ontology.getAxioms(Imports.INCLUDED)); final InferenceJustifier<Inference<OWLAxiom>, ? extends Set<? extends OWLAxiom>> justifier = InferenceJustifiers .justifyAssertedInferences(); proofCompletenessTest(prover, conclusion, conclusion, proof, justifier, mustNotBeATautology); }
Example #27
Source File: ProofTestUtils.java From elk-reasoner with Apache License 2.0 | 5 votes |
public static <I extends Inference<?>> void proofCompletenessTest( final OWLProver prover, final OWLAxiom entailment, final Object conclusion, final Proof<? extends I> proof, final InferenceJustifier<? super I, ? extends Set<? extends OWLAxiom>> justifier) { proofCompletenessTest(prover, entailment, conclusion, proof, justifier, false); }
Example #28
Source File: NormalizedOWLQLTbox.java From quetzal with Eclipse Public License 2.0 | 5 votes |
public static Set<OWLAxiom> getTboxRboxAxioms( Set<OWLAxiom> axs) { Set<OWLAxiom> ret = new HashSet<OWLAxiom>(); for (OWLAxiom ax: axs) { if (!isAboxAxiom(ax)) { ret.add(ax); } } return ret; }
Example #29
Source File: NormalizedOWLQLTbox.java From quetzal with Eclipse Public License 2.0 | 5 votes |
private static void organizeNegativeClosure(Collection<OWLAxiom> normalizedNegClosureAxioms, Collection<OWLSubClassOfAxiom> negIncAxInNegClos, Collection<OWLDisjointObjectPropertiesAxiom> negObjectSubPropAxInNegClos, Collection<OWLDisjointDataPropertiesAxiom> negDataSubPropAxInNegClos) { organizeTboxAxioms(normalizedNegClosureAxioms, negIncAxInNegClos, negObjectSubPropAxInNegClos, negDataSubPropAxInNegClos, new HashSet<OWLSubClassOfAxiom>(), new HashSet<OWLSubPropertyAxiom>(), new HashSet<OWLObjectProperty>(), new HashSet<OWLObjectProperty>(), new HashMap<String, Set<OWLSubClassOfAxiom>>(), new HashMap<String, Set<OWLSubPropertyAxiom>>()); }
Example #30
Source File: TransformationUtils.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Names all inner ObjectSomeValuesFrom expressions * * @param srcOntology * @param tgtOntology * @param qmap * @param isAddLabels * @return */ public static Map<OWLClass, OWLClassExpression> nameObjectSomeValuesFrom(OWLOntology srcOntology, OWLOntology tgtOntology, Map<OWLClass,OWLClassExpression> qmap, boolean isAddLabels) { if (qmap == null) qmap = new HashMap<OWLClass, OWLClassExpression>(); OWLOntologyManager mgr = srcOntology.getOWLOntologyManager(); OWLDataFactory df = mgr.getOWLDataFactory(); for (OWLOntology ont : srcOntology.getImportsClosure()) { for (OWLAxiom ax : srcOntology.getAxioms()) { for (OWLClassExpression x : ax.getNestedClassExpressions()) { if (x instanceof OWLObjectSomeValuesFrom) { OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)x; OWLClass filler = (OWLClass) svf.getFiller(); OWLObjectProperty p = (OWLObjectProperty) svf.getProperty(); IRI iri = getSkolemIRI(filler, p); OWLClass c = df.getOWLClass(iri); mgr.addAxiom(tgtOntology, df.getOWLEquivalentClassesAxiom(c, svf)); qmap.put(c, svf); if (isAddLabels) { Set<OWLAnnotation> anns = OwlHelper.getAnnotations(filler, df.getRDFSLabel(), ont); for (OWLAnnotation ann : anns) { mgr.addAxiom(tgtOntology, df.getOWLAnnotationAssertionAxiom(c.getIRI(), ann)); } } } } } } return qmap; }