You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AriadnePlus/dnet-ariadneplus-graphdb-pu.../src/main/resources/eu/dnetlib/ariadneplus/sparql/04_insert_AAT_enrichment_te...

169 lines
6.6 KiB
SPARQL

PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
#AAT ENRICHMENT
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::<PROVIDER>::aatplus> {
?record aocat:has_derived_subject ?aat .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::aat>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::<COLL>>
WHERE {
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:exactMatch ?aat .
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:broadMatch ?aat .
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:closeMatch ?aat .
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:narrowMatch ?aat .
}
};
#if you need to uppercase (i.e. uppercase in aat data)
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::<PROVIDER>::aatplus> {
?record aocat:has_derived_subject ?aat_subject .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::aat>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::<COLL>>
WHERE {
{
?record aocat:has_native_subject ?native_subject .
?aat_native_subject skos:exactMatch ?aat_subject .
bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/<PROVIDER>/", ucase(strafter(str(?native_subject),"<PROVIDER>/")))) as ?uppercase_native_subject)
filter(?uppercase_native_subject=?aat_native_subject)
}
union
{
?record aocat:has_native_subject ?native_subject .
?aat_native_subject skos:broadMatch ?aat_subject .
bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/<PROVIDER>/", ucase(strafter(str(?native_subject),"<PROVIDER>/")))) as ?uppercase_native_subject)
filter(?uppercase_native_subject=?aat_native_subject)
}
union
{
?record aocat:has_native_subject ?native_subject .
?aat_native_subject skos:closeMatch ?aat_subject .
bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/<PROVIDER>/", ucase(strafter(str(?native_subject),"<PROVIDER>/")))) as ?uppercase_native_subject)
filter(?uppercase_native_subject=?aat_native_subject)
}
union
{
?record aocat:has_native_subject ?native_subject .
?aat_native_subject skos:narrowMatch ?aat_subject .
bind (IRI(concat( "https://ariadne-infrastructure.eu/aocat/Concept/<PROVIDER>/", ucase(strafter(str(?native_subject),"<PROVIDER>/")))) as ?uppercase_native_subject)
filter(?uppercase_native_subject=?aat_native_subject)
}
};
#if you need to match on the skos:prefLabel, ignoring language
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::<PROVIDER>::aatplus> {
?record aocat:has_derived_subject ?aat_subject .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::aat>
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::<COLL>>
WHERE {
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:prefLabel ?nativeLabel .
?match_subject skos:prefLabel ?matchedLabel .
?match_subject skos:exactMatch ?aat_subject .
filter(str(?nativeLabel) = str(?matchedLabel))
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:prefLabel ?nativeLabel .
?match_subject skos:prefLabel ?matchedLabel .
?match_subject skos:broadMatch ?aat_subject .
filter(str(?nativeLabel) = str(?matchedLabel))
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:prefLabel ?nativeLabel .
?match_subject skos:prefLabel ?matchedLabel .
?match_subject skos:closeMatch ?aat_subject .
filter(str(?nativeLabel) = str(?matchedLabel))
}
union
{
?record aocat:has_native_subject ?native_subject .
?native_subject skos:prefLabel ?nativeLabel .
?match_subject skos:prefLabel ?matchedLabel .
?match_subject skos:narrowMatch ?aat_subject .
filter(str(?nativeLabel) = str(?matchedLabel))
}
};
#if you need to copy triples from the data graph to the aat/aatplus graph:
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::<PROVIDER>::aatplus> {
?record aocat:has_derived_subject ?aat_subject .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::<COLL>>
WHERE {
?record aocat:has_derived_subject ?aat_subject .
};
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::aat> {
?aat_subject skos:prefLabel ?label .
}
}
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::<COLL>>
WHERE {
?record aocat:has_derived_subject ?aat_subject .
?aat_subject skos:prefLabel ?label
}
#it could the case there is no prefLabel in the data graph: we have to find it somewhere (if there is not, then we might have a problem)
# note that the ?label comes with the language tag
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX skosxl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX gvp: <http://vocab.getty.edu/ontology#>
INSERT {
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::<PROVIDER>::aat> {
?aat_subject skos:prefLabel ?label .
}
}
USING <http://vocab.getty.edu/aat/>
USING <https://ariadne-infrastructure.eu/ariadneplus::<PROVIDER>::aatplus>
WHERE {
?record aocat:has_derived_subject ?aat_subject .
?aat_subject rdf:type gvp:Concept .
?aat_subject gvp:prefLabelGVP ?lab .
?lab gvp:term ?label .
}