private boolean refactorWhenLabelPresent(OWLEntity entity, String labelRendering) { String iri = entity.getIRI().toString(); if (!iri.endsWith(labelRendering)) { return false; } char c = iri.charAt(iri.length() - 1 - labelRendering.length()); return c == '#' || c == '/'; }
@Nullable public IRI getEditedObject() { final OWLEntity entity = entitySelectorPanel.getSelectedObject(); return entity != null ? entity.getIRI() : null; }
private void extractNSFromEntity(OWLEntity entity) { String ns = getBase(entity.getIRI()); Set<OWLEntity> matchingEntities = nsMap.get(ns); if (matchingEntities == null){ matchingEntities = new HashSet<>(); } matchingEntities.add(entity); nsMap.put(ns, matchingEntities); }
@Override protected void actionPerformed(OWLEntity selectedEntity) { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(selectedEntity.getIRI().toString()), null); }
@Override protected void actionPerformed(OWLEntity selectedEntity) { try { Desktop.getDesktop().browse(selectedEntity.getIRI().toURI()); } catch (IOException e) { logger.error("An error occurred while attempting to open the selected entity IRI in a Web browser", e); } }
public Set<OWLAxiom> getAxioms(Set<OWLOntology> ontologies, Set<OWLEntity> entities) { Set<OWLAxiom> result = new HashSet<>(); for (OWLEntity e : entities) { for(OWLOntology ont : ontologies) { result.addAll(ont.getReferencingAxioms(e)); result.addAll(ont.getAnnotationAssertionAxioms(e.getIRI())); } } return result; }
@Override public Stream<OWLEntity> entitiesInSignature(IRI iri) { return unsortedSignature() .filter((Predicate<? super OWLEntity>) c -> c.getIRI().equals(iri)).sorted(); }
protected String getRendering(Object object) { if (object instanceof OWLEntity){ return super.getRendering(object) + " (" + ((OWLEntity)object).getIRI() + ")"; } return super.getRendering(object); }
public String getToolTipText(MouseEvent event) { int index = locationToIndex(event.getPoint()); if (index >= 0){ Object element = getModel().getElementAt(index); if (element != null && element instanceof OWLEntity){ return ((OWLEntity)element).getIRI().toString(); } } return null; }
private static String generateTitle(OWLEditorKit editorKit, OWLEntity entityToDeprecate) { String title = "Deprecate " + editorKit.getModelManager().getRendering(entityToDeprecate); title += OboUtilities.getOboIdFromIri(entityToDeprecate.getIRI()).map(oboId -> " (" + oboId + ")").orElse(""); return title; }
private void setReplacementEntity(@Nonnull OWLEntity entity) { OWLEditorKit editorKit = getOWLEditorKit(); String rendering = editorKit.getModelManager().getRendering(entity); entityFinderField.setText(rendering); selectedEntity = Optional.of(entity); chosenReplacementLabel.setText("<html><body>" + "The deprecated entity will be replaced with <span style=\"font-weight: bold;\">" + rendering + "</span>" + OboUtilities.getOboIdFromIri(entity.getIRI()).map(id -> " (" + id + ")").orElse("")); }
private void generateChanges(OWLEntity entity) { checkNotNull(entity, "entity cannot be null"); for (OWLOntology ont : ontologies) { ont.referencingAxioms(entity).forEach(ax -> changes.add(new RemoveAxiom(ont, ax))); ont.annotationAssertionAxioms(entity.getIRI()) .forEach(ax -> changes.add(new RemoveAxiom(ont, ax))); } }
@Override public void generateSearchMetadataFor(OWLEntity entity, String entityRendering, SearchMetadataImportContext context, SearchMetadataDB db) { SearchMetadata md = new SearchMetadata(SearchCategory.IRI, GROUP_DESCRIPTION, entity, entityRendering, entity.getIRI().toString()); db.addResult(md); } }
private void updateEntityMapUsingRegexp() { Set<OWLEntity> entities = new HashSet<>(); for (OWLOntology includedOntology : getOntologies()) { entities.addAll(includedOntology.getSignature()); } for (OWLEntity entity : entities){ String newURIStr = entity.getIRI().toString().replaceAll(getFindValue(), getReplaceWithValue()); addToEntityMap(entity, newURIStr); } }
private void addDeprecationCode(List<OWLOntologyChange> changes) { profile.getDeprecationCode().ifPresent(deprecationCode -> { info.getDeprecationCode().ifPresent(selectedCode -> { OWLAnnotationAxiom ax = dataFactory.getOWLAnnotationAssertionAxiom( dataFactory.getOWLAnnotationProperty(deprecationCode.getPropertyIri()), info.getEntityToDeprecate().getIRI(), selectedCode ); changes.add(new AddAxiom(getHomeOntology(), ax)); }); }); }
private List<? extends OWLOntologyChange> createLabel(OWLEntity owlEntity, String value) { LabelDescriptor descr = getLabelDescriptor(); IRI iri = descr.getIRI(); String lang = descr.getLanguage(); OWLDataFactory df = mngr.getOWLDataFactory(); OWLLiteral con = df.getOWLLiteral(value, lang); OWLAnnotationProperty prop = df.getOWLAnnotationProperty(iri); OWLAxiom ax = df.getOWLAnnotationAssertionAxiom(prop, owlEntity.getIRI(), con); return Collections.singletonList(new AddAxiom(mngr.getActiveOntology(), ax)); }