Re: A question about regex and compare operator

* xingwanghan <xingwanghan@tju.edu.cn> [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

(eric@w3.org)
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.

Received on Sunday, 27 December 2015 07:34:10 UTC