瀏覽代碼

Add queries

Alessia 1 年之前
父節點
當前提交
d124f0903f
共有 3 個文件被更改,包括 133 次插入22 次删除
  1. 2 2
      js/lettera_query.js
  2. 105 8
      js/query/queryMMO.js
  3. 26 12
      js/search.js

+ 2 - 2
js/lettera_query.js

@@ -159,8 +159,8 @@ rdfs:label ?sigla_OVI . \
 } LIMIT 1"
 
 queryTitolo = prefixes + " SELECT DISTINCT ?titolo \
-WHERE {<" + thisUrlParams.link + "> crm:P1_is_identified_by ?title . \
-?title rdf:type crm:E35_Title; \
+WHERE {<" + thisUrlParams.link + "> crm:P1_is_identified_by ?uri_title . \
+?uri_title rdf:type crm:E35_Title ; \
 rdfs:label ?titolo . \
 } LIMIT 1"
 

+ 105 - 8
js/query/queryMMO.js

@@ -7,14 +7,18 @@ PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
 PREFIX person: <http://www.w3.org/ns/person#> \
 PREFIX time: <https://www.w3.org/TR/owl-time#> "
 
-SELECT ?subject ?property ?object ?label
-WHERE{
-?subject rdfs:label ?label .
-?label bif:contains "Fondo".
-FILTER (CONTAINS(?label, "6000256"))
-?subject ?property ?object .
-}
-LIMIT 10000
+/****************
+ * QUERY OGGETTO
+ ****************/
+
+queryLabel = prefixes + " SELECT DISTINCT ?g ?subject ?label ?identifier \
+WHERE {GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
+?subject rdfs:label ?label . \
+?subject crm:P1_is_identified_by ?uri_identifier . \
+?uri_identifier rdfs:label ?identifier ; \
+crm:P2_has_type 'Segnatura' . \
+?label bif:contains "'carocci' AND 'mazzei' AND 'piero'" . \
+}"
 
 queryIdentificatore = prefixes + " SELECT DISTINCT ?g ?subject ?label ?identifier \
 WHERE {GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
@@ -23,4 +27,97 @@ WHERE {GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
 ?uri_identifier rdfs:label ?identifier ; \
 crm:P2_has_type 'Segnatura' . \
 FILTER (CONTAINS(?identifier, " + word + ")) \
+}"
+
+/****************
+ * QUERY CONTENUTI
+ ****************/
+
+queryContenuti1 = prefixes + " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
+WHERE { \
+GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
+rdfs:label ?label .} \
+OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
+OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
+?id_subject rdfs:label ?id ; \
+rdf:type crm:E42_Identifier . } \
+OPTIONAL {?subject crm:P2_has_type ?type . } \
+?subject ?property ?object_Label . \
+?object_Label bif:contains "'arno' AND 'cosimo'" . \
+}"
+
+queryContenuti2 = prefixes + " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
+WHERE { \
+GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
+rdfs:label ?label .} \
+OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
+OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
+?id_subject rdfs:label ?id ; \
+rdf:type crm:E42_Identifier . } \
+OPTIONAL {?subject crm:P2_has_type ?type . } \
+VALUES ?object_type {crm:E1_Entity crm:E1_CRM_Entity crm:E41_Appellation crm:E62_String} \
+?subject ?property ?object  . \
+?object rdfs:label ?object_Label . \
+?object rdf:type ?object_type . \
+?object_Label bif:contains "arno" . \
+FILTER NOT EXISTS { ?property rdfs:label 'label' } \
+}"
+
+queryContenuti3 = " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
+WHERE { \
+GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
+rdfs:label ?label .} \
+OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
+OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
+?id_subject rdfs:label ?id ; \
+rdf:type crm:E42_Identifier . } \
+OPTIONAL { \
+{?subject crm:P2_has_type ?type .} \
+UNION { \
+?subject crm:P2_has_type ?uri_type . \
+?uri_type rdfs:label ?type . } \
+} \
+?subject crm:P67_refers_to ?object_uri . \
+?object_uri rdfs:label ?object_Label . \
+?object_Label bif:contains "arno" . \
+}"
+
+/****************
+ * QUERY PERSONA
+ ****************/
+
+ queryNome = prefixes + " SELECT DISTINCT ?g AS ?graph ?subject ?name \
+ WHERE {GRAPH ?g { ?subject ?property ?object . } \
+ ?subject rdf:type crm:E21_Person ; \
+ foaf:name ?name . \
+ ?name bif:contains "mazzei" . \
+ } "
+
+ queryNote = prefixes + " SELECT DISTINCT ?g AS ?graph ?subject ?name ?note \
+ WHERE {GRAPH ?g { ?subject ?property ?object . } \
+ ?subject rdf:type crm:E21_Person ; \
+ foaf:name ?name . \
+ ?subject crm:P3_has_note ?note . \
+ ?note bif:contains "'camarlingo' AND 'luglio'" . \
+ }"
+
+ queryOccupazione = " SELECT DISTINCT ?g AS ?graph ?subject ?name ?occupation \
+ WHERE {GRAPH ?g { ?subject ?property ?object . } \
+ ?subject rdf:type crm:E21_Person ; \
+ foaf:name ?name . \
+ ?subject schema:hasOccupation ?uri_occupation . \
+ ?uri_occupation rdfs:label ?occupation . \
+ ?occupation bif:contains "lanaiolo" . \
+ }"
+
+ /****************
+ * QUERY LUOGO
+ ****************/
+
+queryLuoghi = prefixes + " SELECT DISTINCT ?g AS ?graph ?subject ?label \
+WHERE {GRAPH ?g { ?subject ?property ?object } \
+?subject rdfs:label ?label ; \
+rdf:type crm:E53_Place ; \
+crm:P168_place_is_defined_by ?coords . \
+?label bif:contains "Firenze" . \
 }"

