queryMMO.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. prefixes = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
  2. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
  3. PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
  4. PREFIX owl: <http://www.w3.org/2002/07/owl#> \
  5. PREFIX schema: <http://schema.org/> \
  6. PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
  7. PREFIX person: <http://www.w3.org/ns/person#> \
  8. PREFIX time: <https://www.w3.org/TR/owl-time#> "
  9. /****************
  10. * QUERY OGGETTO
  11. ****************/
  12. queryLabel = prefixes + " SELECT DISTINCT ?g ?subject ?label ?identifier \
  13. WHERE {GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
  14. ?subject rdfs:label ?label . \
  15. ?subject crm:P1_is_identified_by ?uri_identifier . \
  16. ?uri_identifier rdfs:label ?identifier ; \
  17. crm:P2_has_type 'Segnatura' . \
  18. ?label bif:contains "'carocci' AND 'mazzei' AND 'piero'" . \
  19. }"
  20. queryIdentificatore = prefixes + " SELECT DISTINCT ?g ?subject ?label ?identifier \
  21. WHERE {GRAPH ?g {?subject rdf:type crm:E22_Man-Made_Object } \
  22. ?subject rdfs:label ?label . \
  23. ?subject crm:P1_is_identified_by ?uri_identifier . \
  24. ?uri_identifier rdfs:label ?identifier ; \
  25. crm:P2_has_type 'Segnatura' . \
  26. FILTER (CONTAINS(?identifier, " + word + ")) \
  27. }"
  28. /****************
  29. * QUERY CONTENUTI
  30. ****************/
  31. queryContenuti1 = prefixes + " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  32. WHERE { \
  33. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  34. rdfs:label ?label .} \
  35. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  36. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  37. ?id_subject rdfs:label ?id ; \
  38. rdf:type crm:E42_Identifier . } \
  39. OPTIONAL {?subject crm:P2_has_type ?type . } \
  40. ?subject ?property ?object_Label . \
  41. ?object_Label bif:contains "'arno' AND 'cosimo'" . \
  42. }"
  43. queryContenuti2 = prefixes + " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  44. WHERE { \
  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. VALUES ?object_type {crm:E1_Entity crm:E1_CRM_Entity crm:E41_Appellation crm:E62_String} \
  53. ?subject ?property ?object . \
  54. ?object rdfs:label ?object_Label . \
  55. ?object rdf:type ?object_type . \
  56. ?object_Label bif:contains "arno" . \
  57. FILTER NOT EXISTS { ?property rdfs:label 'label' } \
  58. }"
  59. queryContenuti3 = " SELECT DISTINCT ?g AS ?graph ?Physical_Object ?subject ?label ?id (group_concat(distinct ?type ;separator=', ') as ?types) (SAMPLE(?object_Label) AS ?text) \
  60. WHERE { \
  61. GRAPH ?g {?subject rdf:type crm:E73_Information_Object ; \
  62. rdfs:label ?label .} \
  63. OPTIONAL {?Physical_Object crm:P128_carries ?subject .} \
  64. OPTIONAL {?subject crm:P1_is_identified_by ?id_subject . \
  65. ?id_subject rdfs:label ?id ; \
  66. rdf:type crm:E42_Identifier . } \
  67. OPTIONAL { \
  68. {?subject crm:P2_has_type ?type .} \
  69. UNION { \
  70. ?subject crm:P2_has_type ?uri_type . \
  71. ?uri_type rdfs:label ?type . } \
  72. } \
  73. ?subject crm:P67_refers_to ?object_uri . \
  74. ?object_uri rdfs:label ?object_Label . \
  75. ?object_Label bif:contains "arno" . \
  76. }"
  77. /****************
  78. * QUERY PERSONA
  79. ****************/
  80. queryNome = prefixes + " SELECT DISTINCT ?g AS ?graph ?subject ?name \
  81. WHERE {GRAPH ?g { ?subject ?property ?object . } \
  82. ?subject rdf:type crm:E21_Person ; \
  83. foaf:name ?name . \
  84. ?name bif:contains "mazzei" . \
  85. } "
  86. queryNote = prefixes + " SELECT DISTINCT ?g AS ?graph ?subject ?name ?note \
  87. WHERE {GRAPH ?g { ?subject ?property ?object . } \
  88. ?subject rdf:type crm:E21_Person ; \
  89. foaf:name ?name . \
  90. ?subject crm:P3_has_note ?note . \
  91. ?note bif:contains "'camarlingo' AND 'luglio'" . \
  92. }"
  93. queryOccupazione = " SELECT DISTINCT ?g AS ?graph ?subject ?name ?occupation \
  94. WHERE {GRAPH ?g { ?subject ?property ?object . } \
  95. ?subject rdf:type crm:E21_Person ; \
  96. foaf:name ?name . \
  97. ?subject schema:hasOccupation ?uri_occupation . \
  98. ?uri_occupation rdfs:label ?occupation . \
  99. ?occupation bif:contains "lanaiolo" . \
  100. }"
  101. /****************
  102. * QUERY LUOGO
  103. ****************/
  104. queryLuoghi = prefixes + " SELECT DISTINCT ?g AS ?graph ?subject ?label \
  105. WHERE {GRAPH ?g { ?subject ?property ?object } \
  106. ?subject rdfs:label ?label ; \
  107. rdf:type crm:E53_Place ; \
  108. crm:P168_place_is_defined_by ?coords . \
  109. ?label bif:contains "Firenze" . \
  110. }"