A question about regex and compare operator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A question about regex and compare operator

韩兴旺
Hi all:
I wander if regex or compare operator can accept an IRI as its argument according to sparql1.1 specification.
Thanks
来自我的华为手机
Reply | Threaded
Open this post in threaded view
|

Re: A question about regex and compare operator

Eric Prud'hommeaux
* xingwanghan <[hidden email]> [2015-12-27 03:47+0800]
> Hi all:
> I wander if regex or compare operator can accept an IRI as its argument according to sparql1.1 specification.

no, but you can always use STR to "cast" it to a literal:

sparql -d 'data:text/turtle,BASE <http://a.example/> <s> <p> <o1>, <o2>.' -e 'SELECT ?o { ?s ?p ?o FILTER (REGEX(STR(?o), "ample/o1$"))}'
+-----------------------+
| ?o                    |
| <http://a.example/o1> |
+-----------------------+

vs. without STR:

sparql -d 'data:text/turtle,BASE <http://a.example/> <s> <p> <o1>, <o2>.' -e 'SELECT ?o { ?s ?p ?o FILTER (REGEX(?o, "ample/o1$"))}'
+----+
| ?o |
+----+

> Thanks
> 来自我的华为手机

--
-ericP

office: +1.617.599.3509
mobile: +33.6.80.80.35.59

([hidden email])
Feel free to forward this message to any list for any purpose other than
email address distribution.

There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.