This script is parsed ok:
declare function local:rdf_property ($property, $id as xs:string) {
let $propName := $property/name()
let $value := $property/text()
for $prop $dt where {
values ($propName1 $prop $dt ) {
("GF_Ausn" "xp:floorAreaExcluded" "xsd:decimal" )
("nutzungsform" "xp:formOfUse" undef )
}
filter ($propName1 = $propName)
}
construct {<{$id}> <{$prop}> {$value}} # ^^{$dt}
};
()
But if I replace undef with UNDEF, I get this error:
line 4:12 no viable alternative at input '$dt'
line 5:4 mismatched input 'values' expecting RCURLY
- The problem is that SPARQL is case-insensitive so
UNDEF should also be accepted
- Another problem is that the error message is totally unhelpful: the location is two levels up, and then some nodes away. I spent 2h debugging this (thinking that maybe it doesn't allow a second var in
for. The xsparql parser is terrible that way :-(
This script is parsed ok:
declare function local:rdf_property ($property, $id as xs:string) { let $propName := $property/name() let $value := $property/text() for $prop $dt where { values ($propName1 $prop $dt ) { ("GF_Ausn" "xp:floorAreaExcluded" "xsd:decimal" ) ("nutzungsform" "xp:formOfUse" undef ) } filter ($propName1 = $propName) } construct {<{$id}> <{$prop}> {$value}} # ^^{$dt} }; ()But if I replace
undefwithUNDEF, I get this error:UNDEFshould also be acceptedfor. The xsparql parser is terrible that way :-(