How to generate multiple dc:subject from one column?

30 views
Skip to first unread message

vlad...@sirma.bg

unread,
Jul 24, 2015, 12:09:27 PM7/24/15
to Tarql
I got two cols
?Keywords ?SupplementalCategories

with data like this
Black and white;Society;Monochrome;20th Century;Cinema;Screen;Actor;Uniform;Film director;Wartime;Home front;Cap;Ladders;Silent film;1910s , 10s;europeana photography;Europeana Food and Drink WWI;Film;Propaganda

How to generate multiple dc:subject by splitting them on ";" ?
The cols are optional. There may be optional spaces after ";"

With perl that's 2 lines...

johna...@hotmail.com

unread,
Jul 15, 2016, 7:30:23 AM7/15/16
to Tarql, vlad...@sirma.bg
There is an open issue for this:

Otherwise if you know upfront how many subvalues are in a value, you could use STRBEFORE() and STRAFTER() functions to extract the values.

SELECT ?s1 ?s2 ?s3
WHERE {
  BIND ("Black and white;Society;Monochrome" AS ?s)

  BIND (STRBEFORE(?s, ";") AS ?s1)
  BIND (STRAFTER(?s, ";") AS ?s_)

  BIND (STRBEFORE(?s_, ";") AS ?s2)
  BIND (STRAFTER(?s_, ";") AS ?s3)
}
Reply all
Reply to author
Forward
0 new messages