-
Notifications
You must be signed in to change notification settings - Fork 0
SPARQL
- SparQL-query via Ivo
- Werkte niet; stukken ontbraken in de hiërarchie Eerst de counter weggehaald, kwamen al meer results uit veel gekeken naar resources via path geprobeerd, lukte ook niet telkens gecheckt of er nog nodes misten (via 'speren' vooral) nieuwe termen toegevoegd
uiteindelijk via 'narrower' ipv 'broader' gekeken en getest; al meer results alleen de error dat 'wapens en munitie' ontbrak; die als main parent met de hand toegevoegd` --> alles lijkt nu te kloppen qua hiërarchie
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?catNTLabel ?catLabel
WHERE {
# geef de categorieën onder wapens en munitie
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabel .
# geef de term (de "broader term") die daar boven staat in de thesaurus
?cat skos:narrower ?catNT .
?catNT skos:prefLabel ?catNTLabel .
} GROUP BY ?catNTLabel ?catLabel
nu nog count toevoegen op aantal items binnen alle categorie --> tijdens testen ook achtergekomen dat de originele count uit ivo's query niet klopte; vgm telde die t aantal subcategories op ipv aantal [fysieke] items/objecten per categorie
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?catNTLabel ?catLabel (COUNT(?cho) AS ?choCount)
WHERE {
# geef de categorieën onder wapens en munitie
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabel .
# geef de term (de "broader term") die daar boven staat in de thesaurus
?cat skos:narrower ?catNT .
?catNT skos:prefLabel ?catNTLabel .
# geef objecten bij de categorie
?cho edm:object ?cat .
} GROUP BY ?catNTLabel ?catLabel
--> lijkt niet te kloppen met wat er in de collectie wordt weergeven
eerst maar eens de nt/bt logischer weergeven:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?catLabel ?catLabelOfParent
WHERE {
# geef de categorieën onder wapens en munitie
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabelOfParent .
# geef de term (de "narrower term") die daar boven staat in de thesaurus
?cat skos:narrower ?catL .
?catL skos:prefLabel ?catLabel .
} GROUP BY ?catLabel ?catLabelOfParent
extra comments erbij gezet, gegroepeerd op de naam van de parentID
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?catLabel ?catLabelOfParent
WHERE {
# er wordt van boven naar beneden gewerkt in de hiërarchie
# geef de categorieën onder wapens en munitie; dit zijn alle parentlabels
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabelOfParent .
# geef de term (de "narrower term") die daaronder staat in de thesaurus; dit is je 'hoofdterm' nu
?cat skos:narrower ?catL .
?catL skos:prefLabel ?catLabel .
} GROUP BY ?catLabelOfParent ?catLabel
ORDER BY ASC(?catLabelOfParent)
weer een poging om te counten:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?catLabel ?catLabelOfParent (COUNT(?cho) AS ?totaleObjectenMetCatLabel)
WHERE {
# er wordt van boven naar beneden gewerkt in de hiërarchie
# geef de categorieën onder wapens en munitie; dit zijn alle parentlabels
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabelOfParent .
# geef de term (de "narrower term") die daaronder staat in de thesaurus; dit is je 'hoofdterm' nu
?cat skos:narrower ?catL .
?catL skos:prefLabel ?catLabel .
# geef het aantal daadwerkelijke [fysieke] objecten met dit label
?cho edm:object ?catL .
} GROUP BY ?catLabelOfParent ?catLabel ?totaleObjectenMetDitLabel
ORDER BY ASC(?catLabelOfParent)
--> wordt iedere categorie die zelf geen items heeft die de subcategories niet bevat, geskipt?
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?catLabel ?catLabelOfParent (COUNT(?cho) AS ?totaleObjectenMetCatLabel)
WHERE {
# er wordt van boven naar beneden gewerkt in de hiërarchie
# geef de categorieën onder wapens en munitie; dit zijn alle parentlabels
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabelOfParent .
# geef de term (de "narrower term") die daaronder staat in de thesaurus; dit is je 'hoofdterm' nu
?cat skos:narrower ?catL .
?catL skos:prefLabel ?catLabel .
# geef het aantal daadwerkelijke [fysieke] objecten met dit label
OPTIONAL { ?cho edm:object ?catL .}
} GROUP BY ?catLabelOfParent ?catLabel ?totaleObjectenMetDitLabel
ORDER BY ASC(?catLabelOfParent)
^nu worden wel alle labels+parents weergeven De aantallen van de uiterste children worden wel goed weergeven, maar niet erboven.
SELECT ?catLabel ?catLabelOfParent (COUNT(?cho) AS ?totaleObjectenMetCatLabel)
WHERE {
# er wordt van boven naar beneden gewerkt in de hiërarchie
# geef de categorieën onder wapens en munitie; dit zijn alle parentlabels
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabelOfParent .
# geef de term (de "narrower term") die daaronder staat in de thesaurus; dit is je 'hoofdterm' nu
?cat skos:narrower ?catL .
?catL skos:prefLabel ?catLabel .
# geef het aantal daadwerkelijke [fysieke] objecten met dit label
OPTIONAL { ?cho edm:object ?catL .}
} GROUP BY ?catLabelOfParent ?catLabel ?totaleObjectenMetDitLabel
ORDER BY ASC(?catLabelOfParent)
Overigens, ook vast de query gemaakt voor de hoofdcategorie (uiterste bubbel);
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# PREFIX dc: http://purl.org/dc/elements/1.1/ PREFIX dct: http://purl.org/dc/terms/ PREFIX skos: http://www.w3.org/2004/02/skos/core# PREFIX edm: http://www.europeana.eu/schemas/edm/ PREFIX foaf: http://xmlns.com/foaf/0.1/
SELECT ?catLabel ?catLabelOfParent (COUNT(?alleObjecten) AS ?totaleObjectenMetCatLabel) WHERE {
https://hdl.handle.net/20.500.11840/termmaster12435 skos:narrower* ?cat . ?cat skos:prefLabel ?catLabelOfParent .
?cat skos:narrower ?catL . ?catL skos:prefLabel ?catLabel .
OPTIONAL { # ?catLabel edm:object* ?alleObjecten .
}
} GROUP BY ?catLabelOfParent ?catLabel ?totaleObjectenMetDitLabel ORDER BY ASC(?catLabelOfParent)
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?catLabel ?catLabelOfParent ?totaleObjectenMetCatLabel
WHERE {
# er wordt van boven naar beneden gewerkt in de hiërarchie
# geef de categorieën onder wapens en munitie; dit zijn alle parentlabels
<https://hdl.handle.net/20.500.11840/termmaster12435> skos:narrower* ?cat .
?cat skos:prefLabel ?catLabelOfParent .
# geef de term (de "narrower term") die daaronder staat in de thesaurus; dit is je 'hoofdterm' nu
?cat skos:narrower ?catL .
?catL skos:prefLabel ?catLabel .
# geef het aantal daadwerkelijke [fysieke] objecten met dit label
OPTIONAL {
SELECT (COUNT(?objecten) AS ?totaleObjectenMetCatLabel)
WHERE {
## alle objecten zitten nu in ?objecten
?cho edm:object ?objecten .
?objecten skos:prefLabel ?objectLabel .
FILTER (CONTAINS (?objectLabel, ?catLabel))
}
}
}
GROUP BY ?catLabelOfParent ?catLabel ?totaleObjectenMetCatLabel
ORDER BY ASC(?catLabelOfParent)