Refine search
@Nullable protected Object passToVisitor(OWLObject o) { if (visitor != null) { o.accept(visitor); return null; } return o.accept(verifyNotNull(visitorEx)); }
@Override public int compare(@Nullable OWLObject o1, @Nullable OWLObject o2) { // if both objects are entities, compare their short forms if (o1 instanceof OWLEntity && o2 instanceof OWLEntity) { return entityComparator.compare((OWLEntity) o1, (OWLEntity) o2); } return verifyNotNull(o1).compareTo(o2); } }
public void addNode(Node<T> node) { node.entities().forEach(e -> { map.put(e, node); if (e.isTopEntity()) { topNode = node; } else if (e.isBottomEntity()) { bottomNode = node; } }); }
/** * @param expr expression to check * @return true iff an EXPRession is equivalent to top wrt defined policy */ public boolean isTopEquivalent(OWLObject expr) { if (expr.isTopEntity()) { return true; } if (expr.isBottomEntity()) { return false; } expr.accept(this); return isTopEq; }
protected OWLObject deshare(OWLObject o) { if (o.hasSharedStructure()) { return o.accept(new OWLObjectDesharer(ontology.getOWLOntologyManager())); } return o; }
public void addNode(Node<T> node) { for (T element : node.getEntities()) { map.put(element, node); if (element.isTopEntity()) { topNode = node; } else if (element.isBottomEntity()) { bottomNode = node; } } }
protected void createGraph(Stream<? extends OWLObject> objects) { RDFTranslator translator = new RDFTranslator(ontology.getOWLOntologyManager(), ontology, shouldInsertDeclarations(), occurrences, axiomOccurrences, nextBlankNodeId, blankNodeMap); objects.sorted().forEach(obj -> deshare(obj).accept(translator)); graph = translator.getGraph(); triplesWithRemappedNodes = getRDFGraph().computeRemappingForSharedNodes(); }
@Nullable public static String owlObjectToTag(OWLObject obj) { IRI iriObj = null; if (obj instanceof OWLNamedObject) { iriObj = ((OWLNamedObject) obj).getIRI(); } else if (obj.isIRI()) { iriObj = (IRI) obj; return null; String iri = iriObj.toString(); String tag = ANNOTATIONPROPERTYMAP.get(iri); if (tag == null) {
@Nullable public static String getIdentifierFromObject(OWLObject obj, OWLOntology ont) throws UntranslatableAxiomException { OWLEntity entity = (OWLEntity) obj; for (OWLAnnotationAssertionAxiom ax : asList( ont.annotationAssertionAxioms(entity.getIRI()))) { String propId = getIdentifierFromObject(ax.getProperty().getIRI(), ont); return getIdentifier(((OWLEntity) obj).getIRI()); if (obj.isIRI()) { return getIdentifier((IRI) obj);
@Override public int compareTo(@Nullable OWLObject o) { checkNotNull(o); assert o != null; if (o == this || equals(o)) { return 0; } if (!o.isIRI()) { return -1; } IRI other = (IRI) o; int diff = namespace.compareTo(other.namespace); if (diff != 0) { return diff; } return remainder.compareTo(other.remainder); }
private void writeFrameType(OWLObject object) { setAxiomWriting(); if (object instanceof OWLOntology) { writeFrameKeyword(ONTOLOGY); OWLOntology ont = (OWLOntology) object; if (!ont.isAnonymous()) { write("<"); write(ont.getOntologyID().getOntologyIRI().get().toString()); write(">"); } } else { if (object instanceof OWLClassExpression) { writeFrameKeyword(CLASS); } else if (object instanceof OWLObjectPropertyExpression) { writeFrameKeyword(OBJECT_PROPERTY); } else if (object instanceof OWLDataPropertyExpression) { writeFrameKeyword(DATA_PROPERTY); } else if (object instanceof OWLIndividual) { writeFrameKeyword(INDIVIDUAL); } else if (object instanceof OWLAnnotationProperty) { writeFrameKeyword(ANNOTATION_PROPERTY); } } object.accept(this); }
protected void createGraph(Set<? extends OWLObject> objects) { RDFTranslator translator = new RDFTranslator(ontology.getOWLOntologyManager(), ontology, shouldInsertDeclarations()); for (OWLObject obj : objects) { obj.accept(translator); } graph = translator.getGraph(); }
/** * Converts an OWL API object to an OWL/XML syntax string. * * @param obj Input OWL object. * @return OWL/XML syntax string. */ public static String toOWLXMLSyntax(OWLObject obj) { StringWriter sw = new StringWriter(); try { OWLXMLWriter oxw = new OWLXMLWriter(sw, OWLManager.createOWLOntologyManager().createOntology(IRI.create("http://example.com/"))); OWLXMLObjectRenderer renderer = new OWLXMLObjectRenderer(oxw); obj.accept(renderer); } catch (OWLOntologyCreationException e) { e.printStackTrace(); } return sw.toString(); }
@Override public String render(OWLObject object) { buffer = new StringBuilder(); checkNotNull(object, "object cannot be null").accept(this); return buffer.toString(); }
@SuppressWarnings({"unchecked",}) protected <O extends OWLObject> O dup(O o) { o.accept(this); return (O) verifyNotNull(obj); }
public Icon getIcon(OWLObject owlObject) { try { icon = null; owlObject.accept(this); return icon; } catch (Exception e) { return null; } }
public int compare(E o1, E o2) { return o1.compareTo(o2); }
/** * Obtains the rendering of the specified object. If the object is a constant then the rendering * is equal to the literal value, if the object is an individual then the rendering is equal to * the rendering of the individual as provided by the alternate short form provider * * @param object The object to the rendered * @return The rendering of the object. */ private String getRendering(OWLObject object) { // We return the literal value of constants or use the alternate // short form provider to render individuals. if (object instanceof OWLLiteral) { // TODO refactor this method to use the annotation value visitor return literalRenderer.visit((OWLLiteral) object); } else if (object.isIRI()) { return alternateIRIShortFormProvider.getShortForm((IRI) object); } else { return alternateShortFormProvider.getShortForm((OWLEntity) object); } }