/** * @param id id * @return IRI with full node id */ public static IRI nodeId(Integer id) { return IRI.create(PREFIX_NODE + id); }
/** * @param ontologyIRI ontology * @param file file */ protected void addMapping(IRI ontologyIRI, File file) { ontologyIRI2PhysicalURIMap.put(ontologyIRI, IRI.create(file)); }
@Nullable public IRI getEditedObject() { IRI editedObject = null; try { editedObject = IRI.create(iriTextField.getText()); } catch (RuntimeException e) { } return editedObject; }
/** * @param tok token * @return IRI without quotes (< and >) */ static IRI unquote(String tok) { String substring = tok.substring(1, tok.length() - 1); assert substring != null; return IRI.create(substring); }
private void addToEntityMap(OWLEntity entity, String newURIStr) { try { URI newURI = new URI(newURIStr); if (!newURI.isAbsolute()){ throw new URISyntaxException(newURIStr, "IRI must be absolute"); } entity2IRIMap.put(entity, IRI.create(newURI)); } catch (URISyntaxException e) { errorMap.put(entity, newURIStr); } }
private IRI getIRI(String key, IRI defaultIRI) { String value = preferences.getString(key, null); if(value != null) { return IRI.create(value); } else { return defaultIRI; } }
@Override public Optional<IRI> getDocumentIRI() { return optional(IRI.create(file)); } }
/** * Gets a SWRLVariable. * * @param iri The IRI of the variable * @return A SWRLVariable that has the name specified by the IRI */ default SWRLVariable getSWRLVariable(String iri) { return getSWRLVariable(IRI.create(iri)); }
/** * Gets a SWRLVariable. * * @param namespace The IRI namespace * @param remainder optional remainder or local name * @return A SWRLVariable that has the name specified by the IRI */ default SWRLVariable getSWRLVariable(String namespace, @Nullable String remainder) { return getSWRLVariable(IRI.create(namespace, remainder)); }
/** * Gets an instance of {@link OWLObjectProperty} that has the specified * {@code IRI}. This is the same as * {@code getOWLObjectProperty(IRI.create(namespace, remainder))}. * * @param namespace The IRI namespace * @param remainder optional remainder or local name * @return An {@link OWLObjectProperty} that has the specified IRI. */ default OWLObjectProperty getOWLObjectProperty(String namespace, @Nullable String remainder) { return getOWLObjectProperty(IRI.create(namespace, remainder)); }
@Override public Optional<OWLAnnotationValue> getAnnotationValue(OWLDataFactory dataFactory) { Optional<Orcid> orcid = orcidProvider.getOrcid(); if(!orcid.isPresent()) { return Optional.empty(); } return Optional.of(IRI.create(Orcid.ORCID_URI_PREFIX + orcid.get().getValue())); } }
protected IRI getIRI(String s) { try { final Optional<IRI> defaultDocURI = ontology.getOntologyID().getDefaultDocumentIRI(); return IRI.create(new URI(defaultDocURI.get().getScheme(), defaultDocURI.get().toURI().getSchemeSpecificPart(), s)); } catch (Exception e) { LoggerFactory.getLogger(AbstractOWLObjectHierarchyCreator.class) .error("An error occurred whilst creating an IRI: {}", e); } return null; }
public static IRI getDefaultBaseIRI() { Preferences prefs = getPrefs(); String baseIRIStr = prefs.getString(DEFAULT_BASE_URI, "http://www.co-ode.org/ontologies/ont.owl#"); return IRI.create(baseIRIStr); }
public Optional<OWLOntologyID> getOntologyId(URI location) { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); try { OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(location)); return Optional.of(ontology.getOntologyID()); } catch (Throwable t) { log.info("Exception caught trying to get ontology id for " + location, t); return null; } } }
@Override public List<OWLOntologyChange> repair() { // XXX arbitrary replacement return list( new SetOntologyID(ontology, IRI.create("urn:profilesrepair:ontology#", "renamed"))); } }
private <E extends OWLEntity> E getErrorEntity(EntityType<E> entityType) { IRI iri = IRI.create("http://org.semanticweb.owlapi/error#", "Error" + ERRORCOUNTER.incrementAndGet()); LOGGER.error("Entity not properly recognized, missing triples in input? {} for type {}", iri, entityType); if (configuration.isStrict()) { throw new OWLParserException( "Entity not properly recognized, missing triples in input? " + iri + " for type " + entityType); } return df.getOWLEntity(entityType, iri); }
@Override public IRI remapIRI(IRI i) { if (nodeCheckerDelegate.isAnonymousNode(i)) { // blank nodes do not need to be remapped in this method return i; } IRI computeIfAbsent = remappedIRIs.computeIfAbsent(i, x -> IRI.create(NodeID.nextAnonymousIRI())); remappedIRIStrings.put(i.toString(), computeIfAbsent); return computeIfAbsent; }
private IRI getBaseIRI(OWLEntity entity) { Optional<String> remainder = entity.getIRI().getRemainder(); if (remainder.isPresent()){ IRI iri = entity.getIRI(); int remainderIndex = iri.toString().lastIndexOf(remainder.get()); if (remainderIndex != -1) { return IRI.create(iri.toString().substring(0, remainderIndex)); } } return entity.getIRI(); }
@Override void attribute(String localName, String value) { if (XMLUtils.isNCName(value)) { builder.with(IRI.create("urn:swrl:var#", value)); } else { builder.with(getIRIFromAttribute(localName, value)); } } }
@Override public void visit(SWRLVariable node) { writer.writeStartElement(VARIABLE); if ("urn:swrl:var#".equals(node.getIRI().getNamespace()) || "urn:swrl#".equals(node.getIRI().getNamespace())) { writer.writeIRIAttribute(IRI.create("urn:swrl:var#", node.getIRI().getFragment())); } else { writer.writeIRIAttribute(node.getIRI()); } writer.writeEndElement(); }