managerQuery.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. var queryManager = {
  2. prefixes : {
  3. all : "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
  4. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
  5. PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
  6. PREFIX owl: <http://www.w3.org/2002/07/owl#> \
  7. PREFIX schema: <http://schema.org/> \
  8. PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
  9. PREFIX person: <http://www.w3.org/ns/person#> \
  10. PREFIX time: <https://www.w3.org/TR/owl-time#> "
  11. },
  12. queryMMO: {
  13. queryLabel : " SELECT DISTINCT ?g AS ?graph ?subject ?label ?identifier \
  14. WHERE {<{GRAPH}> \
  15. GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
  16. ?subject rdfs:label ?label . \
  17. ?subject crm:P1_is_identified_by ?uri_identifier . \
  18. ?uri_identifier rdfs:label ?identifier ; \
  19. crm:P2_has_type 'Segnatura' . \
  20. <{WORD}> \
  21. }",
  22. queryArte : " SELECT DISTINCT ?g AS ?graph ?subject ?label ?identifier ?type \
  23. WHERE { <{GRAPH}> \
  24. GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
  25. ?subject rdfs:label ?label ; \
  26. crm:P2_has_type ?type ; \
  27. crm:P1_is_identified_by ?uri_identifier . \
  28. ?uri_identifier rdfs:label ?identifier . \
  29. <{WORD}> \
  30. FILTER (?type = \"Opera d'Arte\") \
  31. }",
  32. queryIdentificatore: " SELECT DISTINCT ?g AS ?graph ?subject ?label ?identifier \
  33. WHERE {<{GRAPH}> \
  34. GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
  35. ?subject rdfs:label ?label . \
  36. ?subject crm:P1_is_identified_by ?uri_identifier . \
  37. ?uri_identifier rdfs:label ?identifier ; \
  38. crm:P2_has_type 'Segnatura' . \
  39. FILTER (CONTAINS(?identifier, '<{WORD}>')) \
  40. }"
  41. },
  42. queryINF: {
  43. queryContenuti1: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  44. WHERE { <{GRAPH}> \
  45. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  46. rdfs:label ?label .} \
  47. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  48. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  49. ?id_subject rdfs:label ?id ; \
  50. rdf:type crm:E42_Identifier . } \
  51. OPTIONAL {?subject crm:P2_has_type ?type . } \
  52. ?subject ?property ?object_Label . \
  53. <{WORD}> \
  54. }",
  55. queryContenuti2: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  56. WHERE { <{GRAPH}> \
  57. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  58. rdfs:label ?label .} \
  59. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  60. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  61. ?id_subject rdfs:label ?id ; \
  62. rdf:type crm:E42_Identifier . } \
  63. OPTIONAL {?subject crm:P2_has_type ?type . } \
  64. VALUES ?object_type {crm:E1_Entity crm:E1_CRM_Entity crm:E41_Appellation crm:E62_String} \
  65. ?subject ?property ?object . \
  66. ?object rdfs:label ?object_Label . \
  67. ?object rdf:type ?object_type . \
  68. <{WORD}> \
  69. FILTER NOT EXISTS { ?property rdfs:label 'label' } \
  70. }",
  71. queryContenuti3: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  72. WHERE {<{GRAPH}> \
  73. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  74. rdfs:label ?label .} \
  75. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  76. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  77. ?id_subject rdfs:label ?id ; \
  78. rdf:type crm:E42_Identifier . } \
  79. OPTIONAL {?subject crm:P2_has_type ?uri_type . \
  80. ?uri_type rdfs:label ?type . } \
  81. ?subject crm:P67_refers_to ?object_uri . \
  82. ?object_uri rdfs:label ?object_Label . \
  83. <{WORD}> \
  84. }"
  85. },
  86. queryPER: {
  87. queryNome: " SELECT DISTINCT ?g AS ?graph ?subject ?name \
  88. WHERE { <{GRAPH}> \
  89. GRAPH ?g { ?subject ?property ?object . } \
  90. ?subject rdf:type crm:E21_Person ; \
  91. foaf:name ?name . \
  92. ?name bif:contains <{WORD}> . \
  93. } ",
  94. queryNote: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?note \
  95. WHERE {<{GRAPH}> \
  96. GRAPH ?g { ?subject ?property ?object . } \
  97. ?subject rdf:type crm:E21_Person ; \
  98. foaf:name ?name . \
  99. ?subject crm:P3_has_note ?note . \
  100. ?note bif:contains <{WORD}> . \
  101. }",
  102. queryOccupazione: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?occupation \
  103. WHERE {<{GRAPH}> \
  104. GRAPH ?g { ?subject ?property ?object . } \
  105. ?subject rdf:type crm:E21_Person ; \
  106. foaf:name ?name . \
  107. ?subject schema:hasOccupation ?uri_occupation . \
  108. ?uri_occupation rdfs:label ?occupation . \
  109. ?occupation bif:contains <{WORD}> . \
  110. }"
  111. },
  112. queryLG: {
  113. queryLuoghi : " SELECT DISTINCT ?g AS ?graph ?subject ?label \
  114. WHERE {<{GRAPH}> \
  115. GRAPH ?g { ?subject ?property ?object } \
  116. ?subject rdfs:label ?label ; \
  117. rdf:type crm:E53_Place ; \
  118. crm:P168_place_is_defined_by ?coords . \
  119. ?label bif:contains <{WORD}> . \
  120. }"
  121. },
  122. queryRES: {
  123. queryExchange : " SELECT DISTINCT ?uri_document ?document ?time_span_from ?time_span_to ?uri_place_from ?place_from ?uri_place_to ?place_to \
  124. { \
  125. ?event_from rdfs:subClassOf ?event ; \
  126. rdf:type crm:EL2_Send_Letter . \
  127. ?event_to rdfs:subClassOf ?event ; \
  128. rdf:type crm:EL3_Receive_Letter . \
  129. \
  130. ?event_from crm:P01_has_domain ?pc_from . \
  131. ?pc_from crm:P02_has_range <{MITTENTE}> . \
  132. OPTIONAL {?event_from crm:P4_has_time-span ?uri_time_span_from . \
  133. ?uri_time_span_from rdfs:label ?time_span_from} \
  134. OPTIONAL {?event_from crm:P27_moved_from ?aspo_place_from . \
  135. ?aspo_place_from owl:sameAs ?uri_place_from . \
  136. ?uri_place_from rdfs:label ?place_from ; \
  137. crm:P168_place_is_defined_by ?coords_from} \
  138. \
  139. ?event_to crm:P01_has_domain ?pc_to . \
  140. ?pc_to crm:P02_has_range <{DESTINATARIO}> . \
  141. OPTIONAL {?event_to crm:P4_has_time-span ?uri_time_span_to . \
  142. ?uri_time_span_to rdfs:label ?time_span_to} \
  143. OPTIONAL {?event_to crm:P26_moved_to ?aspo_place_to . \
  144. ?aspo_place_to owl:sameAs ?uri_place_to . \
  145. ?uri_place_to rdfs:label ?place_to ; \
  146. crm:P168_place_is_defined_by ?coords_to} \
  147. \
  148. ?uri_document crm:P25i_moved_by ?event ; \
  149. rdfs:label ?document . \
  150. }",
  151. queryEsploraDocumenti : " SELECT DISTINCT ?document ?uri_document ?sigla ?time_span ?year ?month ?day ?text ?uri_infObj (group_concat(distinct ?type ;separator=', ') as ?types) \
  152. WHERE { \
  153. { ?uri_thing crm:P128_carries <{URI}> . \
  154. ?uri_infObj crm:P67_refers_to ?uri_thing . \
  155. } UNION { \
  156. ?uri_infObj crm:P67_refers_to <{URI}> . } \
  157. ?uri_document crm:P128_carries ?uri_infObj ; \
  158. rdfs:label ?document . \
  159. OPTIONAL {?uri_infObj crm:P2_has_type ?uri_type . \
  160. ?uri_type rdfs:label ?type . } \
  161. OPTIONAL {?uri_infObj crm:P190_has_symbolic_content ?text .} \
  162. GRAPH <http://dev.restore.ovi.cnr.it:8890/aspo/datini> {?uri_document crm:P25i_moved_by ?mov_ev .} \
  163. ?send rdfs:subClassOf ?mov_ev ; \
  164. rdf:type crm:EL2_Send_Letter . \
  165. OPTIONAL {?uri_infObj crm:P1_is_identified_by ?uri_sigla . \
  166. ?uri_sigla crm:P2_has_type ?sigla_type ; \
  167. rdfs:label ?sigla . \
  168. ?sigla_type rdfs:label 'Sigla OVI' .} \
  169. OPTIONAL {?send crm:P4_has_time-span ?uri_time_span . \
  170. ?uri_time_span rdfs:label ?time_span . \
  171. OPTIONAL {?uri_time_span time:year ?year } \
  172. OPTIONAL {?uri_time_span time:month ?month } \
  173. OPTIONAL {?uri_time_span time:day ?day } \
  174. } \
  175. } \
  176. ORDER BY ?year ?month ?day",
  177. queryTrovaSigla : " SELECT DISTINCT ?id \
  178. WHERE {?subject rdf:type crm:E73_Information_Object; \
  179. rdfs:label '<{SIGLA}>' . \
  180. ?uri_lemma crm:P67_refers_to ?subject; \
  181. rdfs:label '<{LEMMA}>' ; \
  182. crm:P1_is_identified_by ?uri_id . \
  183. ?uri_id rdfs:label ?id} \
  184. LIMIT 1",
  185. queryEsploraMappa : " SELECT DISTINCT ?place ?label ?coordinates \
  186. WHERE { \
  187. VALUES ?uri {<{LEMMA}>} \
  188. ?uri_thing crm:P128_carries ?uri . \
  189. ?uri_infObj crm:P67_refers_to ?uri_thing . \
  190. ?uri_document crm:P128_carries ?uri_infObj ; \
  191. rdfs:label ?document ; \
  192. crm:P25i_moved_by ?mov_ev . \
  193. ?ev_send rdfs:subClassOf ?mov_ev ; \
  194. rdf:type crm:EL2_Send_Letter ; \
  195. crm:P27_moved_from ?place_from . \
  196. ?place_from rdf:type crm:E53_Place ; \
  197. owl:sameAs ?place . \
  198. ?place rdfs:label ?label ; \
  199. crm:P168_place_is_defined_by ?coordinates . \
  200. }"
  201. },
  202. querySchedaPersona : {
  203. queryNetwork : " SELECT COUNT(?event1) AS ?count1 COUNT(?event2) AS ?count2 COUNT(?event3) AS ?count3 ?uri2 SAMPLE(?label2) AS ?text \
  204. WHERE { \
  205. {?event1 rdf:type crm:EL1_Exchange_Letters . \
  206. ?event_to rdfs:subClassOf ?event1; \
  207. rdf:type crm:EL2_Send_Letter ; \
  208. crm:P01_has_domain ?pc_to . \
  209. ?pc_to crm:P02_has_range ?uri . \
  210. ?uri rdfs:label ?label . \
  211. ?event_from rdfs:subClassOf ?event1; \
  212. rdf:type crm:EL3_Receive_Letter; \
  213. crm:P01_has_domain ?pc_from . \
  214. ?pc_from crm:P02_has_range ?uri2 . \
  215. ?uri2 rdfs:label ?label2 . \
  216. FILTER (?uri = <{URI}>) \
  217. } UNION { \
  218. ?event2 rdf:type crm:EL1_Exchange_Letters . \
  219. ?event_to rdfs:subClassOf ?event2; \
  220. rdf:type crm:EL3_Receive_Letter ; \
  221. crm:P01_has_domain ?pc_from . \
  222. ?pc_from crm:P02_has_range ?uri . \
  223. ?uri rdfs:label ?label . \
  224. ?event_from rdfs:subClassOf ?event2; \
  225. rdf:type crm:EL2_Send_Letter; \
  226. crm:P01_has_domain ?pc_to . \
  227. ?pc_to crm:P02_has_range ?uri2 . \
  228. ?uri2 rdfs:label ?label2 . \
  229. FILTER (?uri = <{URI}>) \
  230. } UNION { \
  231. ?pc crm:P02_has_range <{URI}> . \
  232. ?event3 crm:P01_has_domain ?pc . \
  233. ?event3 crm:P01_has_domain ?pc1 . \
  234. ?pc1 crm:P02_has_range ?uri2 . \
  235. ?uri2 rdfs:label ?label2 . \
  236. FILTER (?pc != ?pc1) \
  237. } \
  238. }",
  239. queryNetwork2 : " SELECT DISTINCT ?uri_person ?name \
  240. WHERE { \
  241. VALUES ?uri {<{URI}>} \
  242. ?pc crm:P02_has_range ?uri . \
  243. ?event crm:P01_has_domain ?pc . \
  244. ?event crm:P01_has_domain ?pc1 . \
  245. ?pc1 crm:P02_has_range ?uri_person . \
  246. ?uri_person rdfs:label ?name . \
  247. FILTER (?pc != ?pc1) \
  248. }"
  249. }
  250. };