Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when parsing SPARQL update with multiple expressions one of hich has SERVICE #2013

Closed
damyan-ognyanov opened this issue Mar 18, 2020 · 0 comments · Fixed by #2014
Assignees
Labels
🐞 bug issue is a bug
Milestone

Comments

@damyan-ognyanov
Copy link
Contributor

damyan-ognyanov commented Mar 18, 2020

If a SPARQL update have multiple update expressions (delimited with ';') and one of those have SERVICE, a NullPointerException is thrown during parsing.

for instance:

PREFIX family: <http://examples.ontotext.com/family#>
DROP ALL ;
INSERT {
    family:Alice family:knows family:Bob .
}
WHERE {
    SERVICE <repository:1> {
        family:Alice family:knows family:Bob .
    }
}

we got:

java.lang.NullPointerException: null
        at org.eclipse.rdf4j.query.parser.sparql.ast.ASTServiceGraphPattern.getPatternString(ASTServiceGraphPattern.java:67)
        at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1079)
        at org.eclipse.rdf4j.query.parser.sparql.ast.ASTServiceGraphPattern.jjtAccept(ASTServiceGraphPattern.java:43)
        at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1046)
        at org.eclipse.rdf4j.query.parser.sparql.ast.ASTGraphPatternGroup.jjtAccept(ASTGraphPatternGroup.java:24)
        at org.eclipse.rdf4j.query.parser.sparql.ast.SimpleNode.childrenAccept(SimpleNode.java:152)
        at org.eclipse.rdf4j.query.parser.sparql.AbstractASTVisitor.visit(AbstractASTVisitor.java:730)
        at org.eclipse.rdf4j.query.parser.sparql.ast.ASTWhereClause.jjtAccept(ASTWhereClause.java:24)
        at org.eclipse.rdf4j.query.parser.sparql.UpdateExprBuilder.visit(UpdateExprBuilder.java:298)
        at org.eclipse.rdf4j.query.parser.sparql.UpdateExprBuilder.visit(UpdateExprBuilder.java:66)
        at org.eclipse.rdf4j.query.parser.sparql.ast.ASTModify.jjtAccept(ASTModify.java:25)
        at org.eclipse.rdf4j.query.parser.sparql.SPARQLParser.parseUpdate(SPARQLParser.java:118)
        at org.eclipse.rdf4j.query.parser.QueryParserUtil.parseUpdate(QueryParserUtil.java:76)
@damyan-ognyanov damyan-ognyanov added the 🐞 bug issue is a bug label Mar 18, 2020
damyan-ognyanov added a commit that referenced this issue Mar 18, 2020
…dds a test case reproducing the NPE

Signed-off-by: damyan.ognyanov <damyan.ognyanov@ontotext.com>
@abrokenjester abrokenjester added this to the 3.1.3 milestone Mar 19, 2020
damyan-ognyanov added a commit that referenced this issue Mar 20, 2020
…test case

Signed-off-by: damyan.ognyanov <damyan.ognyanov@ontotext.com>
abrokenjester added a commit that referenced this issue Mar 20, 2020
…date-expressions

Fixes GH-2013 by traversing parents until sourceString is found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug issue is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants