Search in sources :

Example 6 with NoConvertorException

use of org.apache.clerezza.rdf.core.NoConvertorException in project stanbol by apache.

the class RdfRepresentation method addTypedLiteral.

private void addTypedLiteral(IRI field, Object literalValue) {
    Literal literal;
    try {
        literal = RdfResourceUtils.createLiteral(literalValue);
    } catch (NoConvertorException e) {
        log.info("No Converter for value type " + literalValue.getClass() + " (parsed for field " + field + ") use toString() to get String representation");
        literal = RdfResourceUtils.createLiteral(literalValue.toString(), null);
    }
    graphNode.addProperty(field, literal);
}
Also used : Literal(org.apache.clerezza.commons.rdf.Literal) NoConvertorException(org.apache.clerezza.rdf.core.NoConvertorException)

Aggregations

NoConvertorException (org.apache.clerezza.rdf.core.NoConvertorException)6 Literal (org.apache.clerezza.commons.rdf.Literal)4 PlainLiteralImpl (org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl)4 IRI (org.apache.clerezza.commons.rdf.IRI)3 TripleImpl (org.apache.clerezza.commons.rdf.impl.utils.TripleImpl)3 IOException (java.io.IOException)2 SOAPException (javax.xml.soap.SOAPException)2 Graph (org.apache.clerezza.commons.rdf.Graph)2 Language (org.apache.clerezza.commons.rdf.Language)2 LiteralFactory (org.apache.clerezza.rdf.core.LiteralFactory)2 Blob (org.apache.stanbol.enhancer.servicesapi.Blob)2 EngineException (org.apache.stanbol.enhancer.servicesapi.EngineException)2 InvalidContentException (org.apache.stanbol.enhancer.servicesapi.InvalidContentException)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Collection (java.util.Collection)1 Date (java.util.Date)1 BlankNodeOrIRI (org.apache.clerezza.commons.rdf.BlankNodeOrIRI)1 RDFTerm (org.apache.clerezza.commons.rdf.RDFTerm)1 TypedLiteralImpl (org.apache.clerezza.commons.rdf.impl.utils.TypedLiteralImpl)1