Feel free to ask :)
> I'm trying to filter some triples based on a regex on their URI
> With the rdflib memory store, I've got strange results, and with the rdflib
> one no result at all:
For one I would search by writing
regex (?s,"^http://rdfs.org/sioc/ns","i")
(mind the additional ^ here). However your regex might be correct, I am not
sure.
I can reproduce your results for librdf. I don't get any hits, too. However
for rdflib I get the following:
>>> query = select("?s").where(("?s",a,ns.OWL.Class)).filter('(regex
(?s,"^http://rdfs.org/sioc/ns","i"))')
>>> store.execute_sparql(unicode(query))
DEBUG:ReaderPlugin:SELECT ?s WHERE { ?s <http://www.w3.org/1999/02/22-rdf-
syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> . FILTER (regex
(?s,"^http://rdfs.org/sioc/ns","i")) }
{u'head': {u'vars': [u's']}, u'results': {u'distinct': False, u'bindings':
[{u's': {u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Item'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Usergroup'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#UserAccount'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Forum'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Space'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Container'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Community'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Site'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Post'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Thread'}}, {u's':
{u'type': u'uri', u'value': u'http://rdfs.org/sioc/ns#Role'}}], u'ordered':
False}}
Is there an easy way to test librdf through other ways than just the SuRF
plugin? You should maybe consider filing a bug report with librdf.
While SuRF's plugin system initially suggest that you can easily switch
backends and still have the same API, the backends most often differ
significantly, see for example my initial documentation here:
http://code.google.com/p/surfrdf/wiki/BackendPeculiarities
Sorry I can't be much help here.
-Christoph
I forgot to add that I have rasqal 0.9.20 installed (from Ubuntu) which is a
year old now.
-Christoph