-
Notifications
You must be signed in to change notification settings - Fork 4
Bugs
Parser gets screwed on text content that looks remotely like URL
This very simple query
let $x := <id>zebi:col2</id> return $x
gives syntax error
line 1:18 mismatched input ':' expecting ENDELM
line 1:29 no viable alternative at input 'return'
This simplified variant runs without a hitch.
let $x := <id>zebi</id> return $x
But it's a valid xquery (does not even include xsparql)
https://github.com/semantalytics/xsparql/issues/5
If a xsparql triple has a fragment including this URL
`glei:{$f/clei:Originator/text()}`
and the clei:Originator element is missing in a paricular XML instance, xsparql creates a URI containing only the prefix glei:.
https://github.com/semantalytics/xsparql/issues/8 https://github.com/semantalytics/xsparql/issues/7
this function:
declare function local:rdf_groups ($url as xs:string, $study) {
for $i in $study/clinical_results/baseline/group_list/group
let $gr := fn:concat($url, "/group/", $i/@group_id/substring(.,2))
# first char of @group_id is B=baseline, O=outcome, P=period, etc.
# But the description is the same, so we identify them by the remaining numeric index
construct {
<{$url}> cto:group <{$gr}>.
$gr a cto:Group;
dc:title {$i/title/text()};
dc:description {$i/description/text()}.
}
};
causes this error at the second line:
line 417:9 no viable alternative at input 'in'
line 417:56 no viable alternative at input 'group'
Parse error: java.lang.Exception: Errors for Parser. Translation aborted.
java.lang.Exception: Errors for Parser. Translation aborted.
at net.sf.xsparql.rewriter.XSPARQLProcessor.process(XSPARQLProcessor.java:232)
at net.sf.xsparql.Main.rewriteQuery(Main.java:197)
at net.sf.xsparql.Main.main(Main.java:111)
Workaround: change it to this ugly longhand:
for $i in $study/clinical_results/baseline/group_list/*[name()="group"]
https://github.com/semantalytics/xsparql/issues/14
Consider this script:
declare option saxon:output "method=text";
let $xml :=
<LOUFile>
<DownloadURL>ftp://ftp.gmeiutility.org/20161121T025453.zip</DownloadURL>
<ContentDate>2016-11-21T02:54:53.885Z</ContentDate>
<Originator>EVK05KS7XY1DEII3R011</Originator>
<RecordCount>229212</RecordCount>
<ManagingLOUCount managingLOU="EVK05KS7XY1DEII3R011">229212</ManagingLOUCount>
<SchemaValid>true</SchemaValid>
</LOUFile>
return $xml/DownloadURL
If I run it through xquery (saxon "query") it returns ftp://ftp.gmeiutility.org/20161121T025453.zip as expected
If I run it through xsparql, I get this error:
line 4:18 mismatched input ':' expecting ENDELM
line 4:74 no viable alternative at input '\r\n '
Parse error: java.lang.Exception: Errors for Parser. Translation aborted.
java.lang.Exception: Errors for Parser. Translation aborted.
at net.sf.xsparql.rewriter.XSPARQLProcessor.process(XSPARQLProcessor.java:232)
at net.sf.xsparql.Main.rewriteQuery(Main.java:197)
at net.sf.xsparql.Main.main(Main.java:111)
Even if I remove the first two elements that include :, I still get this error:
line 5:15 extraneous input '229212' expecting ENDELM
line 6:55 extraneous input '229212' expecting ENDELM
line 7:15 extraneous input 'true' expecting ENDELM
Parse error: java.lang.Exception: Errors for Parser. Translation aborted.
java.lang.Exception: Errors for Parser. Translation aborted.
at net.sf.xsparql.rewriter.XSPARQLProcessor.process(XSPARQLProcessor.java:232)
at net.sf.xsparql.Main.rewriteQuery(Main.java:197)
at net.sf.xsparql.Main.main(Main.java:111)
https://github.com/semantalytics/xsparql/issues/10
This function causes an error
declare function local:rdf_outcome_small ($url as xs:string, $study) {
if (not(fn:empty ($study/clinical_results/outcome_list))) then ()
else for $i at $n in $study/(primary_outcome|secondary_outcome|other_outcome) ###
let $outcome := fn:concat($url,"/outcome/",$n)
construct {
<{$url}> cto:outcome <{$outcome}>.
<{$outcome}> a cto:Outcome;
dc:type {functx:capitalize-first(fn:substring-before($i/name(),"_outcome"))};
dc:title {$i/measure/text()};
cto:timeFrame {$i/time_frame/text()};
cto:safetyIssue {func:boolean($i/safety_issue/text())};
dc:description {$i/description/text()}.
}
};
This works ok:
($study/primary_outcome, $study/secondary_outcome, $study/other_outcome)