I'm trying to use complex XPath expressions as value of rml:reference, for example
rml:objectMap [
rml:reference "substring-before(path, '/')"
]
but this fails with the following exception:
javax.xml.xpath.XPathExpressionException: com.sun.org.apache.xpath.internal.XPathException: Can not convert #STRING to a NodeList!
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:100)
at burp.ls.XMLIteration.getValuesFor(XMLSource.java:90)
at burp.model.Reference.values(Reference.java:17)
at burp.model.ExpressionMap.generateLiterals(ExpressionMap.java:156)
at burp.model.ObjectMap.generateTerms(ObjectMap.java:26)
at burp.Main.generate(Main.java:157)
at burp.Main.doMain(Main.java:55)
at burp.Main.main(Main.java:42)
My understanding is that the expression in rml:reference is expected to return a node list (such as what element/subelement or element/text() returns (a text node in the latter case)), but functions such as substring-before return a string, which is a different beast in XPath.
I consider this as a bug: using XPath functions to generate values seems like a valid use-case, a more lightweight approach than FNML. Also I note that this is working with RMLMapper (but I'm trying to migrate to BURP to use the latest version of RML).
edited to fix some typos and clarify some points (this was sent too quickly)
I'm trying to use complex XPath expressions as value of
rml:reference, for examplebut this fails with the following exception:
javax.xml.xpath.XPathExpressionException: com.sun.org.apache.xpath.internal.XPathException: Can not convert #STRING to a NodeList!
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:100)
at burp.ls.XMLIteration.getValuesFor(XMLSource.java:90)
at burp.model.Reference.values(Reference.java:17)
at burp.model.ExpressionMap.generateLiterals(ExpressionMap.java:156)
at burp.model.ObjectMap.generateTerms(ObjectMap.java:26)
at burp.Main.generate(Main.java:157)
at burp.Main.doMain(Main.java:55)
at burp.Main.main(Main.java:42)
My understanding is that the expression in
rml:referenceis expected to return a node list (such as whatelement/subelementorelement/text()returns (a text node in the latter case)), but functions such assubstring-beforereturn a string, which is a different beast in XPath.I consider this as a bug: using XPath functions to generate values seems like a valid use-case, a more lightweight approach than FNML. Also I note that this is working with RMLMapper (but I'm trying to migrate to BURP to use the latest version of RML).
edited to fix some typos and clarify some points (this was sent too quickly)