declare function local:rdf_milestones ($url as xs:string, $per as xs:string, $prop as xs:string, $elem as xs:string, $list) {
for $i at $n in $list/*[name()=$elem]
let $mil := fn:concat($per,"/",$prop,"/",$n)
construct {
<{$per}> cto:{$prop} <{$mil}>.
<{$mil}> a cto:Milestone;
dc:title {$i/title/text()}.
{
for $j at $m in $i/participants_list/participants
let $part := fn:concat($mil,"/participants/",$m)
construct {
<{$mil}> cto:participants <{$part}>.
<{$part}> a cto:ParticipantsCount.
<{$part}> cto:count {$j/@count/string()}. ####
<{$part}> cto:group <{fn:concat($url, "/group/", $j/@group_id/substring(.,2))}>.
}
}
}
};
Causes this error at the beginning of the function:
net/sf/xsparql/rewriter/XSPARQLRewriter.g: node from line 0:0 required (...)+ loop did not match anything at input 'T_FL
WOR'
net/sf/xsparql/rewriter/XSPARQLRewriter.g: node from line 374:15 mismatched tree node: in expecting T_QUERY_BODY
Parse error: java.lang.Exception: Errors for Rewriter. Translation aborted.
java.lang.Exception: Errors for Rewriter. Translation aborted.
at net.sf.xsparql.rewriter.XSPARQLProcessor.process(XSPARQLProcessor.java:240)
at net.sf.xsparql.Main.rewriteQuery(Main.java:197)
at net.sf.xsparql.Main.main(Main.java:111)
The reason is the line marked ####: the rewriter gets confused by the attribute name count which it mistakes for a SPARQL keyword.
Workaround: rewrite the line to this ugly long-hand:
The following function
Causes this error at the beginning of the function:
The reason is the line marked ####: the rewriter gets confused by the attribute name
count
which it mistakes for a SPARQL keyword.Workaround: rewrite the line to this ugly long-hand:
What business the rewriter has inside that XPath, I do not know. It's very worrisome that it looks for SPARQL keywords inside an XPath.
May I also complain that the error messages from the rewriter (and their locations) are completely cryptic and unhelpful.