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

rewriter doesn't allow union xpaths #10

Open
VladimirAlexiev opened this issue Dec 6, 2016 · 2 comments
Open

rewriter doesn't allow union xpaths #10

VladimirAlexiev opened this issue Dec 6, 2016 · 2 comments
Labels

Comments

@VladimirAlexiev
Copy link
Contributor

This function

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()}.
        }
};

causes this error

net/sf/xsparql/rewriter/XQuerySerializer.g: node from line 0:0 mismatched tree node: DOWN expecting <UP>
net/sf/xsparql/rewriter/XQuerySerializer.g: node from line 0:0 mismatched tree node: DOWN expecting <UP>
net/sf/xsparql/rewriter/XQuerySerializer.g: node from line 0:0 mismatched tree node: XPATH expecting <UP>
Parse error: java.lang.Exception: Errors for Serializer. Translation aborted.
java.lang.Exception: Errors for Serializer. Translation aborted.
        at net.sf.xsparql.rewriter.XSPARQLProcessor.process(XSPARQLProcessor.java:257)
        at net.sf.xsparql.Main.rewriteQuery(Main.java:197)
        at net.sf.xsparql.Main.main(Main.java:111)

(Both location and error message are totally useless, so god help you if you write in big chunks).

The culprit is the union xpath at ###. I'm no xpath expert, but according to http://www.freeformatter.com/xpath-tester.html that is valid.

(If I replace with $study/primary_outcome it goes ok, but I need the union!)

@VladimirAlexiev
Copy link
Contributor Author

This doesn't work either:

$study/(primary_outcome union secondary_outcome union other_outcome)

This works ok:

($study/primary_outcome, $study/secondary_outcome, $study/other_outcome)

@VladimirAlexiev
Copy link
Contributor Author

#39 is a duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants