[ https://issues.apache.org/jira/browse/JENA-1367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16060718#comment-16060718 ]
ASF GitHub Bot commented on JENA-1367: -------------------------------------- GitHub user cygri opened a pull request: https://github.com/apache/jena/pull/266 JENA-1367: Improve apf:strSplit corner cases This is a patch to improve the behaviour of `apf:strSplit` in cases where it is invoked with inputs other than the obvious node types. The general syntax of the property function is: ?parts apf:strSplit (?input ?regex) The patch changes various cases that previously would have thrown `ExprEvalException` or `NotLiteralException`: - If `?input` is an unbound variable, return no match - If `?input` is an IRI or blank node, return no match - If `?regex` is not a literal, return no match - If `?parts` is a plain literal that equals one of the tokens of the parts of `?input`, return true (one match, no new variable bindings) - If `?parts` is anything else but not a variable, return no match - If the object is a list but does not have two elements, throw `QueryBuildException` The patch also adds fairly exhaustive tests for the function. The test class may still need to be hooked into the test suite in some way. You can merge this pull request into a Git repository by running: $ git pull https://github.com/cygri/jena JENA-1367 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/jena/pull/266.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #266 ---- commit 305a5b1846d0fbaf165f2a8c4423b3e2645222c1 Author: Richard Cyganiak <rich...@cyganiak.de> Date: 2017-06-23T10:44:51Z JENA-1367: Improve apf:strSplit corner cases ---- > Property function apf:strSplit is not well-behaved > -------------------------------------------------- > > Key: JENA-1367 > URL: https://issues.apache.org/jira/browse/JENA-1367 > Project: Apache Jena > Issue Type: Bug > Affects Versions: Jena 3.3.0 > Reporter: Richard Cyganiak > Priority: Minor > > The property function apf:strSplit is not well-behaved in cases where it's > invoked on node types other than the obvious case (subject is variable, > object is list of two literals). For example: > {code} > ?x apf:strSplit (?unbound "some regex") > {code} > Assuming {{?unbound}} is an unbound variable, this should simply not match, > but throws a {{NotLiteralException}}. > {code} > "foo" apf:strSplit ("foo;bar" ";") > {code} > This should presumably evaluate to true, but evaluates to false (the property > function itself throws ExprEvalException). -- This message was sent by Atlassian JIRA (v6.4.14#64029)