Search in sources :

Example 26 with InternalErrorException

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);
}
Also used : Resource(org.apache.jena.rdf.model.Resource) InternalErrorException(org.apache.jena.atlas.lib.InternalErrorException)

Example 27 with InternalErrorException

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;
}
Also used : Node(org.apache.jena.graph.Node) InternalErrorException(org.apache.jena.atlas.lib.InternalErrorException) Triple(org.apache.jena.graph.Triple)

Example 28 with InternalErrorException

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();
}
Also used : UpdateRequest(org.apache.jena.update.UpdateRequest) InternalErrorException(org.apache.jena.atlas.lib.InternalErrorException)

Example 29 with InternalErrorException

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);
}
Also used : InternalErrorException(org.apache.jena.atlas.lib.InternalErrorException)

Example 30 with InternalErrorException

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");
}
Also used : InternalErrorException(org.apache.jena.atlas.lib.InternalErrorException)

Aggregations

InternalErrorException (org.apache.jena.atlas.lib.InternalErrorException)48 Node (org.apache.jena.graph.Node)14 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)4 AccessStep (org.apache.jena.dboe.trans.bplustree.AccessPath.AccessStep)3 Graph (org.apache.jena.graph.Graph)3 Triple (org.apache.jena.graph.Triple)3 Var (org.apache.jena.sparql.core.Var)3 StringReader (java.io.StringReader)2 DataAccessPoint (org.apache.jena.fuseki.server.DataAccessPoint)2 Dataset (org.apache.jena.query.Dataset)2 Model (org.apache.jena.rdf.model.Model)2 Lang (org.apache.jena.riot.Lang)2 RiotException (org.apache.jena.riot.RiotException)2 ARQInternalErrorException (org.apache.jena.sparql.ARQInternalErrorException)2 Table (org.apache.jena.sparql.algebra.Table)2 OpGraph (org.apache.jena.sparql.algebra.op.OpGraph)2 TableEmpty (org.apache.jena.sparql.algebra.table.TableEmpty)2 ExecutionContext (org.apache.jena.sparql.engine.ExecutionContext)2 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)2 Binding (org.apache.jena.sparql.engine.binding.Binding)2