@Override public String getPrefixIRI(IRI iri) { String prefix = reverseprefix2NamespaceMap.get(iri.getNamespace()); if (prefix == null) { return null; } return iri.prefixedBy(prefix); }
/** * Gets a QName for an IRI. * * @param name The name which represents the full name. * @return The QName representation or the input IRI if a QName could not be generated. */ public String getQName(IRI name) { if (name.getNamespace().equals(defaultNamespace)) { return name.prefixedBy(""); } String candidate = namespacePrefixMap.get(name.getNamespace()); if (candidate != null) { return name.prefixedBy(candidate + ':'); } return name.toString(); }
/** * Gets a QName for an IRI. * * @param name The name which represents the full name. * @return The QName representation or the input IRI if a QName could not be generated. */ public String getQName(IRI name) { if (name.getNamespace().equals(defaultNamespace)) { return name.prefixedBy(""); } String candidate = namespacePrefixMap.get(name.getNamespace()); if (candidate != null) { return name.prefixedBy(candidate + ':'); } return name.toString(); }
/** * Gets a QName for an IRI. * * @param name The name which represents the full name. * @return The QName representation or the input IRI if a QName could not be generated. */ public String getQName(IRI name) { if (name.getNamespace().equals(defaultNamespace)) { return name.prefixedBy(""); } String candidate = namespacePrefixMap.get(name.getNamespace()); if (candidate != null) { return name.prefixedBy(candidate + ':'); } return name.toString(); }
/** * Gets a QName for an IRI. * * @param name The name which represents the full name. * @return The QName representation or the input IRI if a QName could not be generated. */ public String getQName(IRI name) { if (name.getNamespace().equals(defaultNamespace)) { return name.prefixedBy(""); } String candidate = namespacePrefixMap.get(name.getNamespace()); if (candidate != null) { return name.prefixedBy(candidate + ':'); } return name.toString(); }
/** * Gets an IRI attribute value for a full IRI. If the IRI has a prefix that * coincides with a written prefix then the compact IRI will be returned, * otherwise the full IRI will be returned. * * @param iri The IRI * @return Either the compact version of the IRI or the full IRI. */ public String getIRIString(IRI iri) { String prefixName = iriPrefixMap.get(iri.getNamespace()); if (prefixName == null) { return iri.toString(); } return iri.prefixedBy(prefixName); }
/** * Gets an IRI attribute value for a full IRI. If the IRI has a prefix that * coincides with a written prefix then the compact IRI will be returned, * otherwise the full IRI will be returned. * * @param iri The IRI * @return Either the compact version of the IRI or the full IRI. */ public String getIRIString(IRI iri) { String prefixName = iriPrefixMap.get(iri.getNamespace()); if (prefixName == null) { return iri.toString(); } return iri.prefixedBy(prefixName); }
/** * Gets an IRI attribute value for a full IRI. If the IRI has a prefix that * coincides with a written prefix then the compact IRI will be returned, * otherwise the full IRI will be returned. * * @param iri The IRI * @return Either the compact version of the IRI or the full IRI. */ public String getIRIString(IRI iri) { String prefixName = iriPrefixMap.get(iri.getNamespace()); if (prefixName == null) { return iri.toString(); } return iri.prefixedBy(prefixName); }
/** * Gets an IRI attribute value for a full IRI. If the IRI has a prefix that * coincides with a written prefix then the compact IRI will be returned, * otherwise the full IRI will be returned. * * @param iri The IRI * @return Either the compact version of the IRI or the full IRI. */ public String getIRIString(IRI iri) { String prefixName = iriPrefixMap.get(iri.getNamespace()); if (prefixName == null) { return iri.toString(); } return iri.prefixedBy(prefixName); }
@Override @Nullable public String getPrefixIRI(IRI iri) { String prefix = reverseprefix2NamespaceMap.get(iri.getNamespace()); if (prefix == null) { String iriString = iri.toString(); String prefixed = null; for (String s : reverseprefix2NamespaceMap.keySet()) { if (iriString.startsWith(s) && XMLUtils.isQName(iriString, s.length())) { prefix = reverseprefix2NamespaceMap.get(s); prefixed = iriString.replace(s, prefix); } } if (prefixed != null && XMLUtils.isQName(prefixed)) { return prefixed; } } if (prefix == null) { return null; } return iri.prefixedBy(prefix); }
@Override @Nullable public String getPrefixIRI(IRI iri) { String prefix = reverseprefix2NamespaceMap.get(iri.getNamespace()); if (prefix == null) { String iriString = iri.toString(); String prefixed = null; for (String s : reverseprefix2NamespaceMap.keySet()) { if (iriString.startsWith(s) && XMLUtils.isQName(iriString, s.length())) { prefix = reverseprefix2NamespaceMap.get(s); prefixed = iriString.replace(s, prefix); } } if (prefixed != null && XMLUtils.isQName(prefixed)) { return prefixed; } } if (prefix == null) { return null; } return iri.prefixedBy(prefix); }
@Override @Nullable public String getPrefixIRI(IRI iri) { String prefix = reverseprefix2NamespaceMap.get(iri.getNamespace()); if (prefix == null) { String iriString = iri.toString(); String prefixed = null; for (String s : reverseprefix2NamespaceMap.keySet()) { if (iriString.startsWith(s) && XMLUtils.isQName(iriString, s.length())) { prefix = reverseprefix2NamespaceMap.get(s); prefixed = iriString.replace(s, prefix); } } if (prefixed != null && XMLUtils.isQName(prefixed)) { return prefixed; } } if (prefix == null) { return null; } return iri.prefixedBy(prefix); }
@Override public String getShortForm(OWLEntity entity) { checkNotNull(entity, "entity cannot be null"); String namespace = entity.getIRI().getNamespace(); String prefix = namespaceUtil.getPrefix(namespace); return entity.getIRI().prefixedBy(prefix + ':'); } }
@Override public void visit(@Nonnull SWRLVariable node) { write("?"); // do not save the namespace if it's the conventional one if ("urn:swrl#".equals(node.getIRI().getNamespace())) { write(node.getIRI().prefixedBy("")); } else { write(node.getIRI().toQuotedString()); } }
@Override public String getShortForm(OWLEntity entity) { checkNotNull(entity, "entity cannot be null"); String namespace = entity.getIRI().getNamespace(); String prefix = namespaceUtil.getPrefix(namespace); return entity.getIRI().prefixedBy(prefix + ':'); } }
@Override public String getShortForm(OWLEntity entity) { checkNotNull(entity, "entity cannot be null"); String namespace = entity.getIRI().getNamespace(); String prefix = namespaceUtil.getPrefix(namespace); return entity.getIRI().prefixedBy(prefix + ':'); } }
@Override public void visit(SWRLVariable node) { write("?"); // do not save the namespace if it's the conventional one if ("urn:swrl:var#".equals(node.getIRI().getNamespace()) || "urn:swrl#".equals(node.getIRI().getNamespace())) { write(node.getIRI().prefixedBy("")); } else { write(node.getIRI().toQuotedString()); } }
@Override public void visit(SWRLVariable node) { write("?"); // do not save the namespace if it's the conventional one if ("urn:swrl:var#".equals(node.getIRI().getNamespace()) || "urn:swrl#".equals(node.getIRI().getNamespace())) { write(node.getIRI().prefixedBy("")); } else { write(node.getIRI().toQuotedString()); } }
@Override public void visit(SWRLVariable node) { write("?"); // do not save the namespace if it's the conventional one if ("urn:swrl:var#".equals(node.getIRI().getNamespace()) || "urn:swrl#".equals(node.getIRI().getNamespace())) { write(node.getIRI().prefixedBy("")); } else { write(node.getIRI().toQuotedString()); } }
@Override public void visit(SWRLVariable node) { write("?"); // do not save the namespace if it's the conventional one if ("urn:swrl:var#".equals(node.getIRI().getNamespace()) || "urn:swrl#".equals(node.getIRI().getNamespace())) { write(node.getIRI().prefixedBy("")); } else { write(node.getIRI().toQuotedString()); } }