Hi,
The following query worked on 4.3, but doesn’t in 5.0 beta.
construct where {
?registrering arkiv:parent ?parent.
?registrering a ?registreringType.
?parent a ?parentType.
OPTIONAL{?registrering <http://www.arkivverket.no/standarder/noark5/arkivstruktur/journalsekvensnummer> ?journalsekvensnummer.}
OPTIONAL{?registrering <http://www.arkivverket.no/standarder/noark5/arkivstruktur/journalaar> ?journalaar.}
OPTIONAL{?registrering <http://www.arkivverket.no/standarder/noark5/arkivstruktur/journalpostnummer> ?journalpostnummer.}
}
# Overrides by the API:
# PARAMETERS ( ?registrering ) {
# <http://example.com/base/journalpost--journalpost%3A200033--972417831--2016-03-04T18%3A28%3A45_UNDER_UNDER>
# }
Here is my java code:
stardogService.getStardogDatabase().connection(Reasoning.DISABLED, connection -> {
GraphQuery query = connection.graph(String.join("\n",
"construct where { ",
" ?registrering arkiv:parent ?parent. ",
" ?registrering a ?registreringType. ",
" ?parent a ?parentType. ",
" ",
" OPTIONAL{?registrering <" + Arkiv.journalsekvensnummer + "> ?journalsekvensnummer.} ",
" OPTIONAL{?registrering <" + Arkiv.journalaar + "> ?journalaar.} ",
" OPTIONAL{?registrering <" + Arkiv.journalpostnummer + "> ?journalpostnummer.} ",
" ",
"",
"}",
"")).parameter("registrering", registrering);
retConnection.add(query.execute());
});
Here is the error:
Caused by: com.complexible.stardog.plan.parser.QueryParseException: can not use shorthand CONSTRUCT: graph pattern in WHERE clause is not a basic pattern.
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan$2.defaultVisit(QueryParserImpl.java:2021)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan$2.visitJoin(QueryParserImpl.java:2004)
at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:85)
at com.complexible.stardog.plan.LoopJoinPlanNode.accept(LoopJoinPlanNode.java:54)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:2024)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:595)
at com.complexible.common.rdf.query.parser.sparql.ast.ASTConstruct.jjtAccept(ASTConstruct.java:19)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.query(QueryParserImpl.java:2196)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:1357)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:595)
at com.complexible.common.rdf.query.parser.sparql.ast.ASTConstructQuery.jjtAccept(ASTConstructQuery.java:19)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:1339)
at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:595)
at com.complexible.common.rdf.query.parser.sparql.ast.ASTQueryContainer.jjtAccept(ASTQueryContainer.java:21)
at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:464)
at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:444)
at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:87)
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:239)
at com.complexible.stardog.plan.eval.QueryEngine.executeGraph(QueryEngine.java:119)
at com.complexible.stardog.query.DefaultQueryFactory$GraphQuery.execute(DefaultQueryFactory.java:208)
at com.complexible.stardog.query.DefaultQueryFactory$GraphQuery.execute(DefaultQueryFactory.java:194)
at com.complexible.stardog.api.KernelDatabaseConnection$KernelGraphQuery.execute(KernelDatabaseConnection.java:782)
... 46 more