SmartDataAnalytics / Sparqlify

Sparql -> SQL Rewriter enabling virtual RDB -> RDF mappings
http://aksw.org/Projects/Sparqlify
123 stars 13 forks source link

Regex: Case (in)sensitivity flag ignored #59

Open Aklakan opened 9 years ago

Aklakan commented 9 years ago
Select * {
?s a owl:Class . 
?s rdfs:label ?l
Filter(regex(str(?s), 'school', 'i'))
}
amrapalijz commented 9 years ago

(how) can I convert the literals into lower case during the conversion process? using fn:lower-case?

patrickwestphal commented 9 years ago

Don't know if there is a fn:lower-case built in, but you could also use Postgres' lower(...) function in the From query. Like so:

Create View foo As
  Construct {
    ?foo a Bar .
  }
  With
   ?foo = uri(blah: ?lower_sth)
  From
    [[SELECT lower(sth) AS lower_sth FROM sometable]]
amrapalijz commented 9 years ago

Prefix geo: http://geo.bio2rdf.org/ Prefix dcterms:http://purl.org/dc/elements/1.1/ Prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# Prefix rdfs: http://www.w3.org/2000/01/rdf-schema# Prefix xsd: http://www.w3.org/2001/XMLSchema# Prefix fn:http://aksw.org/sparqlify/

Create View Template geo As Construct { ?s geo:gsmID ?l1. ?s geo:characteristic ?l2. ?s geo:characteristic ?l3. } With ?s = uri(concat("http://geo.bio2rdf.org/", ?1)) ?l1 = plainLiteral(?1) ?l2 = plainLiteral(?2) ?l3 = plainLiteral(?3)


Above is my mapping file. I want to convert actually the literals (l2, l3) to lower case.