use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class JSONMaker method finishPair.
@Override
public void finishPair(long currLine, long currCol) {
if (value == null)
throw new InternalErrorException("null for 'value' (bad finishPair() allignment)");
String k = keys.pop();
JsonObject obj = objects.peek();
if (obj.hasKey(k))
Log.warn("JSON", "Duplicate key '" + k + "' for object [" + currLine + "," + currCol + "]");
obj.put(k, value);
value = null;
}
use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class JsonLDReader method createNode.
private Node createNode(Map<String, Object> map) {
String type = (String) map.get("type");
String lex = (String) map.get("value");
if (type.equals(IRI))
return createURI(lex);
else if (type.equals(BLANK_NODE))
return createBlankNode(lex);
else if (type.equals(LITERAL)) {
String lang = (String) map.get("language");
String datatype = (String) map.get("datatype");
if (Objects.equals(xsdString, datatype))
// In RDF 1.1, simple literals and xsd:string are the same.
// During migration, we prefer simple literals to xsd:strings.
datatype = null;
if (lang == null && datatype == null)
return profile.createStringLiteral(lex, -1, -1);
if (lang != null)
return profile.createLangLiteral(lex, lang, -1, -1);
RDFDatatype dt = NodeFactory.getType(datatype);
return profile.createTypedLiteral(lex, dt, -1, -1);
} else
throw new InternalErrorException("Node is not a IRI, bNode or a literal: " + type);
}
use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class MapWithScope method get.
/** Get a B object for an A object in scope S object */
public B get(S scope, A item) {
if (item == null)
throw new InternalErrorException("null in MapWithScope.get(,null)");
Map<A, B> map = scopePolicy.getScope(scope);
if (map == null)
// No map - no item->allocation tracking.
return allocator.alloc(scope, item);
B mappedItem = map.get(item);
if (mappedItem == null) {
mappedItem = allocator.alloc(scope, item);
map.put(item, mappedItem);
}
return mappedItem;
}
Aggregations