This page contains various SPARQL queries that can be performed on the MICA triplestore in order to provide useful information in the DDG interface. Queries are sorted according to the type of resource to which they relate.
Theses concepts are the concepts that have micavocab:MICA as parent concept.
Select all concepts which have micavocab:MICA as parent and for these concepts give the URI and label
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { ?conceptURI a skos:Concept; skos:prefLabel ?label; skos:broader micavocab:MICA. }
In fact the previous query can be generalized to find all the direct sub-concepts of any given concept. For example :
Select all concepts which have micavocab:D1PrimaryResources as parent and for these concepts give the URI and label
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { ?conceptURI a skos:Concept; skos:prefLabel ?label; skos:broader micavocab:D1PrimaryResources. }
The previous query uses the skos:broader relation to retrieve the sub-concepts. It's also possible to uses the inverse relation skos:narrower.
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { micavocab:D1PrimaryResources skos:narrower ?conceptURI. ?conceptURI skos:prefLabel ?label. }
e.g. parent of concept micavocab:D1PrimaryResources
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { micavocab:D1PrimaryResources skos:broader ?conceptURI. ?conceptURI skos:prefLabel ?label . }
The same query using skos:narrower instead of skos:broader
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { ?conceptURI skos:narrower micavocab:D1PrimaryResources; skos:prefLabel ?label . }
e.g. Select all concepts of micavocab:DomainScheme
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { ?conceptURI a skos:Concept; skos:prefLabel ?label; skos:inScheme micavocab:DomainScheme. }
to get all the concepts of a concept scheme other than domain scheme just replace micavocab:DomainScheme URI by the corresponding MICA scheme URI.
Not necessary! It can be done the query by type (factsheet, docsheet,… ) and count the results.
Select all factsheets (URI and title) directly related to domain concept micavocab:D1PrimaryResources
PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title WHERE { ?sheetURI a model:FactSheet; dcterms:title ?title; model:hasDomainConcept micavocab:D1PrimaryResources . }
For other type of sheets (docsheets, defsheets, flowsheet, external resource (data resource, linked data resource ...)) just replace model:FactSheet in the previous query by the corresponding data type defined in MicaModel ontology.
If the concept belongs to another concept scheme than domain scheme just replace model:hasDomainConcept property by the model:hasXXXConcept property corresponding to the appropriate concept scheme.
TODO see how inferences canc be performed to use generic hasMicaConcept property instead of the specialized properties hasDomainConcept hasDataConcept ....
e.g. Get all docsheets (URI and title) related to the Value Supply Chain concept micavocab:Metallurgy
PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title WHERE { ?sheetURI a model:DocSheet; dcterms:title ?title; model:hasValueSupplyChainConcept micavocab:Metallurgy . }
e.g. get all legislations (URI and title) related to a domain concept "D1PrimaryResources"
PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?legislation ?title WHERE { ?legislation a model:LinkedDataResource; dcterms:title ?title; model:hasDomainConcept micavocab:D1PrimaryResources . }
TODO ask François Tertre if a specific subtype of LinkedDataResource must be defined for legislation ? or if LinkedDataResources always refer to a legislation.
e.g. find all factsheets (URI, title and concept label) related (directly or undirectly through subconcepts) to the domain concept micavocab:D1PrimaryResources
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title ?conceptLabel WHERE { ?sheetURI a model:FactSheet; dcterms:title ?title; model:hasDomainConcept ?d. ?d skos:broaderTransitive micavocab:D1PrimaryResources; skos:prefLabel ?conceptLabel. }
To search for an other type of sheet (e.g. DocSheet) just replace model:FactSheet by the appropriate corresponding data type defined in MicaModel ontology.
e.g. get all questions (URI , description) directly related to the domain concept micavocab:D1PrimaryResources
PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?questionURI ?description WHERE { ?questionURI a model:Question; model:description ?description; model:hasDomainConcept micavocab:D1PrimaryResources . }
Main ontology (domain) concepts and tranversal ontologies concepts are defined in different concept schemes.
e.g. get all domain concepts (URI , label) related to the domain concept micavocab:D1PrimaryResources
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { ?conceptURI a skos:Concept; skos:prefLabel ?label; skos:inScheme micavocab:DomainScheme; skos:related micavocab:D1PrimaryResources. }
to get all the concepts of a concept scheme other than domain scheme just replace micavocab:DomainScheme URI by the corresponding scheme URI MICA Scheme.
e.g. get all commodities concepts (URI , label) related to the domain concept micavocab:D1PrimaryResources
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> SELECT ?conceptURI ?label WHERE { ?conceptURI a skos:Concept; skos:prefLabel ?label; skos:inScheme micavocab:CommoditiesScheme; skos:related micavocab: D1PrimaryResources. }
TODO: Ask Emanuela what she exactly means by "concept metadata". Currently we only have skos:preflabel, skos:altLabel and skos:definition properties for concepts.
e.g. find URI, label and if they exist the definition and alternative labels of the domain concept micavocab:D1PrimaryResources
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?conceptURI ?label ?definition ?altLabel WHERE { micavocab:D1PrimaryResources skos:prefLabel ?label. optional { micavocab:D1PrimaryResources skos:definition ?definition.} optional { micavocab:D1PrimaryResources skos:altLabel ?altLabel.} }
TODO: Ask Emanuela what she exactly means by "concept metadata". Currently we only have skos:preflabel, skos:altLabel and skos:definition properties for concepts.
e.g. find URI, label and if they exist the definition and alternative labels of all the concepts containing the text "drilling"
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?conceptURI ?label ?definition ?altLabel WHERE { ?conceptURI a skos:Concept; skos:prefLabel ?label. FILTER regex( ?label ,"drilling","i") optional{ ?conceptURI skos:definition ?definition. FILTER regex( ?definition ,"drilling","i") } optional{ ?conceptURI skos:altLabel ?altLabel. FILTER regex( ?altLabel ,"drilling","i") } }
Sheets can be of any type: FactSheet, DocSheet, Legislation... See MicaModel ontology to get all the subtypes of sheets.
e.g. get all factsheets (URI and title)
PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title WHERE { ?sheetURI a model:FactSheet; dcterms:title ?title. }
for other type of sheets just replace model:FactSheet by the appropriate MicaModel ontology data type. see types of sheets.
e.g. find all the factsheets related to the factsheet micaresource:FactSheetMineClosure
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title WHERE { ?sheetURI a model:FactSheet; dcterms:title ?title; model:relatedSheet micaresource:FactSheetMineClosure. }
For other type of sheets just replace model:FactSheet by the appropriate MicaModel ontology data type. see types of sheets.
For other type of resource just replace micaresource:FactSheetMineClosure by the corresponding URI of resource.
The following example represents every type of sheet:
e.g find all factsheets related to the docSheet micaresource:DocSheetStocksInUse
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title WHERE { ?sheetURI a model:FactSheet; dcterms:title ?title; model:relatedSheet micaresource:DocSheetStocksInUse. }
eg get all the questions (URI and description) related to the factsheet micaresource:FactSheetMineClosure
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?questionURI ?description WHERE { ?questionURI a model:Question; model:description ?description. micaresource:FactSheetMineClosure model:answerTo ?questionURI. }
e.g. get all domain concepts (URI and label) related to the factsheet micaresource:FactSheetMineClosure
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> SELECT ?conceptURI ?label WHERE { micaresource:FactSheetMineClosure model:hasDomainConcept ?conceptURI . ?conceptURI a skos:Concept; skos:prefLabel ?label. }
To get all the concepts of a concept scheme other than domain scheme just replace model:hasDomainConcept property by the model:hasXXXConcept property corresponding to the appropriate concept scheme.
e.g. get all commodities concepts (URI and label) related to the factsheet micaresource:FactSheetMineClosure
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> SELECT ?conceptURI ?label WHERE { micaresource:FactSheetMineClosure model:hasCommodityConcept ?conceptURI . ?conceptURI a skos:Concept; skos:prefLabel ?label. }
e.g. find all factsheets (URI, title and if it exists description) containing the text "de"
prefix micamodel: <https://w3id.org/mica/ontology/MicaModel#> prefix dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title ?description WHERE { ?sheetURI a micamodel:FactSheet; dcterms:title ?title. FILTER regex( ?title ,"de","i") optional{ ?sheetURI micamodel:description ?description. FILTER regex( ?description ,"de","i") } }
for other types of sheets just replace model:FactSheet by the appropriate MicaModel ontology data type. see types of sheets.
PREFIX : <https://w3id.org/mica/resource/factsheet/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT DISTINCT ?questionURI ?description WHERE { ?questionURI a model:Question; model:description ?description. }
e.g. get all factsheets (URI and title) related to the question micaresource:QuestionPrimaryResources
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title WHERE { ?sheetURI a model:FactSheet; dcterms:title ?title; model:answersTo micaresource:QuestionPrimaryResources. }
for other types of sheets just replace model:FactSheet by the appropriate MicaModel ontology data type. see types of sheets.
e.g. get all legislation related to the question micaresource:QuestionPrimaryResources
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?sheetURI ?title WHERE { ?sheetURI a model:LinkedDataResource; dcterms:title ?title; model:answersTo micaresource:QuestionPrimaryResources. }
TODO ask François Tertre if a specific subtype of LinkedDataResource must be defined for legislation ? or if LinkedDataResources always refer to a legislation.
TODO: Ask Emanuela what she means. What kind of statistics ? e.g number of sheets directly responding to a question ? number of related concepts. SPARQL has some aggregation functions that can help to perform such queries.
TODO: Ask Emanuela what she expects. What does she mean by definition. In the current MICA data model we only have a description. Futhermore, what does she mean by links.
e.g. get the description of the question micaresource:QuestionPrimaryResources
PREFIX micaresource: <https://w3id.org/mica/resource/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX micavocab: <https://w3id.org/mica/ontology/MicaOntology/> PREFIX model: <https://w3id.org/mica/ontology/MicaModel#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT ?description WHERE { micaresource:QuestionPrimaryResources model:description ?description. }
e.g. get all questions containing the text "mining waste"
prefix micamodel: <https://w3id.org/mica/ontology/MicaModel#> prefix dcterms: <http://purl.org/dc/terms/> SELECT ?questionURI ?description WHERE { ?questionURI a micamodel:Question; micamodel:description ?description. FILTER regex( ?description ,"mining waste","i") }