diff --git a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParser.java b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParser.java index 7edd9ce98..0c468b1f3 100644 --- a/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParser.java +++ b/jopa-impl/src/main/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParser.java @@ -100,6 +100,9 @@ public SparqlQueryHolder parseQuery(String query) { break; case '>': this.inUri = false; + if(inParam) { + parameterEnd(i); + } wordEnd(); break; case '\n': diff --git a/jopa-impl/src/test/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParserTest.java b/jopa-impl/src/test/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParserTest.java index 0518af6a9..78d6661aa 100644 --- a/jopa-impl/src/test/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParserTest.java +++ b/jopa-impl/src/test/java/cz/cvut/kbss/jopa/query/sparql/SparqlQueryParserTest.java @@ -442,4 +442,14 @@ void parseQueryHandlesMultilineProjection() { assertNotNull(holder.getParameter("y")); assertNotNull(holder.getParameter("z")); } + + @Test + void parseQueryHandlesAttributesWithinIris() { + final String query = "SELECT ?x WHERE { a ?z . }"; + final QueryHolder holder = queryParser.parseQuery(query); + assertEquals(3, holder.getParameters().size()); + assertNotNull(holder.getParameter("x")); + assertNotNull(holder.getParameter("y")); + assertNotNull(holder.getParameter("z")); + } }