/** * Gets an IRI prefix from an id prefix. * * @param idPrefix The id prefix. May be null. * @return The IRI prefix for the given id prefix. Not null. If the specified id prefix is not * registered/set with this manager, or it is null, then the default prefix will be returned, * which is defined by {@link OBOPrefix#OBO}. */ public String getIRIPrefix(String idPrefix) { String iriPrefix = idPrefix2IRIPrefixMap.get(idPrefix); if (iriPrefix != null) { return iriPrefix; } else { return getDefaultIRIPrefix(); } }
public void registerIdSpace(String idSpacePrefix, String iriPrefix) { idSpaceManager.setIRIPrefix(idSpacePrefix, iriPrefix); }
/** * Converts OBO Ids to IRIs. The conversion is defined at * <a href="http://www.obofoundry.org/id-policy.shtml" >http://www. * obofoundry.org/id-policy.shtml</a>. * * @param oboId The OBO Id to convert. * @param idSpaceManager An {@link IDSpaceManager} which can be used to customise the IRI * prefixes used in the conversion. * @return The IRI of the converted Id. */ public static IRI ID2IRI(String oboId, IDSpaceManager idSpaceManager) { Matcher matcher = OBO_ID_PATTERN.matcher(oboId); if (matcher.matches()) { String idSpace = matcher.group(2); String localId = matcher.group(3); StringBuilder sb = new StringBuilder(); String iriPrefix = idSpaceManager.getIRIPrefix(idSpace); sb.append(iriPrefix); if (idSpace != null && !idSpace.isEmpty()) { sb.append(idSpace); sb.append("_"); } sb.append(localId); return IRI.create(sb.toString()); } else { return IRI.create(oboId); } }
/** * Converts OBO Ids to IRIs. The conversion is defined at * <a href="http://www.obofoundry.org/id-policy.shtml" >http://www. * obofoundry.org/id-policy.shtml</a>. * * @param oboId The OBO Id to convert. * @param idSpaceManager An {@link IDSpaceManager} which can be used to customise the IRI * prefixes used in the conversion. * @return The IRI of the converted Id. */ public static IRI ID2IRI(String oboId, IDSpaceManager idSpaceManager) { Matcher matcher = OBO_ID_PATTERN.matcher(oboId); if (matcher.matches()) { String idSpace = matcher.group(2); String localId = matcher.group(3); StringBuilder sb = new StringBuilder(); String iriPrefix = idSpaceManager.getIRIPrefix(idSpace); sb.append(iriPrefix); if (idSpace != null && !idSpace.isEmpty()) { sb.append(idSpace); sb.append("_"); } sb.append(localId); return IRI.create(sb.toString()); } else { return IRI.create(oboId); } }
/** * Converts OBO Ids to IRIs. The conversion is defined at * <a href="http://www.obofoundry.org/id-policy.shtml" >http://www. * obofoundry.org/id-policy.shtml</a>. * * @param oboId The OBO Id to convert. * @param idSpaceManager An {@link IDSpaceManager} which can be used to customise the IRI * prefixes used in the conversion. * @return The IRI of the converted Id. */ public static IRI ID2IRI(String oboId, IDSpaceManager idSpaceManager) { Matcher matcher = OBO_ID_PATTERN.matcher(oboId); if (matcher.matches()) { String idSpace = matcher.group(2); String localId = matcher.group(3); StringBuilder sb = new StringBuilder(); String iriPrefix = idSpaceManager.getIRIPrefix(idSpace); sb.append(iriPrefix); if (idSpace != null && !idSpace.isEmpty()) { sb.append(idSpace); sb.append("_"); } sb.append(localId); return IRI.create(sb.toString()); } else { return IRI.create(oboId); } }
public void registerIdSpace(String idSpacePrefix, String iriPrefix) { idSpaceManager.setIRIPrefix(idSpacePrefix, iriPrefix); }
/** * Gets an IRI prefix from an id prefix. * * @param idPrefix The id prefix. May be null. * @return The IRI prefix for the given id prefix. Not null. If the specified id prefix is not * registered/set with this manager, or it is null, then the default prefix will be returned, * which is defined by {@link OBOPrefix#OBO}. */ public String getIRIPrefix(String idPrefix) { String iriPrefix = idPrefix2IRIPrefixMap.get(idPrefix); if (iriPrefix != null) { return iriPrefix; } else { return getDefaultIRIPrefix(); } }
/** * Sets the {@link org.semanticweb.owlapi.model.OWLOntologyID} of the * ontology being parsed from the tag values held by the * {@link #ontologyTagValue} and {@link #dataVersionTagValue} field. IRIs * for each field are generated and used to construct the * {@link org.semanticweb.owlapi.model.OWLOntologyID}. */ private void setOntologyId() { IRI ontologyIRI = IRI .create(idSpaceManager.getIRIPrefix(ontologyTagValue), ontologyTagValue); IRI versionIRI = null; if (dataVersionTagValue.length() > 0) { versionIRI = IRI.create(ontologyIRI + "/", dataVersionTagValue); } OWLOntologyID ontologyID = new OWLOntologyID(optional(ontologyIRI), optional(versionIRI)); ontology.getOWLOntologyManager().applyChange(new SetOntologyID(ontology, ontologyID)); }
public void registerIdSpace(String idSpacePrefix, String iriPrefix) { idSpaceManager.setIRIPrefix(idSpacePrefix, iriPrefix); }
/** * Gets an IRI prefix from an id prefix. * * @param idPrefix The id prefix. May be null. * @return The IRI prefix for the given id prefix. Not null. If the specified id prefix is not * registered/set with this manager, or it is null, then the default prefix will be returned, * which is defined by {@link OBOPrefix#OBO}. */ public String getIRIPrefix(String idPrefix) { String iriPrefix = idPrefix2IRIPrefixMap.get(idPrefix); if (iriPrefix != null) { return iriPrefix; } else { return getDefaultIRIPrefix(); } }
/** * Sets the {@link org.semanticweb.owlapi.model.OWLOntologyID} of the * ontology being parsed from the tag values held by the * {@link #ontologyTagValue} and {@link #dataVersionTagValue} field. IRIs * for each field are generated and used to construct the * {@link org.semanticweb.owlapi.model.OWLOntologyID}. */ private void setOntologyId() { IRI ontologyIRI = IRI .create(idSpaceManager.getIRIPrefix(ontologyTagValue), ontologyTagValue); IRI versionIRI = null; if (dataVersionTagValue.length() > 0) { versionIRI = IRI.create(ontologyIRI + "/", dataVersionTagValue); } OWLOntologyID ontologyID = new OWLOntologyID(optional(ontologyIRI), optional(versionIRI)); ontology.getOWLOntologyManager().applyChange(new SetOntologyID(ontology, ontologyID)); }
/** * Sets the {@link org.semanticweb.owlapi.model.OWLOntologyID} of the * ontology being parsed from the tag values held by the * {@link #ontologyTagValue} and {@link #dataVersionTagValue} field. IRIs * for each field are generated and used to construct the * {@link org.semanticweb.owlapi.model.OWLOntologyID}. */ private void setOntologyId() { IRI ontologyIRI = IRI .create(idSpaceManager.getIRIPrefix(ontologyTagValue), ontologyTagValue); IRI versionIRI = null; if (dataVersionTagValue.length() > 0) { versionIRI = IRI.create(ontologyIRI + "/", dataVersionTagValue); } OWLOntologyID ontologyID = new OWLOntologyID(optional(ontologyIRI), optional(versionIRI)); ontology.getOWLOntologyManager().applyChange(new SetOntologyID(ontology, ontologyID)); }