private Term getTermForLiteralOrIri(Value v) throws OntopUnsupportedInputQueryException { if (v instanceof Literal) return getTermForLiteral((Literal) v); else if (v instanceof IRI) return getTermForIri((IRI)v, false); throw new OntopUnsupportedInputQueryException("The value " + v + " is not supported yet!"); }
@Override public GraphSPARQLQuery createGraphQuery(String queryString) throws OntopInvalidInputQueryException, OntopUnsupportedInputQueryException { ParsedQuery parsedQuery = parseQueryString(queryString); if (parsedQuery instanceof ParsedGraphQuery) return SPARQLQueryUtility.isConstructQuery(queryString) ? rdf4jFactory.createConstructQuery(queryString, parsedQuery) : rdf4jFactory.createDescribeQuery(queryString, parsedQuery); else throw new OntopUnsupportedInputQueryException("Unsupported query: " + queryString); }
/** * Calls the necessary tuple or graph query execution Implements describe * uri or var logic Returns the result set for the given query */ @Override public <R extends OBDAResultSet> R execute(InputQuery<R> inputQuery) throws OntopConnectionException, OntopReformulationException, OntopQueryEvaluationException, OntopResultConversionException { if (inputQuery instanceof SelectQuery) { return (R) executeInThread((SelectQuery) inputQuery, this::executeSelectQuery); } else if (inputQuery instanceof AskQuery) { return (R) executeInThread((AskQuery) inputQuery, this::executeBooleanQuery); } else if (inputQuery instanceof ConstructQuery) { return (R) executeInThread((ConstructQuery) inputQuery, this::executeConstructQuery); } else if (inputQuery instanceof DescribeQuery) { return (R) executeDescribeQuery((DescribeQuery) inputQuery); } else { throw new OntopUnsupportedInputQueryException("Unsupported query type: " + inputQuery); } }
@Override public SPARQLQuery createSPARQLQuery(String queryString) throws OntopInvalidInputQueryException, OntopUnsupportedInputQueryException { ParsedQuery parsedQuery = parseQueryString(queryString); if (parsedQuery instanceof ParsedTupleQuery) return rdf4jFactory.createSelectQuery(queryString, parsedQuery); else if (parsedQuery instanceof ParsedBooleanQuery) return rdf4jFactory.createAskQuery(queryString, parsedQuery); else if (parsedQuery instanceof ParsedGraphQuery) return SPARQLQueryUtility.isConstructQuery(queryString) ? rdf4jFactory.createConstructQuery(queryString, parsedQuery) : rdf4jFactory.createDescribeQuery(queryString, parsedQuery); else throw new OntopUnsupportedInputQueryException("Unsupported query: " + queryString); }
private Term getTermForLiteral(Literal literal) throws OntopUnsupportedInputQueryException { IRI typeURI = literal.getDatatype(); String value = literal.getLabel(); Optional<String> lang = literal.getLanguage(); if (lang.isPresent()) { // TODO: use a string lexical type instead return termFactory.getTypedTerm(termFactory.getConstantLiteral(value, typeFactory.getXsdStringDatatype()), lang.get()); } else { RDFDatatype type; /* * default data type is xsd:string */ if (typeURI == null) { type = typeFactory.getXsdStringDatatype(); } else { type = typeFactory.getDatatype(rdfFactory.createIRI(typeURI.stringValue())); } if (type == null) // ROMAN (27 June 2016): type1 in open-eq-05 test would not be supported in OWL // the actual value is LOST here return termFactory.getUriTemplateForDatatype(typeURI.stringValue()); // old strict version: // throw new RuntimeException("Unsupported datatype: " + typeURI); // check if the value is (lexically) correct for the specified datatype if (!XMLDatatypeUtil.isValidValue(value, typeURI)) throw new OntopUnsupportedInputQueryException("Invalid lexical form for datatype. Found: " + value); Term constant = termFactory.getConstantLiteral(value, type); return termFactory.getTypedTerm(constant, type); } }
ValueExpr expression = c.getExpr(); if (!(expression instanceof Var)) throw new OntopUnsupportedInputQueryException("Error translating ORDER BY. " + "The current implementation can only sort by variables. " + "This query has a more complex expression '" + expression + "'"); throw new OntopUnsupportedInputQueryException("GROUP BY is not supported yet"); throw new OntopUnsupportedInputQueryException("Not supported: " + node);
return getTermForIri((IRI)v, true); throw new OntopUnsupportedInputQueryException("The value " + v + " is not supported yet!"); throw new OntopUnsupportedInputQueryException("Function " + f.getURI() + " is not supported yet!"); throw new OntopUnsupportedInputQueryException("The expression " + expr + " is not supported yet!");
throw new OntopUnsupportedInputQueryException("Unsupported query syntax"); atom = atomFactory.getMutableTripleAtom(sTerm, pTerm, oTerm); throw new OntopUnsupportedInputQueryException("Unsupported query syntax");