migrants/updates_step07/004-person-profession-label-to-hasOccupation.rq
Daniel Hernandez b4ed3cbde7 Add step-07: clean up secondary organisations and simplify person-profession
- Remove redundant tm:secondaryOrganisation when it equals org:organization (230)
- Promote tm:secondaryOrganisation to org:organization when no primary exists (256)
- Replace tm:PersonProfession intermediate class with direct schema:hasOccupation
  links from persons to schema:Occupation instances (742 instances removed)
- Remove tm:PersonProfession class and its properties from the ontology
- Add step-07 binary, Rakefile task, figures, and documentation
2026-03-01 15:48:51 +01:00

28 lines
989 B
SPARQL

# For PersonProfession instances with a professionLabel,
# create a schema:Occupation from the label and add a direct
# schema:hasOccupation link from the person to it.
# Affects 730 PersonProfession instances.
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX schema: <https://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT {
?person schema:hasOccupation ?occupation .
?occupation a schema:Occupation .
?occupation a skos:Concept .
?occupation schema:name ?labelEN .
?occupation rdfs:label ?labelEN .
?occupation skos:prefLabel ?labelEN .
}
WHERE {
?pp a tm:PersonProfession .
?pp tm:personProfessionPerson ?person .
?pp tm:professionLabel ?label .
BIND(STRLANG(REPLACE(STR(?label), "\\s+$", ""), "en") AS ?labelEN)
BIND(IRI(CONCAT(
"http://example.org/migrants/Profession-",
ENCODE_FOR_URI(REPLACE(STR(?label), "\\s+", ""))
)) AS ?occupation)
}