19 queries in updates/ convert categorical columns (continent, country, city, gender, profession, etc.) from literals to typed RDF objects with rdfs:label. map/step-02.rb applies them to produce data/graph-02.ttl. Also fix step-01.rb to sanitize column names with spaces and avoid prefix serialization issues with fragment IRIs.
16 lines
548 B
SPARQL
16 lines
548 B
SPARQL
|
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
|
|
DELETE {
|
|
?s <http://example.org/migrants/relationship#Relationshiptype> ?val .
|
|
}
|
|
INSERT {
|
|
?s <http://example.org/migrants/relationship#Relationshiptype> ?obj .
|
|
?obj a <http://example.org/migrants/RelationshipType> .
|
|
?obj rdfs:label ?label .
|
|
}
|
|
WHERE {
|
|
?s <http://example.org/migrants/relationship#Relationshiptype> ?val .
|
|
BIND(IRI(CONCAT("http://example.org/migrants/RelationshipType-", ENCODE_FOR_URI(REPLACE(?val, " ", "")))) AS ?obj)
|
|
BIND(STRLANG(STR(?val), "en") AS ?label)
|
|
}
|