Hi Dan,

I guess the problem is that the Turtle serialization uses its own escaping 
mechanism. So if you want to pass \\ to SPARQL you will likely need to escape 
it twice, using \\\\

Holger


> On 14 Sep 2023, at 8:23 pm, Dan Segal <[email protected]> wrote:
> 
> Hello,
> 
> I am trying to use a property value rule to infer a value from another 
> property.
> 
> The use case involves using REGEX to strip out certain strings and special 
> characters. 
> 
> The logic works OK with alphanumeric characters, but it returns an error on 
> special characters.
> 
> For example, the following statement works OK:
> 
> sh:values [
>       sh:select """ 
> 
>         SELECT ?value2
> 
>         WHERE {
> 
>             $this <http://www.example.org#property1> ?value1 .
> 
>         BIND (REPLACE (?value1, "foo" ,"") AS ?value2)
> 
>         }
> 
> """ ;
>     ];
> 
> However, the following statement, which is intended to remove the [ 
> character, returns an error:
> 
> sh:values [
>       sh:select """
> 
>         SELECT ?value2
> 
>         WHERE {
> 
>             $this <http://www.example.org#property1> ?value1 .
> 
>         BIND (REPLACE (?value1, "\\[" ,"") AS ?value2)
> 
>         }
> 
> """ ;
>     ];
> 
> 
> The escape characters \\ work OK in a SPARQL query.  However, in the property 
> value rule, they return the following error:
> 
>     (SHACL node expression of unknown type: 
> org.apache.jena.query.QueryParseException:... Encountered: '91' (91), after 
> prefix "\"\\")
> 
> 
> Is there a different way to indicate escape characters, so that REGEX can be 
> used in the BIND/REPLACE statement?
> 
> Thank you,
> 
> Dan Segal
> 
> 
> 
> 
> 
> -- 
> The topics of this mailing list include TopBraid EDG and related technologies 
> such as SHACL.
> To post to this group, send email to [email protected]
> --- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/efee929b-57a2-47a2-a1a1-0a577420278en%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/efee929b-57a2-47a2-a1a1-0a577420278en%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to [email protected]
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/9353F7F5-434E-4366-9CAB-688C20FF579E%40topquadrant.com.

Reply via email to