Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
It would be really useful to have a property function that could take a string, split it on some delineator and then return each token as a new binding.
One example where it is useful is if you have some entities with keywords as concatenated literal strings. It would be nice to extract them and perform some operation:
prefix : <http://example.org> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> insert data { :a :keywords "report data important expensive" . :b :keywords "data earthquake report" . }
Then query with:
prefix : <http://example.org> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix apf: <http://jena.hpl.hp.com/ARQ/property#> select ?keyword (count(*) as ?c) where { ?s :keywords ?text . ?keyword apf:strSplit (?text " ") } group by ?keyword order by desc(?c) ?keyword
Results:
-------------------- | keyword | c | ==================== | "data" | 2 | | "report" | 2 | | "earthquake" | 1 | | "expensive" | 1 | | "important" | 1 | --------------------