public boolean setEditedObject(OWLLiteral constant) { clear(); if (constant != null) { annotationContent.setText(constant.getLiteral()); if (!constant.isRDFPlainLiteral()) { datatypeComboBox.setSelectedItem(constant.getDatatype()); } else { langComboBox.setSelectedItem(constant.getLang()); } } return true; }
/** * @param literal the wrapped literal */ public RDFLiteral(OWLLiteral literal) { this(literal.getLiteral(), literal.getLang(), literal.getDatatype().getIRI()); }
@Override default int initHashCode() { int hash = hashIndex(); hash = OWLObject.hashIteration(hash, getDatatype().hashCode()); hash = OWLObject.hashIteration(hash, getLiteral().hashCode()); return OWLObject.hashIteration(hash, getLang().hashCode()); }
@Override public String toString() { return toStringHelper("LiteralPrimitive") .addValue(literal.getLiteral()) .addValue(literal.getDatatype()) .addValue(literal.getLang()) .toString(); }
private void addAxiom(OWLAnnotationAssertionAxiom ax) { OWLLiteral literal = (OWLLiteral) ax.getValue(); DictionaryLanguage lang = DictionaryLanguage.create(ax.getProperty().getIRI(), literal.getLang()); activeLangs.add(lang); }
/** * @param literal the wrapped literal */ public RDFLiteral(OWLLiteral literal) { this(literal.getLiteral(), literal.getLang(), literal.getDatatype().getIRI()); }
@Override default int initHashCode() { int hash = hashIndex(); hash = OWLObject.hashIteration(hash, getDatatype().hashCode()); hash = OWLObject.hashIteration(hash, getLiteral().hashCode()); return OWLObject.hashIteration(hash, getLang().hashCode()); }
public static boolean isAxiomForDictionary(@Nonnull OWLAnnotationAssertionAxiom ax, @Nonnull Dictionary dictionary) { if(!(ax.getSubject() instanceof IRI)) { return false; } if(!(ax.getValue() instanceof OWLLiteral)) { return false; } IRI iri = ax.getProperty().getIRI(); String lang = ((OWLLiteral) ax.getValue()).getLang(); return isDictionaryFor(dictionary, iri, lang); }
@Override public boolean matches(@Nonnull OWLLiteral literal) { return lexicalValueMatcher.matches(literal.getLiteral()) && languageTagMatcher.matches(literal.getLang()) && datatypeMatcher.matches(literal.getDatatype()); }
private ValueConstant getValueOfLiteral(OWLLiteral object) { if (!object.getLang().isEmpty()) { return termFactory.getConstantLiteral(object.getLiteral(), object.getLang()); } else { RDFDatatype type = typeFactory.getDatatype(rdfFactory.createIRI(object.getDatatype().getIRI().toString())); return termFactory.getConstantLiteral(object.getLiteral(), type); } }
@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())); }
private void removeAxiom(OWLAnnotationAssertionAxiom ax) { OWLLiteral literal = (OWLLiteral) ax.getValue(); DictionaryLanguage lang = DictionaryLanguage.create(ax.getProperty().getIRI(), literal.getLang()); activeLangs.remove(lang); }
@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 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 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 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) { writer.writeStartElement(LITERAL); if (node.hasLang()) { writer.writeLangAttribute(node.getLang()); } else if (!node.isRDFPlainLiteral() && !OWL2Datatype.XSD_STRING.matches(node.getDatatype())) { writer.writeDatatypeAttribute(node.getDatatype()); } writer.writeTextContent(node.getLiteral()); writer.writeEndElement(); }
@Override public void visit(OWLLiteral node) { write("\"").write(node.getLiteral()).write("\""); if (node.hasLang()) { write("@").write(node.getLang()); } else { write("^^").write(node.getDatatype().getIRI()); } }
@Override public void visit(OWLLiteral node) { writer.writeStartElement(LITERAL); if (node.hasLang()) { writer.writeLangAttribute(node.getLang()); } else if (!node.isRDFPlainLiteral() && !OWL2Datatype.XSD_STRING.matches(node.getDatatype())) { writer.writeDatatypeAttribute(node.getDatatype()); } writer.writeTextContent(node.getLiteral()); writer.writeEndElement(); }