private DatatypeFactory() { values.forEach(d -> knownDatatypes.put(d.getDatatypeIRI(), d)); knownDatatypes.put(XSDVocabulary.DATE.getIRI(), DATETIME); }
OWL2Datatype(XSDVocabulary xsd, Category category, boolean finite, String regEx) { iri = xsd.getIRI(); shortForm = xsd.getShortForm(); prefixedName = xsd.getPrefixedName(); this.category = category; this.finite = finite; regExpression = regEx; pattern = Pattern.compile(regEx, Pattern.DOTALL); }
OWL2Datatype(XSDVocabulary xsd, Category category, boolean finite, String regEx) { this.iri = xsd.getIRI(); this.shortName = xsd.getShortName(); this.category = category; this.finite = finite; this.pattern = Pattern.compile(regEx, Pattern.DOTALL); }
public DefaultEntityChecker() { dataTypeNameMap = new HashMap<String, OWLDatatype>(); for (XSDVocabulary v : XSDVocabulary.values()) { dataTypeNameMap.put(v.getURI().getFragment(), dataFactory.getOWLDatatype(v.getIRI())); dataTypeNameMap.put("xsd:" + v.getURI().getFragment(), dataFactory.getOWLDatatype(v.getIRI())); } }
initialiseAnnotationPropertyFrameSections(); initialiseIndividualFrameSections(); for (XSDVocabulary v : XSDVocabulary.values()) { dataTypeNames.add(v.getIRI().toString()); dataTypeNames.add(v.getIRI().toQuotedString()); dataTypeNames.add(v.getPrefixedName());
if (iriString.startsWith("xsd:")) { String name = iriString.substring(4); for (XSDVocabulary v : XSDVocabulary.values()) { if (v.getShortForm().equals(name)) { datatype = knownDatatypes.get(v.getIRI()); if (datatype == null) { LOGGER.error(
@Override public boolean getBoolean() throws LiteralException { if (!isBoolean()) throw new LiteralException( "cannot convert value of type " + this.literal.getDatatype() + " to " + XSDVocabulary.BOOLEAN .getPrefixedName()); return Boolean.parseBoolean(this.literal.getLiteral()); }
/** * Easy parse of short names of the kind "xsd:typename". Note that the match * must be exact - uppercase or lowercase variants are not accepted. An * IllegalArgumentException will be thrown for non matching input. * * @param s string of the form {@code xsd:typename} * @return the XSDVocabulary item matching xsd:typename, e.g., {@code STRING} for {@code * "xsd:string"} */ public static XSDVocabulary parseShortName(String s) { checkNotNull(s, "the input string cannot be null"); if (s.startsWith("xsd:")) { String name = s.substring(4); for (XSDVocabulary v : values()) { if (v.shortName.equals(name)) { return v; } } } throw new IllegalArgumentException( "the input value does not match any of the known xsd types: " + s); }
for (XSDVocabulary v : XSDVocabulary.values()) { String prefixedName = v.getPrefixedName(); if (prefixedName != null) this.renderings.add(prefixedName);
initialiseAnnotationPropertyFrameSections(); initialiseIndividualFrameSections(); for (XSDVocabulary v : XSDVocabulary.values()) { dataTypeNames.add(v.getIRI().toString()); dataTypeNames.add(v.getIRI().toQuotedString()); dataTypeNames.add(v.getPrefixedName());
@Override public byte getByte() throws LiteralException { try { if (!isByte()) throw new LiteralException( "cannot convert value of type " + this.literal.getDatatype() + " to " + XSDVocabulary.BYTE.getPrefixedName()); return Byte.parseByte(this.literal.getLiteral()); } catch (NumberFormatException e) { throw new LiteralException( "cannot convert value " + this.literal.getLiteral() + " of type " + this.literal.getDatatype() + XSDVocabulary.BYTE.getPrefixedName()); } }
OWL2Datatype(XSDVocabulary xsd, Category category, boolean finite, String regEx) { iri = xsd.getIRI(); shortName = xsd.getShortName(); this.category = category; this.finite = finite; pattern = RegExp.compile(regEx, REG_EXP_FLAGS); }
/** * Easy parse of short names of the kind "xsd:typename". Note that the match * must be exact - uppercase or lowercase variants are not accepted. An * IllegalArgumentException will be thrown for non matching input. * * @param s string of the form {@code xsd:typename} * @return the XSDVocabulary item matching xsd:typename, e.g., {@code STRING} for {@code * "xsd:string"} */ public static XSDVocabulary parseShortName(String s) { checkNotNull(s, "the input string cannot be null"); if (s.startsWith("xsd:")) { String name = s.substring(4); for (XSDVocabulary v : values()) { if (v.shortName.equals(name)) { return v; } } } throw new IllegalArgumentException( "the input value does not match any of the known xsd types: " + s); }
public Set<OWLDataProperty> getDataPropertiesByRange(XSDVocabulary xsdType) { return getDataPropertiesByRange(xsdType.getIRI()); } public Set<OWLDataProperty> getDataPropertiesByRange(Set<OWLDatatype> dts) {
initialiseAnnotationPropertyFrameSections(); initialiseIndividualFrameSections(); for (XSDVocabulary v : XSDVocabulary.values()) { dataTypeNames.add(v.getIRI().toString()); dataTypeNames.add(v.getIRI().toQuotedString()); dataTypeNames.add(v.getPrefixedName());
OWL2Datatype(XSDVocabulary xsd, Category category, boolean finite, String regEx) { iri = xsd.getIRI(); shortForm = xsd.getShortForm(); prefixedName = xsd.getPrefixedName(); this.category = category; this.finite = finite; regExpression = regEx; pattern = Pattern.compile(regEx, Pattern.DOTALL); }
@Override public long getUnsignedLong() throws LiteralException { try { if (isNumeric()) { long l = Long.parseLong(this.literal.getLiteral()); if (l >= 0) return l; else throw new LiteralException( "negative value " + getValue() + " for " + XSDVocabulary.UNSIGNED_LONG.getPrefixedName()); } else throw new LiteralException( "cannot convert value of type " + this.literal.getDatatype() + " to " + XSDVocabulary.UNSIGNED_LONG .getPrefixedName()); } catch (NumberFormatException e) { throw new LiteralException( "cannot convert value " + this.literal.getLiteral() + " of type " + this.literal.getDatatype() + " to " + XSDVocabulary.UNSIGNED_LONG.getPrefixedName()); } }