Project:SPARQL/examples: Difference between revisions

From LexBib
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
On this page we list queries that we need for maintaining the database. The examples on [[Main Page]] are better for gaining an overview of what's in the database.
* Query for LexBib legacy (data.lexbib.org sandbox) to lexbib.elex.is mapping: [https://lexbib.elex.is/query/#PREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX%20lwb%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fentity%2F%3E%0APREFIX%20ldp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fdirect%2F%3E%0APREFIX%20lp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2F%3E%0APREFIX%20lps%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fstatement%2F%3E%0APREFIX%20lpq%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fqualifier%2F%3E%0A%0Aselect%20%28substr%28str%28%3Flwb_id%29%2C30%29%20as%20%3Flwb_entity%29%20%3Flegacy_id%20where%20%7B%0A%20%20%3Flwb_id%20ldp%3AP1%20%3Flegacy_id.%20%7D Query].
* Query for LexBib legacy (data.lexbib.org sandbox) to lexbib.elex.is mapping: [https://lexbib.elex.is/query/#PREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX%20lwb%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fentity%2F%3E%0APREFIX%20ldp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fdirect%2F%3E%0APREFIX%20lp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2F%3E%0APREFIX%20lps%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fstatement%2F%3E%0APREFIX%20lpq%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fqualifier%2F%3E%0A%0Aselect%20%28substr%28str%28%3Flwb_id%29%2C30%29%20as%20%3Flwb_entity%29%20%3Flegacy_id%20where%20%7B%0A%20%20%3Flwb_id%20ldp%3AP1%20%3Flegacy_id.%20%7D Query].
* Query for LexVoc terms, labels and skos-related termlabels, for export to Lexonomy: [https://lexbib.elex.is/query/#%23%20sparql%20query%20for%20LexVoc%20Subject%20Headings%20SKOS%20vocabulary%2C%0A%23%20version%20for%20Lexonomy%20export%0A%0APREFIX%20lwb%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fentity%2F%3E%0APREFIX%20ldp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fdirect%2F%3E%0APREFIX%20lp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2F%3E%0APREFIX%20lps%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fstatement%2F%3E%0APREFIX%20lpq%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fqualifier%2F%3E%0APREFIX%20lpr%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Freference%2F%3E%0APREFIX%20lno%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fnovalue%2F%3E%0A%0ASELECT%0A%3Fsubject%0A%28strafter%28str%28%3Fsubject%29%2C%22http%3A%2F%2Flexbib.elex.is%2Fentity%2F%22%29%20as%20%3Fterm_id%29%0A%3Fbabelnet_synset%0A%3Fmatch_quality%0A%0A%28group_concat%28distinct%20concat%28%27%7B%22lang%22%3A%22%27%2Clang%28%3FsubjectLabel%29%2C%27%22%2C%22text%22%3A%22%27%2Cstr%28%3FsubjectLabel%29%2C%27%22%7D%27%29%3B%20SEPARATOR%3D%22%2C%22%29%20as%20%3FsubjectLabels%29%0A%0A%28group_concat%28distinct%20%3FbroaderLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FbroaderLabels%29%0A%28group_concat%28distinct%20%3FnarrowerLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FnarrowerLabels%29%0A%28group_concat%28distinct%20%3FcloseMatchLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FcloseMatchLabels%29%0A%28group_concat%28distinct%20%3FrelatedLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FrelatedLabels%29%0A%28group_concat%28distinct%20%3Fdefinition%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3Fdefinitions%29%0A%0A%23%28group_concat%28BIND%28REPLACE%28str%28%3Fbroader%29%2C%20%22%5B%2F%23%5D%28%5B%5E%23%2F%5D%2B%29%24%22%2C%20%22%241%22%29%20AS%20%3Fcleanbroader%29%29%20as%20%3Fbroaders%29%0A%0A%23%28group_concat%28%3FbroaderLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FbroaderLabels%29%0A%0A%0A%0A%0AWHERE%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP5%20lwb%3AQ7%20.%0A%20%20%20%20%3Fsubject%20rdfs%3Alabel%7Cskos%3AaltLabel%20%3FsubjectLabel%20.%0A%20%20%20%20%20%20%20%20%0A%20%20%23%20%20MINUS%20%7B%3Fsubject%20ldp%3AP72%20%3Chttp%3A%2F%2Flexbib.org%2Fterms%23Term_Language%3E.%7D%0A%0AOPTIONAL%20%7B%20%0A%20%20%20%20%20%20%20%20%20%20%20%3Fsubject%20lp%3AP86%20%3Fbabelnet_synset_statement%20.%0A%20%20%20%20%20%20%20%20%20%20%20%3Fbabelnet_synset_statement%20lps%3AP86%20%3Fbabelnet_synset%20.%0A%20%20%20%20%20%20%20%20%20%20%20%3Fbabelnet_synset_statement%20lpq%3AP87%20%3Fmatch_quality%20.%0A%20%20%20%20%7D%0A%20%20%20%20%20%20%20%0AOPTIONAL%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP72%20%3Fbroader%20.%0A%20%20%20%20%3Fbroader%20rdfs%3Alabel%20%3FbroaderLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FbroaderLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%0AOPTIONAL%20%7B%0A%20%20%20%20%3Fnarrower%20ldp%3AP72%20%3Fsubject%20.%0A%20%20%20%20%3Fnarrower%20rdfs%3Alabel%20%3FnarrowerLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FnarrowerLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%0AOPTIONAL%20%7B%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP77%20%3FcloseMatch%20.%0A%20%20%20%20%3FcloseMatch%20rdfs%3Alabel%20%3FcloseMatchLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FcloseMatchLabel%29%3D%22en%22%29%0A%20%20%20%7D%20UNION%20%7B%0A%20%20%20%20%3FcloseMatch%20ldp%3AP77%20%3Fsubject%20.%0A%20%20%20%20%3FcloseMatch%20rdfs%3Alabel%20%3FcloseMatchLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FcloseMatchLabel%29%3D%22en%22%29%0A%20%20%20%7D%20%7D%0AOPTIONAL%20%7B%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP76%20%3Frelated%20.%0A%20%20%20%20%3Frelated%20rdfs%3Alabel%20%3FrelatedLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FrelatedLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%20UNION%20%7B%0A%20%20%20%20%3Frelated%20ldp%3AP76%20%3Fsubject%20.%0A%20%20%20%20%3Frelated%20rdfs%3Alabel%20%3FrelatedLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FrelatedLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%20%7D%0AOPTIONAL%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP80%20%3Fdefinition%20.%0A%20%20%20%20%7D%0A%7D%0AGROUP%20BY%20%3FsubjectLabels%20%3Fterm_id%20%3Fbabelnet_synset%20%3Fmatch_quality%20%3Fsubject%20%3FbroaderLabels%20%3FnarrowerLabels%20%3FcloseMatchLabels%20%3FrelatedLabels%20%3Fdefinitions%0A Query].
* Query for LexVoc terms, labels and skos-related termlabels, for export to Lexonomy: [https://lexbib.elex.is/query/#%23%20sparql%20query%20for%20LexVoc%20Subject%20Headings%20SKOS%20vocabulary%2C%0A%23%20version%20for%20Lexonomy%20export%0A%0APREFIX%20lwb%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fentity%2F%3E%0APREFIX%20ldp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fdirect%2F%3E%0APREFIX%20lp%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2F%3E%0APREFIX%20lps%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fstatement%2F%3E%0APREFIX%20lpq%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fqualifier%2F%3E%0APREFIX%20lpr%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Freference%2F%3E%0APREFIX%20lno%3A%20%3Chttp%3A%2F%2Flexbib.elex.is%2Fprop%2Fnovalue%2F%3E%0A%0ASELECT%0A%3Fsubject%0A%28strafter%28str%28%3Fsubject%29%2C%22http%3A%2F%2Flexbib.elex.is%2Fentity%2F%22%29%20as%20%3Fterm_id%29%0A%3Fbabelnet_synset%0A%3Fmatch_quality%0A%3FenPrefLabel%0A%28group_concat%28distinct%20%3FenAltLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FenAltLabels%29%0A%28group_concat%28distinct%20concat%28%27%7B%22lang%22%3A%22%27%2Clang%28%3FsubjectLabel%29%2C%27%22%2C%22text%22%3A%22%27%2Cstr%28%3FsubjectLabel%29%2C%27%22%7D%27%29%3B%20SEPARATOR%3D%22%2C%22%29%20as%20%3FsubjectLabels%29%0A%28group_concat%28distinct%20%3FbroaderLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FbroaderLabels%29%0A%28group_concat%28distinct%20%3FnarrowerLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FnarrowerLabels%29%0A%28group_concat%28distinct%20%3FcloseMatchLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FcloseMatchLabels%29%0A%28group_concat%28distinct%20%3FrelatedLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FrelatedLabels%29%0A%28group_concat%28distinct%20%3Fdefinition%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3Fdefinitions%29%0A%0A%23%28group_concat%28BIND%28REPLACE%28str%28%3Fbroader%29%2C%20%22%5B%2F%23%5D%28%5B%5E%23%2F%5D%2B%29%24%22%2C%20%22%241%22%29%20AS%20%3Fcleanbroader%29%29%20as%20%3Fbroaders%29%0A%0A%23%28group_concat%28%3FbroaderLabel%3B%20SEPARATOR%3D%22%40%22%29%20as%20%3FbroaderLabels%29%0A%0A%0A%0A%0AWHERE%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP5%20lwb%3AQ7%20.%0A%20%20%20%20%3Fsubject%20rdfs%3Alabel%7Cskos%3AaltLabel%20%3FsubjectLabel%20.%0A%20%20%20%20%3Fsubject%20rdfs%3Alabel%20%3FenPrefLabel%20.%20filter%28lang%28%3FenPrefLabel%29%3D%22en%22%29%0A%20%20%20%20%20%20%20%20%0AOPTIONAL%20%7B%20%3Fsubject%20skos%3AaltLabel%20%3FenAltLabel%20.%20filter%28lang%28%3FenAltLabel%29%3D%22en%22%29%7D%0AOPTIONAL%20%7B%20%0A%20%20%20%20%20%20%20%20%20%20%20%3Fsubject%20lp%3AP86%20%3Fbabelnet_synset_statement%20.%0A%20%20%20%20%20%20%20%20%20%20%20%3Fbabelnet_synset_statement%20lps%3AP86%20%3Fbabelnet_synset%20.%0A%20%20%20%20%20%20%20%20%20%20%20%3Fbabelnet_synset_statement%20lpq%3AP87%20%3Fmatch_quality%20.%0A%20%20%20%20%7D%0A%20%20%20%20%20%20%20%0AOPTIONAL%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP72%20%3Fbroader%20.%0A%20%20%20%20%3Fbroader%20rdfs%3Alabel%20%3FbroaderLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FbroaderLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%0AOPTIONAL%20%7B%0A%20%20%20%20%3Fnarrower%20ldp%3AP72%20%3Fsubject%20.%0A%20%20%20%20%3Fnarrower%20rdfs%3Alabel%20%3FnarrowerLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FnarrowerLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%0AOPTIONAL%20%7B%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP77%20%3FcloseMatch%20.%0A%20%20%20%20%3FcloseMatch%20rdfs%3Alabel%20%3FcloseMatchLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FcloseMatchLabel%29%3D%22en%22%29%0A%20%20%20%7D%20UNION%20%7B%0A%20%20%20%20%3FcloseMatch%20ldp%3AP77%20%3Fsubject%20.%0A%20%20%20%20%3FcloseMatch%20rdfs%3Alabel%20%3FcloseMatchLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FcloseMatchLabel%29%3D%22en%22%29%0A%20%20%20%7D%20%7D%0AOPTIONAL%20%7B%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP76%20%3Frelated%20.%0A%20%20%20%20%3Frelated%20rdfs%3Alabel%20%3FrelatedLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FrelatedLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%20UNION%20%7B%0A%20%20%20%20%3Frelated%20ldp%3AP76%20%3Fsubject%20.%0A%20%20%20%20%3Frelated%20rdfs%3Alabel%20%3FrelatedLabel.%0A%20%20%20%20%20%20%20%20FILTER%20%28lang%28%3FrelatedLabel%29%3D%22en%22%29%0A%20%20%20%20%7D%20%7D%0AOPTIONAL%20%7B%0A%20%20%20%20%3Fsubject%20ldp%3AP80%20%3Fdefinition%20.%0A%20%20%20%20%7D%0A%7D%0AGROUP%20BY%20%3FsubjectLabels%20%3Fterm_id%20%3Fbabelnet_synset%20%3Fmatch_quality%20%3FenPrefLabel%20%3FenAltLabels%20%3Fsubject%20%3FbroaderLabels%20%3FnarrowerLabels%20%3FcloseMatchLabels%20%3FrelatedLabels%20%3Fdefinitions%0A Query].

Latest revision as of 19:53, 25 August 2021

On this page we list queries that we need for maintaining the database. The examples on Main Page are better for gaining an overview of what's in the database.

  • Query for LexBib legacy (data.lexbib.org sandbox) to lexbib.elex.is mapping: Query.
  • Query for LexVoc terms, labels and skos-related termlabels, for export to Lexonomy: Query.