use of com.bigdata.rdf.model.BigdataResource in project wikidata-query-rdf by wikimedia.
the class BigdataStatementToJenaStatementMapper method convertToJenaRDFNode.
/**
* Convert Bigdata value to Jena RDF Node.
*
* @return Jena RDF node.
*/
public RDFNode convertToJenaRDFNode(final BigdataValue v) {
if (v instanceof BigdataResource)
return convertToJenaResource((BigdataResource) v);
if (!(v instanceof BigdataLiteral))
throw new IllegalArgumentException(v.getClass().getName());
final BigdataLiteral l = (BigdataLiteral) v;
final String lex = l.getLabel();
final URI datatypeURI = l.getDatatype();
final String languageTag = l.getLanguage();
if (datatypeURI != null) {
final RDFDatatype dt = JENA_TYPE_MAPPER.getSafeTypeByName(datatypeURI.stringValue());
return ResourceFactory.createTypedLiteral(lex, dt);
} else if (languageTag != null) {
return ResourceFactory.createLangLiteral(lex, languageTag);
} else {
return ResourceFactory.createPlainLiteral(lex);
}
}
Aggregations