diff --git a/ordia/app/static/ordia.js b/ordia/app/static/ordia.js index 9122ebc..1053e07 100644 --- a/ordia/app/static/ordia.js +++ b/ordia/app/static/ordia.js @@ -110,7 +110,7 @@ function sparqlToDataTable(sparql, element, options={}) { var paging = (typeof options.paging === 'undefined') ? true : options.paging; var sDom = (typeof options.sDom === 'undefined') ? 'lfrtip' : options.sDom; - var post_url = "https://query.wikidata.org/bigdata/namespace/wdq/sparql"; + var post_url = "https://query.wikidata.org/sparql"; var post_data = "query=" + encodeURIComponent(sparql) + '&format=json' $.post(post_url, post_data, function(response) { diff --git a/ordia/app/templates/lf.html b/ordia/app/templates/lf.html index 1a6f0b3..6743e11 100644 --- a/ordia/app/templates/lf.html +++ b/ordia/app/templates/lf.html @@ -8,7 +8,7 @@ formDataSparql = ` # Data for a specific sense SELECT - ?description + ?description ?descriptionUrl ?value ?valueLabel ?valueUrl ?source ?sourceUrl WHERE { @@ -56,9 +56,55 @@ ?value ontolex:representation ?valueLabel . BIND("alternative form" AS ?description) } + UNION + { + # Homofon form + BIND(13 AS ?order) + + BIND("homophone form" AS ?description) + BIND("../property/P10822" AS ?descriptionUrl) + + ?form wdt:P10822 ?value . + ?value ontolex:representation ?valueLabel . + } UNION { BIND(20 AS ?order) + + BIND("Described in" AS ?description) + BIND("../property/P1343" AS ?descriptionUrl) + + ?form p:P1343 ?value_statement . + ?value_statement ps:P1343 ?value . + ?value rdfs:label ?valueLabel . + FILTER (LANG(?valueLabel) = 'en') + BIND(CONCAT("reference/", SUBSTR(STR(?value), 32)) AS ?value_Url) + OPTIONAL { + ?value_statement prov:wasDerivedFrom / pr:P854 ?sourceUrl . + BIND("↗" AS ?source) + } + } + UNION + { + BIND(21 AS ?order) + + BIND("Not described in" AS ?description) + BIND("../property/P9660" AS ?descriptionUrl) + + ?form p:P9660 ?value_statement . + ?value_statement ps:P9660 ?value . + ?value rdfs:label ?valueLabel . + FILTER (LANG(?valueLabel) = 'en') + BIND(CONCAT("reference/", SUBSTR(STR(?value), 32)) AS ?value_Url) + OPTIONAL { + ?value_statement prov:wasDerivedFrom / pr:P854 ?sourceUrl . + BIND("↗" AS ?source) + } + } + + UNION + { + BIND(25 AS ?order) BIND("Attested in" AS ?description) ?form p:P5323 ?value_statement . ?value_statement ps:P5323 ?value_ . @@ -82,7 +128,7 @@ } UNION { - BIND(21 AS ?order) + BIND(26 AS ?order) ?lexeme ontolex:lexicalForm ?form . ?lexeme p:P5831 ?value_statement . ?value_statement ps:P5831 ?value . diff --git a/ordia/app/templates/ls.html b/ordia/app/templates/ls.html index 80ca2a8..fa70163 100644 --- a/ordia/app/templates/ls.html +++ b/ordia/app/templates/ls.html @@ -9,8 +9,9 @@ # Data for a specific sense SELECT DISTINCT - ?description + ?description ?descriptionUrl ?value ?valueLabel ?valueUrl + ?source ?sourceLabel ?sourceUrl WHERE { BIND(wd:{{ l }}-{{ s }} AS ?sense) ?lexeme ontolex:sense ?sense ; @@ -123,6 +124,21 @@ ?value ^ontolex:sense / wikibase:lemma ?valueLabel } UNION + { + BIND(15 AS ?order) + BIND("False friend" AS ?description) + BIND("../property/P5976" AS ?descriptionUrl) + ?sense p:P5976 ?value_statement . + ?value_statement ps:P5976 ?value . + ?value ^ontolex:sense / wikibase:lemma ?valueLabel + OPTIONAL { + ?value_statement prov:wasDerivedFrom / pr:P248 ?source_ . + ?source_ rdfs:label ?source . + FILTER (LANG(?source) = 'en') + BIND(CONCAT("reference/", SUBSTR(STR(?source_), 32)) AS ?sourceUrl) + } + } + UNION { BIND(20 AS ?order) BIND("Usage example" AS ?description) diff --git a/ordia/app/templates/property.html b/ordia/app/templates/property.html index c04c7bd..03d8c06 100644 --- a/ordia/app/templates/property.html +++ b/ordia/app/templates/property.html @@ -89,6 +89,32 @@ ` + senseSparql = ` +SELECT + ?lexeme ?lexemeLabel + ?sense ?senseUrl + ?language ?languageLabel + ?value ?valueUrl +WHERE { + ?lexeme wikibase:lemma ?lexemeLabel . + ?lexeme ontolex:sense ?sense_ . + BIND(SUBSTR(STR(?sense_), 32) AS ?sense) + BIND(CONCAT("../", ?sense) AS ?senseUrl) + + ?sense_ wdt:{{ p }} ?value_ . + BIND(SUBSTR(STR(?value_), 32) AS ?value) + BIND(CONCAT("../", ?value) AS ?valueUrl) + ?lexeme dct:language ?language + OPTIONAL { + ?language rdfs:label ?languageLabel . + FILTER (LANG(?languageLabel) = 'en') + } +} +LIMIT 10000 +` + + + $(document).ready(function() { sparqlToDataTable(valuesForLexemesByValueSparql, "#values-for-lexemes-by-value", { @@ -107,8 +133,15 @@ form: '../', language: '../language/', value: '../'}}); + sparqlToDataTable(senseSparql, "#senses", { + linkPrefixes: { + lexeme: '../', + form: '../', + language: '../language/', + value: '../'}}); }); + {% endblock %}