@Override @Nullable public Value getValue(String variableName) { try { final Constant constant = ontopBindingSet.getConstant(variableName); return constant == null? null: RDF4JHelper.getValue(constant); } catch (OntopResultConversionException e) { throw new RuntimeException(e); } }
@Override @Nullable public Value getValue(String bindingName) { if (!hasBinding(bindingName)) { return null; } else { try { final Constant constant = ontopBindingSet.getConstant(bindingName); return RDF4JHelper.getValue(constant); } catch (OntopResultConversionException e) { throw new RuntimeException(e); } } }
@Override public OWLNamedIndividual getOWLNamedIndividual(int column) throws OWLException { try { return (OWLNamedIndividual) translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
@Override public OWLLiteral getOWLLiteral(int column) throws OWLException { try { return (OWLLiteral) translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
@Override public OWLObject getOWLObject(String column) throws OWLException { try { return translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
@Override public OWLIndividual getOWLIndividual(int column) throws OWLException { try { return (OWLIndividual) translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
@Override public OWLObject getOWLObject(int column) throws OWLException { try { return translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
@Override public OWLIndividual getOWLIndividual(String column) throws OWLException { try { return (OWLIndividual) translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
@Override public OWLLiteral getOWLLiteral(String column) throws OWLException { try { return (OWLLiteral) translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
@Override public OWLPropertyAssertionObject getOWLPropertyAssertionObject(int column) throws OWLException { try { return translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e + " Column: " + column); } }
@Override public OWLAnonymousIndividual getOWLAnonymousIndividual(int column) throws OWLException { try { return (OWLAnonymousIndividual) translate(ontopBindingSet.getConstant(column)); } catch (Exception e) { throw new OntopOWLException(e); } }
while (resultSet.hasNext()) { final OntopBindingSet bindingSet = resultSet.next(); Constant constant = bindingSet.getConstant(1); if (constant instanceof IRIConstant) {
private Constant getConstant(ProjectionElem node, OntopBindingSet bindingSet) throws OntopResultConversionException, OntopConnectionException { Constant constant = null; String node_name = node.getSourceName(); ValueExpr ve = null; if (extMap != null) { ve = extMap.get(node_name); if (ve != null && ve instanceof Var) throw new OntopResultConversionException("Invalid query. Found unbound variable: " + ve); } // if (node_name.charAt(0) == '-') { if (ve instanceof org.eclipse.rdf4j.query.algebra.ValueConstant) { org.eclipse.rdf4j.query.algebra.ValueConstant vc = (org.eclipse.rdf4j.query.algebra.ValueConstant) ve; if (vc.getValue() instanceof IRI) { constant = termFactory.getConstantIRI(rdfFactory.createIRI(vc.getValue().stringValue())); } else if (vc.getValue() instanceof Literal) { constant = termFactory.getConstantLiteral(vc.getValue().stringValue()); } else { constant = termFactory.getConstantBNode(vc.getValue().stringValue()); } } else { constant = bindingSet.getConstant(node_name); } return constant; }