@Override protected boolean accept(BindingSet bindingSet) { Value context = bindingSet.getValue("context"); return bindingSet.getValue("subject") instanceof Resource && bindingSet.getValue("predicate") instanceof IRI && bindingSet.getValue("object") instanceof Value && (context == null || context instanceof Resource); } };
@Override protected boolean accept(BindingSet bindingSet) { Value context = bindingSet.getValue("context"); return bindingSet.getValue("subject") instanceof Resource && bindingSet.getValue("predicate") instanceof IRI && bindingSet.getValue("object") instanceof Value && (context == null || context instanceof Resource); } };
@Override protected boolean accept(BindingSet bindingSet) { Value context = bindingSet.getValue("context"); return bindingSet.getValue("subject") instanceof Resource && bindingSet.getValue("predicate") instanceof IRI && bindingSet.getValue("object") instanceof Value && (context == null || context instanceof Resource); } };
@Override protected Resource convert(BindingSet bindings) throws QueryEvaluationException { return (Resource)bindings.getValue("_"); } }) {
@Override protected Statement convert(BindingSet b) throws QueryEvaluationException { Resource s = subj == null ? (Resource)b.getValue("s") : subj; IRI p = pred == null ? (IRI)b.getValue("p") : pred; Value o = obj == null ? b.getValue("o") : obj; Resource ctx = (Resource)b.getValue("ctx"); return SimpleValueFactory.getInstance().createStatement(s, p, o, ctx); }
@Override protected Statement convert(BindingSet b) throws QueryEvaluationException { Resource s = subj == null ? (Resource)b.getValue("s") : subj; IRI p = pred == null ? (IRI)b.getValue("p") : pred; Value o = obj == null ? b.getValue("o") : obj; Resource ctx = (Resource)b.getValue("ctx"); return SimpleValueFactory.getInstance().createStatement(s, p, o, ctx); }
@Override protected Statement convert(BindingSet b) throws QueryEvaluationException { Resource s = subj == null ? (Resource)b.getValue("s") : subj; IRI p = pred == null ? (IRI)b.getValue("p") : pred; Value o = obj == null ? b.getValue("o") : obj; Resource ctx = (Resource)b.getValue("ctx"); return SimpleValueFactory.getInstance().createStatement(s, p, o, ctx); }
public Tuple(BindingSet bindingset) { bindingset .getBindingNames() .stream() .sorted() .forEach(name -> line.add(bindingset.getValue(name))); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnegative public int count() { return query(QueryAndParameters::getCountSparql, result -> Integer.parseInt(result.next().getValue(QUERY_COUNT_HOLDER).stringValue()), result -> String.format("%d", result)); }
@Override public Term next() throws IteratorException { try { return utils.valueToTerm(this.it.next().getValue(value)); } catch (QueryEvaluationException e) { if (RDF4jStore.LOGGER.isErrorEnabled()) { RDF4jStore.LOGGER.error("Error during iteration", e); } throw new IteratorException(e); } }
@Override public Predicate next() throws IteratorException { try { return utils.valueToPredicate(this.it.next().getValue("p")); } catch (QueryEvaluationException e) { if (RDF4jStore.LOGGER.isErrorEnabled()) { RDF4jStore.LOGGER.error("Error during iteration", e); } throw new IteratorException(e); } }
protected boolean isUnbound(Var var, BindingSet bindings) { if (var == null) { return false; } else { return bindings.hasBinding(var.getName()) && bindings.getValue(var.getName()) == null; } }
public void handleSolution(BindingSet bs) throws TupleQueryResultHandlerException { try { conn.remove(ThreadVars.valueFactory.get().createStatement( (BNode) bs.getValue("s"), (IRI) bs.getValue("p"), bs.getValue("o"))); } catch (RepositoryException e) { throw new TupleQueryResultHandlerException("failed to remove " + bs, e); } count++; }
protected boolean isUnbound(Var var, BindingSet bindings) { if (var == null) { return false; } else { return bindings.hasBinding(var.getName()) && bindings.getValue(var.getName()) == null; } }
protected Value getVarValue(Var var, BindingSet bindings) { if (var == null) { return null; } else if (var.hasValue()) { return var.getValue(); } else { return bindings.getValue(var.getName()); } }
public Value evaluate(Var var, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException { Value value = var.getValue(); if (value == null) { value = bindings.getValue(var.getName()); } if (value == null) { throw new ValueExprEvaluationException(); } return value; }
@SuppressWarnings("unused") private List<OntologyNode> getSubclasses(String nodeUri) throws QueryEvaluationException, RepositoryException, MalformedQueryException { List<OntologyNode> result = new ArrayList<>(); TupleQueryResult queryResult = getQueryResult(QueryBuilder.getSubclasses(nodeUri)); while (queryResult.hasNext()) { BindingSet bindingSet = queryResult.next(); Value valueOfX = bindingSet.getValue("s"); result.add(makeNode(valueOfX.stringValue(), NodeType.CLASS)); } return result; }
private List<OntologyNode> getClasses() throws QueryEvaluationException, RepositoryException, MalformedQueryException { TupleQueryResult result = getQueryResult(QueryBuilder.getClasses()); List<OntologyNode> classNodes = new ArrayList<>(); while (result.hasNext()) { BindingSet bindingSet = result.next(); Value valueOfX = bindingSet.getValue("result"); classNodes.add(makeNode(valueOfX.stringValue(), NodeType.CLASS)); } return BackgroundKnowledgeFilter.classFilter(classNodes, true); }
@Override public void meet(Var var) { if (!var.hasValue() && bindings.hasBinding(var.getName())) { Value value = bindings.getValue(var.getName()); var.setValue(value); } } }