use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class ShaclTests method entry.
private static ShaclTestItem entry(String file, Resource entry) {
// System.out.println("T:"+entry.listProperties(RDF.type).mapWith(Statement::getObject).toList());
// System.out.println("E:"+entry.listProperties(MF.action).mapWith(Statement::getObject).toList());
// System.out.println("R:"+entry.listProperties(MF.result).mapWith(Statement::getObject).toList());
Resource type = entry.getRequiredProperty(RDF.type).getResource();
String sName = type.isResource() ? entry.getLocalName() : "[]";
String name = entry.hasProperty(RDFS.label) ? entry.getProperty(RDFS.label).getString() : sName;
if (type.equals(SHT.Validate)) {
return new ShaclTestItem(name, file, entry);
}
throw new InternalErrorException("Unexpected test type : " + type);
}
use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class ShapeEvalEachOf method partition.
private static List<List<Set<Triple>>> partition(Triple t, List<Set<Triple>> partial, List<TripleExpression> tripleExprs, // List<Set<Node>> exprIdxToPredicates,
ListMultimap<Node, Integer> predicateToTripleExprs) {
Node p = t.getPredicate();
// Places triple t can go.
List<Integer> places = predicateToTripleExprs.get(p);
if (places == null || places.isEmpty())
throw new InternalErrorException();
List<List<Set<Triple>>> result = new ArrayList<>();
for (int i : places) {
// Copy backbone.
List<Set<Triple>> partial2 = new ArrayList<>(partial);
// Clone slot.
Set<Triple> x = partial2.get(i);
Set<Triple> x2 = new HashSet<>(x);
// Add.
x2.add(t);
partial2.set(i, x2);
result.add(partial2);
}
return result;
}
use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class RDFLinkHTTP method updateExec.
private void updateExec(UpdateRequest update, String updateString) {
checkUpdate();
if (update == null && updateString == null)
throw new InternalErrorException("Both update request and update string are null");
UpdateRequest actual = null;
if (update == null) {
if (parseCheckUpdates)
actual = UpdateFactory.create(updateString);
}
// Use the update string as provided if possible, otherwise serialize the update.
String updateStringToSend = (updateString != null) ? updateString : update.toString();
createUExecBuilder().updateString(updateStringToSend).build().execute();
}
use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class RDFLinkHTTP method queryExec.
// Create the QExec
private QueryExec queryExec(Query query, String queryString, QueryType queryType) {
checkQuery();
if (query == null && queryString == null)
throw new InternalErrorException("Both query and query string are null");
if (query == null) {
if (parseCheckQueries)
// Don't retain the query.
QueryFactory.create(queryString);
}
// Use the query string as provided if possible, otherwise serialize the query.
String queryStringToSend = (queryString != null) ? queryString : query.toString();
return createQExec(query, queryStringToSend, queryType);
}
use of org.apache.jena.atlas.lib.InternalErrorException in project jena by apache.
the class ParserShExC method finishShapeNot.
protected void finishShapeNot(Inline inline, int idx, boolean negate) {
int x = front(shapeExprStack) - idx;
if (x > 1)
throw new InternalErrorException("Shape NOT - multiple items on the stack");
if (negate && !shapeExprStack.isEmpty()) {
ShapeExpression shExpr = pop(shapeExprStack);
ShapeExpression shExpr2 = new ShapeExprNOT(shExpr);
push(shapeExprStack, shExpr2);
}
finish(inline, "ShapeNot");
}
Aggregations