private int getServerPort(OWLIndividual i) { for (OWLLiteral hostPortLiteral : i.getDataPropertyValues(HAS_SERVER_PORT, ontology)) { if (hostPortLiteral.isInteger()) { int port = hostPortLiteral.parseInteger(); return port; } } return 0; }
private int getRegistryPort(OWLIndividual i) { for (OWLLiteral hostPortLiteral : i.getDataPropertyValues(HAS_REGISTRY_PORT, ontology)) { if (hostPortLiteral.isInteger()) { int port = hostPortLiteral.parseInteger(); return port; } } return Registry.REGISTRY_PORT; }
for (OWLLiteral lit : values) { if(OWLAPIUtils.isIntegerDatatype(lit)) { numericValues.add((T) Integer.valueOf(lit.parseInteger())); } else { try {
@Override protected int compareObjectOfSameType(OWLObject object) { OWLLiteral other = (OWLLiteral) object; int diff = getLiteral().compareTo(other.getLiteral()); if (diff != 0) { return diff; } int compareTo = datatype.compareTo(other.getDatatype()); if (compareTo != 0) { return compareTo; } return Integer.compare(literal, other.parseInteger()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (obj instanceof OWLLiteralImplInteger) { OWLLiteralImplInteger other = (OWLLiteralImplInteger) obj; return literal == other.literal; } if (obj instanceof OWLLiteral) { return ((OWLLiteral) obj).isInteger() && ((OWLLiteral) obj).getLiteral().charAt(0) != '0' && literal == ((OWLLiteral) obj).parseInteger(); } return false; }
for (OWLLiteral lit : relatedValues) { if(OWLAPIUtils.isIntegerDatatype(lit)) { posRelatedValues.add((T) Integer.valueOf(lit.parseInteger())); } else { try { for (OWLLiteral lit : relatedValues) { if(OWLAPIUtils.isIntegerDatatype(lit)) { negRelatedValues.add((T) Integer.valueOf(lit.parseInteger())); } else { try {
return Range.between(min.parseFloat(), max.parseFloat()).contains(value.parseFloat()); } else if(OWLAPIUtils.intDatatypes.contains(datatype)) { return Range.between(min.parseInteger(), max.parseInteger()).contains(value.parseInteger());
/*** * @param literal An OWLLiteral * @return an optional correctly typed Java object from the OWLLiteral */ public static Optional<Object> getTypedLiteralValue(OWLLiteral literal) { Object literalValue = null; if (literal.isBoolean()) { literalValue = literal.parseBoolean(); } else if (literal.isInteger()) { literalValue = literal.parseInteger(); } else if (literal.isFloat()) { literalValue = literal.parseFloat(); } else if (literal.isDouble()) { literalValue = literal.parseDouble(); } else { // This needs to be addressed by #110 if (literal.hasLang() && !literal.getLang().startsWith("en")) { if (!unknownLanguages.contains(literal.getLang())) { unknownLanguages.add(literal.getLang()); logger.warning("Ignoring *all* literals with unsupported language: \"" + literal.getLang() + "\"."); } return Optional.empty(); } literalValue = literal.getLiteral(); } return Optional.of(literalValue); }
public static Object literal2obj(OWLAnnotationValue l) { if (l instanceof OWLLiteral) { if (((OWLLiteral) l).isBoolean()) return ((OWLLiteral) l).parseBoolean(); else if (((OWLLiteral) l).isInteger()) return ((OWLLiteral) l).parseInteger(); else if (((OWLLiteral) l).isFloat()) return ((OWLLiteral) l).parseFloat(); else if (((OWLLiteral) l).isDouble()) return ((OWLLiteral) l).parseDouble(); else { return ((OWLLiteral)l).getLiteral(); } } else if (l instanceof IRI) { return ((IRI)l).toURI().toString(); } return l.toString(); }
int min = facetRestrictions.stream() .filter(fr -> fr.getFacet() == OWLFacet.MIN_INCLUSIVE) .map(fr -> fr.getFacetValue().parseInteger()) .findAny().orElse(-Integer.MAX_VALUE); int max = facetRestrictions.stream() .filter(fr -> fr.getFacet() == OWLFacet.MAX_INCLUSIVE) .map(fr -> fr.getFacetValue().parseInteger()) .findAny().orElse(Integer.MAX_VALUE);
for (OWLFacetRestriction facet : facetRestrictions) { if (facet.getFacet() == OWLFacet.MIN_INCLUSIVE) { min = facet.getFacetValue().parseInteger(); } else if (facet.getFacet() == OWLFacet.MAX_INCLUSIVE) { max = facet.getFacetValue().parseInteger();
public void visit(OWLLiteral owlLiteral) { if (owlLiteral.isBoolean()) { builder.append(Boolean.toString(owlLiteral.parseBoolean())); } else if (owlLiteral.isDouble()) { builder.append(owlLiteral.parseDouble()); } else if (owlLiteral.isFloat()) { builder.append(owlLiteral.parseFloat()); } else if (owlLiteral.isInteger()) { builder.append(owlLiteral.parseInteger()); } else { builder.append("\""); builder.append(owlLiteral.getLiteral()); builder.append("\"^^"); owlLiteral.getDatatype().accept(this); } }
print("(instance " + getIndividualName(i1) + " (= " + dpName + " " + i2.parseDouble() + ") " + d + " )"); else if (i2.isInteger()) print("(instance " + getIndividualName(i1) + " (= " + dpName + " " + i2.parseInteger() + ") " + d + " )"); else print("(instance " + getIndividualName(i1) + " (= " + dpName + " " + i2.parseFloat() + ") " + d + " )");
public void visit(OWLLiteral owlLiteral) { if (owlLiteral.isBoolean()) { builder.append(Boolean.toString(owlLiteral.parseBoolean())); } else if (owlLiteral.isDouble()) { builder.append(owlLiteral.parseDouble()); } else if (owlLiteral.isFloat()) { builder.append(owlLiteral.parseFloat()); } else if (owlLiteral.isInteger()) { builder.append(owlLiteral.parseInteger()); } else { builder.append("\""); builder.append(owlLiteral.getLiteral()); builder.append("\"^^"); owlLiteral.getDatatype().accept(this); } }
/** * Builder initialized from an existing object. * * @param expected the existing object * @param df data factory */ public BuilderLiteral(OWLLiteral expected, OWLDataFactory df) { this(df); if (expected.hasLang()) { withLanguage(expected.getLang()); } else { withDatatype(expected.getDatatype()); } if (expected.isBoolean()) { withValue(expected.parseBoolean()); } else if (expected.isDouble()) { withValue(expected.parseDouble()); } else if (expected.isFloat()) { withValue(expected.parseFloat()); } else if (expected.isInteger()) { withValue(expected.parseInteger()); } else { withLiteralForm(expected.getLiteral()); } }
/** * Builder initialized from an existing object. * * @param expected the existing object * @param df data factory */ public BuilderLiteral(OWLLiteral expected, OWLDataFactory df) { this(df); if (expected.hasLang()) { withLanguage(expected.getLang()); } else { withDatatype(expected.getDatatype()); } if (expected.isBoolean()) { withValue(expected.parseBoolean()); } else if (expected.isDouble()) { withValue(expected.parseDouble()); } else if (expected.isFloat()) { withValue(expected.parseFloat()); } else if (expected.isInteger()) { withValue(expected.parseInteger()); } else { withLiteralForm(expected.getLiteral()); } }
/** * Builder initialized from an existing object. * * @param expected the existing object * @param df data factory */ public BuilderLiteral(OWLLiteral expected, OWLDataFactory df) { this(df); if (expected.hasLang()) { withLanguage(expected.getLang()); } else { withDatatype(expected.getDatatype()); } if (expected.isBoolean()) { withValue(expected.parseBoolean()); } else if (expected.isDouble()) { withValue(expected.parseDouble()); } else if (expected.isFloat()) { withValue(expected.parseFloat()); } else if (expected.isInteger()) { withValue(expected.parseInteger()); } else { withLiteralForm(expected.getLiteral()); } }
/** * Builder initialized from an existing object. * * @param expected * the existing object * @param df * data factory */ public BuilderLiteral(OWLLiteral expected, OWLDataFactory df) { this(df); if (expected.hasLang()) { withLanguage(expected.getLang()); } else { withDatatype(expected.getDatatype()); } if (expected.isBoolean()) { withValue(expected.parseBoolean()); } else if (expected.isDouble()) { withValue(expected.parseDouble()); } else if (expected.isFloat()) { withValue(expected.parseFloat()); } else if (expected.isInteger()) { withValue(expected.parseInteger()); } else { withLiteralForm(expected.getLiteral()); } }
assertTrue(0 == myRandomFunction._callCountFloat); assertTrue(myRandomFunction._object.toString().equals(Integer.toString(literal.parseInteger())));
assertTrue(0 == myRandomFunction._callCountFloat); assertTrue(myRandomFunction._object.toString().equals(Integer.toString(literal.parseInteger())));