+ 26 - 12
js/search.js

@@ -2,16 +2,31 @@ $(document).ready(function () {
 	//#######################################
 
 	const graphArray = [
-	["ASPO - Datini", "http://dev.restore.ovi.cnr.it:8890/aspo/datini"], 
-	["ASPO - Ospedale", "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale"],
-	["ASPO - Marcovaldi", "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi"],
-	["ASPO - Gettatelli", "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli"],
-	["ASPO - Autori ASPO", "http://dev.restore.ovi.cnr.it:8890/aspo/actors"],
-	["MPP - Collezione Martini", "http://dev.restore.ovi.cnr.it:8890/mpp/martini"],
-	["MPP - Collezione Ospedale", "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale"],
-	["MPP - Collezione Datini", "http://dev.restore.ovi.cnr.it:8890/mpp/datini"],
-	["OVI - Lettere", "http://dev.restore.ovi.cnr.it:8890/ovi/datini"],
-	["Luoghi", "http://dev.restore.ovi.cnr.it:8890/mpp/places"]
+	["Archivio di Stato di Prato", "http://dev.restore.ovi.cnr.it:8890/aspo/datini"], 
+	["Archivio di Stato di Prato", "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale"],
+	["Archivio di Stato di Prato", "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi"],
+	["Archivio di Stato di Prato", "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli"],
+	["Museo di Palazzo Pretorio di Prato", "http://dev.restore.ovi.cnr.it:8890/mpp/martini"],
+	["Museo di Palazzo Pretorio di Prato", "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale"],
+	["Museo di Palazzo Pretorio di Prato", "http://dev.restore.ovi.cnr.it:8890/mpp/datini"],
+	["Opera del Vocabolario Italiano", "http://dev.restore.ovi.cnr.it:8890/ovi/datini"]
+	];
+
+	const graphAspo = [
+	["Datini", "http://dev.restore.ovi.cnr.it:8890/aspo/datini"], 
+	["Ospedale", "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale"],
+	["Marcovaldi", "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi"],
+	["Gettatelli", "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli"]
+	];
+
+	const graphMpp = [
+	["Collezione Martini", "http://dev.restore.ovi.cnr.it:8890/mpp/martini"],
+	["Collezione Ospedale", "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale"],
+	["Collezione Datini", "http://dev.restore.ovi.cnr.it:8890/mpp/datini"]
+	];
+
+	const graphOvi = [
+	["OVI - Lettere", "http://dev.restore.ovi.cnr.it:8890/ovi/datini"]
 	];
 
 	var graph_selector = document.getElementById("graph_selector");
@@ -90,8 +105,7 @@ $(document).ready(function () {
 		OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
 		?id_subject rdfs:label ?id ; \
 		rdf:type crm:E42_Identifier . } \
-		OPTIONAL {?subject crm:P2_has_type ?entity_type . \
-		?entity_type rdfs:label ?type .} \
+		OPTIONAL {?subject crm:P2_has_type ?type . } \
 		{?subject ?property ?object_Label . " + object_Label + " \
 		} UNION { \
         VALUES ?object_type {crm:E1_Entity crm:E1_CRM_Entity crm:E41_Appellation crm:E62_String} \