org.semanticweb.owlapi.model.OWLDeclarationAxiom Java Examples
The following examples show how to use
org.semanticweb.owlapi.model.OWLDeclarationAxiom.
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: AbstractOwlAxiomConverterVisitor.java From elk-reasoner with Apache License 2.0 | 5 votes |
@Override public T visit(OWLDeclarationAxiom axiom) { throw new IllegalArgumentException( OWLDeclarationAxiom.class.getSimpleName() + " cannot be converted to " + getTargetClass().getSimpleName()); }
Example #2
Source File: AbstractSimPreProcessor.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
public Set<OWLClass> extractClassesFromDeclarations(Set<OWLAxiom> axs) { Set<OWLClass> cs = new HashSet<OWLClass>(); for (OWLAxiom ax : axs) { if (ax instanceof OWLDeclarationAxiom) { OWLEntity e = ((OWLDeclarationAxiom)ax).getEntity(); if (e instanceof OWLClass) cs.add((OWLClass) e); } } return cs; }
Example #3
Source File: DiffUtil.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Set<OWLAxiom> filter(Set<OWLAxiom> axioms, Diff diff) { if (diff.isFilterDeclarations) { return axioms.stream().filter(a -> !(a instanceof OWLDeclarationAxiom)). collect(Collectors.toSet()); } else { return axioms; } }
Example #4
Source File: OWLGraphWrapperExtended.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns an OWLNamedIndividual with this IRI <b>if it has been declared</b> * in the source or support ontologies. Returns null otherwise. * * @param iri * @return {@link OWLNamedIndividual} */ public OWLNamedIndividual getOWLIndividual(IRI iri) { OWLNamedIndividual c = getDataFactory().getOWLNamedIndividual(iri); for (OWLOntology o : getAllOntologies()) { for (OWLDeclarationAxiom da : o.getDeclarationAxioms(c)) { if (da.getEntity() instanceof OWLNamedIndividual) { return (OWLNamedIndividual) da.getEntity(); } } } return null; }
Example #5
Source File: OWLConverter.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Convenience method for adding a declaration axiom to the ontology. * * @param ontology the current ontology * @param subject the entity for which the declaration will be added * @return the declaration axiom */ protected static OWLDeclarationAxiom declare(OWLOntology ontology, OWLEntity subject) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory dataFactory = manager.getOWLDataFactory(); OWLDeclarationAxiom axiom = dataFactory.getOWLDeclarationAxiom(subject); manager.addAxiom(ontology, axiom); return axiom; }
Example #6
Source File: PredicateVariableExtractor.java From neo4j-sparql-extension with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #7
Source File: GraphOwlVisitor.java From SciGraph with Apache License 2.0 | 5 votes |
@Override public Void visit(OWLDeclarationAxiom axiom) { String iri = getIri(axiom); long node = getOrCreateNode(iri); addDefinedBy(node); if (axiom.getEntity() instanceof OWLClass) { graph.addLabel(node, OwlLabels.OWL_CLASS); } else if (axiom.getEntity() instanceof OWLNamedIndividual) { graph.addLabel(node, OwlLabels.OWL_NAMED_INDIVIDUAL); } else if (axiom.getEntity() instanceof OWLObjectProperty) { if (!graph.getLabels(node).contains(OwlLabels.OWL_OBJECT_PROPERTY)) { graph.addLabel(node, OwlLabels.OWL_OBJECT_PROPERTY); if (ontology.isPresent()) { OWLObjectProperty property = (OWLObjectProperty) axiom.getEntity(); graph.setNodeProperty(node, EdgeProperties.SYMMETRIC, !property.isAsymmetric(ontology.get())); graph.setNodeProperty(node, EdgeProperties.REFLEXIVE, property.isReflexive(ontology.get())); graph.setNodeProperty(node, EdgeProperties.TRANSITIVE, property.isTransitive(ontology.get())); } } } else if (axiom.getEntity() instanceof OWLDataProperty) { graph.setLabel(node, OwlLabels.OWL_DATA_PROPERTY); } else { // logger.warning("Unhandled declaration type " + axiom.getEntity().getClass().getName()); } return null; }
Example #8
Source File: AbstractElkObjectConverter.java From elk-reasoner with Apache License 2.0 | 4 votes |
@Override public OWLDeclarationAxiom visit(ElkDeclarationAxiom axiom) { return owlFactory_.getOWLDeclarationAxiom(convert(axiom.getEntity())); }
Example #9
Source File: OwlConverter.java From elk-reasoner with Apache License 2.0 | 4 votes |
@SuppressWarnings("static-method") public ElkDeclarationAxiom convert( OWLDeclarationAxiom owlDeclarationAxiom) { return new ElkDeclarationAxiomWrap<OWLDeclarationAxiom>( owlDeclarationAxiom); }
Example #10
Source File: OwlAxiomConverterVisitor.java From elk-reasoner with Apache License 2.0 | 4 votes |
@Override public ElkAxiom visit(OWLDeclarationAxiom owlDeclarationAxiom) { return CONVERTER.convert(owlDeclarationAxiom); }
Example #11
Source File: FailingOwlAxiomVisitor.java From elk-reasoner with Apache License 2.0 | 4 votes |
@Override public void visit(OWLDeclarationAxiom axiom) { defaultVisit(axiom); }
Example #12
Source File: OWLInAboxTranslator.java From owltools with BSD 3-Clause "New" or "Revised" License | 4 votes |
private void tr(OWLDeclarationAxiom ax) { // do nothing: instances and tlrs declared fresh }
Example #13
Source File: AxiomAnnotationTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public OWLAxiom visit(OWLDeclarationAxiom axiom) { return factory.getOWLDeclarationAxiom(axiom.getEntity(), annotations); }
Example #14
Source File: CardinalityContraintsTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void visit(OWLDeclarationAxiom axiom) { }
Example #15
Source File: OwlApiUtils.java From SciGraph with Apache License 2.0 | 4 votes |
public static String getIri(OWLDeclarationAxiom expression) { return expression.getEntity().getIRI().toString(); }