/** * @param arg double value * @return builder */ public BuilderFacetRestriction withLiteral(double arg) { literal = df.getOWLLiteral(arg); return this; }
/** * @param arg int value * @return builder */ public BuilderFacetRestriction withLiteral(int arg) { literal = df.getOWLLiteral(arg); return this; }
/** * @param arg float value * @return builder */ public BuilderFacetRestriction withLiteral(float arg) { literal = df.getOWLLiteral(arg); return this; }
@Override public OWLLiteral formatDate(Date date, OWLDataFactory dataFactory) { String format = df.format(date); return dataFactory.getOWLLiteral(format, OWL2Datatype.XSD_DATE_TIME); } }
@Override public OWLLiteral formatDate(Date date, OWLDataFactory dataFactory) { return dataFactory.getOWLLiteral(Long.toString(date.getTime()), OWL2Datatype.XSD_LONG); } }
public Optional<OWLLiteral> parse(String value, OWLDataFactory dataFactory) { String normalisedValue = normalisation.apply(value); if(pattern.matcher(normalisedValue).matches()) { return Optional.of(dataFactory.getOWLLiteral(normalisedValue, datatype)); } else { return Optional.absent(); } } }
@Override public Optional<OWLAnnotationValue> getAnnotationValue(OWLDataFactory dataFactory) { Optional<String> userName = userNameProvider.getUserName(); if(userName.isPresent()) { return Optional.of(dataFactory.getOWLLiteral(userName.get())); } else { return Optional.empty(); } } }
private OWLLiteral process(OWLDataPropertyExpression prop, OWLLiteral con) { OWLDatatype dt = map.get(prop); if (dt == null) { return con; } return df.getOWLLiteral(con.getLiteral(), dt); }
private OWLLiteral parse(String value, LiteralParser ... parsers) { for(LiteralParser parser : parsers) { Optional<OWLLiteral> lit = parser.parse(value, dataFactory); if(lit.isPresent()) { return lit.get(); } } return dataFactory.getOWLLiteral(value, ""); }
/** * Shorthand for * {@code getOWLAnnotation(getRDFSComment(), getOWLLiteral(value))} * * @param value The annotation value. * @return an rdfs:comment annotation with provided value */ default OWLAnnotation getRDFSComment(String value) { return getOWLAnnotation(getRDFSComment(), getOWLLiteral(value)); }
private static OWLLiteral getLabellingLiteral(String suppliedName, Optional<String> langTag, EntityCrudContext context) { OWLDataFactory dataFactory = context.getDataFactory(); DictionaryLanguage dictionaryLanguage = context.getDictionaryLanguage(); return dataFactory.getOWLLiteral(suppliedName, langTag.orElse(dictionaryLanguage.getLang())); }
private OWLAnnotation getSynonymTypeAnnotation(Matcher matcher) { OWLDataFactory df = getDataFactory(); String synonymType = matcher.group(SYNONYM_TYPE_GROUP); return df.getOWLAnnotation(df.getOWLAnnotationProperty(SYNONYM_TYPE_IRI), df.getOWLLiteral(synonymType)); } }
@Override public OWLLiteral visit(OWLLiteral node) { OWLLiteral l = replacementLiterals.get(node); if (l != null) { return l; } if (node.hasLang()) { return df.getOWLLiteral(node.getLiteral(), node.getLang()); } return df.getOWLLiteral(node.getLiteral(), t(node.getDatatype())); }
@Override public OWLLiteral visit(OWLLiteral node) { if (node.hasLang()) { return df.getOWLLiteral(node.getLiteral(), node.getLang()); } return df.getOWLLiteral(node.getLiteral(), get(node.getDatatype())); }
@Override public void visit(OWLLiteral node) { if (node.hasLang()) { obj = df.getOWLLiteral(node.getLiteral(), node.getLang()); } else { obj = df.getOWLLiteral(node.getLiteral(), dup(node.getDatatype())); } }
@Override public void handleTriple(IRI s, IRI p, IRI o) { consume(s, p, o); addR(s, false); // Patch to new OWL syntax consumer.addTriple(s, OWL_HAS_SELF.getIRI(), df.getOWLLiteral(true)); } }
private OWLAnnotation generateLabelAnnotation(String label) { OWLDataFactory df = mngr.getOWLDataFactory(); OWLAnnotationProperty aProp = getPreferredLabel(); String lang = getPreferredLanguage(); OWLLiteral value = df.getOWLLiteral(label, lang); return df.getOWLAnnotation(aProp, value); }
private List<? extends OWLOntologyChange> createLabel(OWLEntity owlEntity, String value) { LabelDescriptor descr = getLabelDescriptor(); IRI iri = descr.getIRI(); String lang = descr.getLanguage(); OWLDataFactory df = mngr.getOWLDataFactory(); OWLLiteral con = df.getOWLLiteral(value, lang); OWLAnnotationProperty prop = df.getOWLAnnotationProperty(iri); OWLAxiom ax = df.getOWLAnnotationAssertionAxiom(prop, owlEntity.getIRI(), con); return Collections.singletonList(new AddAxiom(mngr.getActiveOntology(), ax)); }
@Override public void handle(String currentId, String value, String qualifierBlock, String comment) { OWLDataFactory df = getDataFactory(); OWLAnnotationProperty deprecatedProperty = df.getOWLDeprecated(); OWLLiteral annotationValue = df.getOWLLiteral(true); IRI subject = getIRIFromOBOId(currentId); OWLAnnotationAssertionAxiom ax = df .getOWLAnnotationAssertionAxiom(deprecatedProperty, subject, annotationValue); applyChange(new AddAxiom(getOntology(), ax)); } }
@Override public void visit(OWLObjectHasSelf ce) { translateAnonymousNode(ce); addTriple(ce, RDF_TYPE.getIRI(), OWL_RESTRICTION.getIRI()); addTriple(ce, OWL_ON_PROPERTY.getIRI(), ce.getProperty()); addTriple(ce, OWL_HAS_SELF.getIRI(), manager.getOWLDataFactory().getOWLLiteral(true)); }