managerQuery.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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 ?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 { \
  80. {?subject crm:P2_has_type ?type .} \
  81. UNION { \
  82. ?subject crm:P2_has_type ?uri_type . \
  83. ?uri_type rdfs:label ?type . } \
  84. } \
  85. ?subject crm:P67_refers_to ?object_uri . \
  86. ?object_uri rdfs:label ?object_Label . \
  87. <{WORD}> \
  88. }"
  89. },
  90. queryPER: {
  91. queryNome: " SELECT DISTINCT ?g AS ?graph ?subject ?name \
  92. WHERE { <{GRAPH}> \
  93. GRAPH ?g { ?subject ?property ?object . } \
  94. ?subject rdf:type crm:E21_Person ; \
  95. foaf:name ?name . \
  96. ?name bif:contains <{WORD}> . \
  97. } ",
  98. queryNote: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?note \
  99. WHERE {<{GRAPH}> \
  100. GRAPH ?g { ?subject ?property ?object . } \
  101. ?subject rdf:type crm:E21_Person ; \
  102. foaf:name ?name . \
  103. ?subject crm:P3_has_note ?note . \
  104. ?note bif:contains <{WORD}> . \
  105. }",
  106. queryOccupazione: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?occupation \
  107. WHERE {<{GRAPH}> \
  108. GRAPH ?g { ?subject ?property ?object . } \
  109. ?subject rdf:type crm:E21_Person ; \
  110. foaf:name ?name . \
  111. ?subject schema:hasOccupation ?uri_occupation . \
  112. ?uri_occupation rdfs:label ?occupation . \
  113. ?occupation bif:contains <{WORD}> . \
  114. }"
  115. },
  116. queryLG: {
  117. queryLuoghi : " SELECT DISTINCT ?g AS ?graph ?subject ?label \
  118. WHERE {<{GRAPH}> \
  119. GRAPH ?g { ?subject ?property ?object } \
  120. ?subject rdfs:label ?label ; \
  121. rdf:type crm:E53_Place ; \
  122. crm:P168_place_is_defined_by ?coords . \
  123. ?label bif:contains <{WORD}> . \
  124. }"
  125. }
  126. };
  127. /*
  128. $.jsonManager
  129. {
  130. connection : [
  131. queries = {
  132. prefixes : {
  133. pref : "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
  134. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
  135. PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
  136. PREFIX owl: <http://www.w3.org/2002/07/owl#> \
  137. PREFIX schema: <http://schema.org/> \
  138. PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
  139. PREFIX person: <http://www.w3.org/ns/person#> \
  140. PREFIX time: <https://www.w3.org/TR/owl-time#> "
  141. },
  142. sparqlMMO : {
  143. queryLabel : " SELECT DISTINCT ?g ?subject ?label ?identifier \
  144. WHERE {<{GRAPH}> \
  145. GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
  146. ?subject rdfs:label ?label . \
  147. ?subject crm:P1_is_identified_by ?uri_identifier . \
  148. ?uri_identifier rdfs:label ?identifier ; \
  149. crm:P2_has_type 'Segnatura' . \
  150. ?label bif:contains <{WORD}> . \
  151. }",
  152. queryIdentificatore: " SELECT DISTINCT ?g ?subject ?label ?identifier \
  153. WHERE {<{GRAPH}> \
  154. GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
  155. ?subject rdfs:label ?label . \
  156. ?subject crm:P1_is_identified_by ?uri_identifier . \
  157. ?uri_identifier rdfs:label ?identifier ; \
  158. crm:P2_has_type 'Segnatura' . \
  159. FILTER (CONTAINS(?identifier, <{WORD}>)) \
  160. }"
  161. },
  162. sparqlINF : {
  163. queryContenuti1: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  164. WHERE { <{GRAPH}> \
  165. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  166. rdfs:label ?label .} \
  167. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  168. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  169. ?id_subject rdfs:label ?id ; \
  170. rdf:type crm:E42_Identifier . } \
  171. OPTIONAL {?subject crm:P2_has_type ?type . } \
  172. ?subject ?property ?object_Label . \
  173. ?object_Label bif:contains <{WORD}> . \
  174. }",
  175. queryContenuti2: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  176. WHERE { <{GRAPH}> \
  177. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  178. rdfs:label ?label .} \
  179. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  180. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  181. ?id_subject rdfs:label ?id ; \
  182. rdf:type crm:E42_Identifier . } \
  183. OPTIONAL {?subject crm:P2_has_type ?type . } \
  184. VALUES ?object_type {crm:E1_Entity crm:E1_CRM_Entity crm:E41_Appellation crm:E62_String} \
  185. ?subject ?property ?object . \
  186. ?object rdfs:label ?object_Label . \
  187. ?object rdf:type ?object_type . \
  188. ?object_Label bif:contains <{WORD}> . \
  189. FILTER NOT EXISTS { ?property rdfs:label 'label' } \
  190. }",
  191. queryContenuti3: " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  192. WHERE {<{GRAPH}> \
  193. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  194. rdfs:label ?label .} \
  195. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  196. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  197. ?id_subject rdfs:label ?id ; \
  198. rdf:type crm:E42_Identifier . } \
  199. OPTIONAL { \
  200. {?subject crm:P2_has_type ?type .} \
  201. UNION { \
  202. ?subject crm:P2_has_type ?uri_type . \
  203. ?uri_type rdfs:label ?type . } \
  204. } \
  205. ?subject crm:P67_refers_to ?object_uri . \
  206. ?object_uri rdfs:label ?object_Label . \
  207. ?object_Label bif:contains <{WORD}> . \
  208. }"
  209. },
  210. sparqlPER : {
  211. queryNome: " SELECT DISTINCT ?g AS ?graph ?subject ?name \
  212. WHERE {<{GRAPH}> \
  213. GRAPH ?g { ?subject ?property ?object . } \
  214. ?subject rdf:type crm:E21_Person ; \
  215. foaf:name ?name . \
  216. ?name bif:contains <{WORD}> . \
  217. } ",
  218. queryNote: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?note \
  219. WHERE {<{GRAPH}> \
  220. GRAPH ?g { ?subject ?property ?object . } \
  221. ?subject rdf:type crm:E21_Person ; \
  222. foaf:name ?name . \
  223. ?subject crm:P3_has_note ?note . \
  224. ?note bif:contains <{WORD}> . \
  225. }",
  226. queryOccupazione: " SELECT DISTINCT ?g AS ?graph ?subject ?name ?occupation \
  227. WHERE {<{GRAPH}> \
  228. GRAPH ?g { ?subject ?property ?object . } \
  229. ?subject rdf:type crm:E21_Person ; \
  230. foaf:name ?name . \
  231. ?subject schema:hasOccupation ?uri_occupation . \
  232. ?uri_occupation rdfs:label ?occupation . \
  233. ?occupation bif:contains <{WORD}> . \
  234. }"
  235. },
  236. sparqlLG : {
  237. queryLuoghi : " SELECT DISTINCT ?g AS ?graph ?subject ?label \
  238. WHERE {<{GRAPH}> \
  239. GRAPH ?g { ?subject ?property ?object } \
  240. ?subject rdfs:label ?label ; \
  241. rdf:type crm:E53_Place ; \
  242. crm:P168_place_is_defined_by ?coords . \
  243. ?label bif:contains <{WORD}> . \
  244. }"
  245. },
  246. endpoint : 'http://dev.restore.ovi.cnr.it:8890/sparql/',
  247. },
  248. ]
  249. }
  250. */