Assuming I have some triples like this
:a ex:fileName "abc.txt".
:b ex:fileName "another.file.doc".
and assuming I want to create a SPARQL query that returns me the filename without a file extension? Like
"abc"
"another.file"
Does SPARQL have an easy way of doing something like "substring before last" ?
You can use REPLACE()
with a matching regexp:
SELECT ?file ?filename
WHERE {
?file ex:fileName ?rawFilename .
BIND( REPLACE( ?rawFilename , '\\.[^.]*$', '' ) AS ?filename )
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.