sparna-git / Sparnatural

Sparnatural : visual knowledge graph explorer with SPARQL, in the browser, configurable with SHACL
http://sparnatural.eu
GNU Lesser General Public License v3.0
225 stars 41 forks source link

JSON query generation generates nested optional while it should not #658

Closed ch-sander closed 4 weeks ago

ch-sander commented 4 weeks ago

related to #646 and #647 When importing (sparnatural.loadQuery(json)) the following Sparnatural binding (successfully built, executed, and exported with Sparnatural) I get a console error (see below) and only half of the branches are built in the UI. Why is that?

Import

{
  "distinct": true,
  "variables": [
    {
      "termType": "Variable",
      "value": "place_1"
    },
    {
      "termType": "Variable",
      "value": "type_4"
    },
    {
      "termType": "Variable",
      "value": "institution_6"
    },
    {
      "termType": "Variable",
      "value": "name_14"
    },
    {
      "expression": {
        "type": "aggregate",
        "aggregation": "min",
        "distinct": false,
        "expression": {
          "termType": "Variable",
          "value": "date_value_16"
        }
      },
      "variable": {
        "termType": "Variable",
        "value": "date_value_16_min"
      }
    },
    {
      "expression": {
        "type": "aggregate",
        "aggregation": "count",
        "distinct": false,
        "expression": {
          "termType": "Variable",
          "value": "object_8"
        }
      },
      "variable": {
        "termType": "Variable",
        "value": "object_8_count"
      }
    }
  ],
  "order": "asc",
  "branches": [
    {
      "line": {
        "s": "place_1",
        "p": "http://www.graceful17.org/shacl/sparnatural-config/called",
        "o": "name_2",
        "sType": "http://www.graceful17.org/shacl/sparnatural-config/place",
        "oType": "http://www.graceful17.org/shacl/sparnatural-config/name",
        "values": []
      },
      "children": []
    },
    {
      "line": {
        "s": "place_1",
        "p": "http://www.graceful17.org/shacl/sparnatural-config/has_main_type",
        "o": "type_4",
        "sType": "http://www.graceful17.org/shacl/sparnatural-config/place",
        "oType": "http://www.graceful17.org/shacl/sparnatural-config/type",
        "values": []
      },
      "children": []
    },
    {
      "line": {
        "s": "place_1",
        "p": "http://www.graceful17.org/shacl/sparnatural-config/is_primary_place_of",
        "o": "institution_6",
        "sType": "http://www.graceful17.org/shacl/sparnatural-config/place",
        "oType": "http://www.graceful17.org/shacl/sparnatural-config/institution",
        "values": []
      },
      "children": [
        {
          "line": {
            "s": "institution_6",
            "p": "http://www.graceful17.org/shacl/sparnatural-config/holds_immaterial_object",
            "o": "object_8",
            "sType": "http://www.graceful17.org/shacl/sparnatural-config/institution",
            "oType": "http://www.graceful17.org/shacl/sparnatural-config/object",
            "values": []
          },
          "children": [
            {
              "line": {
                "s": "object_8",
                "p": "http://www.graceful17.org/shacl/sparnatural-config/object_related_to_event",
                "o": "event_10",
                "sType": "http://www.graceful17.org/shacl/sparnatural-config/object",
                "oType": "http://www.graceful17.org/shacl/sparnatural-config/event",
                "values": []
              },
              "children": [
                {
                  "line": {
                    "s": "event_10",
                    "p": "http://www.graceful17.org/shacl/sparnatural-config/event_date",
                    "o": "date_12",
                    "sType": "http://www.graceful17.org/shacl/sparnatural-config/event",
                    "oType": "http://www.graceful17.org/shacl/sparnatural-config/date",
                    "values": []
                  },
                  "children": [
                    {
                      "line": {
                        "s": "date_12",
                        "p": "http://www.graceful17.org/shacl/sparnatural-config/called",
                        "o": "name_14",
                        "sType": "http://www.graceful17.org/shacl/sparnatural-config/date",
                        "oType": "http://www.graceful17.org/shacl/sparnatural-config/name",
                        "values": []
                      },
                      "children": [],
                      "optional": true
                    },
                    {
                      "line": {
                        "s": "date_12",
                        "p": "http://www.graceful17.org/shacl/sparnatural-config/started",
                        "o": "date_value_16",
                        "sType": "http://www.graceful17.org/shacl/sparnatural-config/date",
                        "oType": "http://www.graceful17.org/shacl/sparnatural-config/date_value",
                        "values": []
                      },
                      "children": [],
                      "optional": true
                    }
                  ],
                  "optional": true
                }
              ],
              "optional": true
            }
          ],
          "optional": true
        }
      ],
      "optional": true
    }
  ]
}

Console

QueryLoader.ts:153 Uncaught TypeError: Cannot read properties of undefined (reading 'widgetHtml')
    at _h.ch (QueryLoader.ts:153:73)
    at _h.e (QueryLoader.ts:117:27)
    at _h.e (QueryLoader.ts:124:55)
    at QueryLoader.ts:66:57
    at Array.forEach (<anonymous>)
    at _h.oh (QueryLoader.ts:64:18)
    at _h.loadQuery (QueryLoader.ts:28:48)
    at Sh.loadQuery (SparnaturalElement.ts:132:17)
    at HTMLButtonElement.<anonymous> (main.js:120:14)

Full Log

ask:167 

       GET https://dataria.org/static/sparnatural/sparnatural-yasgui-plugins_small.js net::ERR_ABORTED 404 (Not Found)
SparnaturalSpecificationFactory.ts:38 Configuring from 1 configs
BaseRDFReader.ts:63 Importing in store '/static/sparnatural/config.ttl'
index.ts:533 Wanted to initialize plugin table but could not find a matching registered plugin
value @ index.ts:533
n @ index.ts:74
(anonymous) @ main.js:32
index.ts:533 Wanted to initialize plugin response but could not find a matching registered plugin
value @ index.ts:533
n @ index.ts:74
(anonymous) @ main.js:32
BaseRDFReader.ts:115 Attempt to parse determining format from path /static/sparnatural/config.ttl...
BaseRDFReader.ts:92 Specification store populated with 1810 triples.
SHACLSpecificationProvider.ts:405 Initial entity list http://www.graceful17.org/shacl/sparnatural-config/event,http://www.graceful17.org/shacl/sparnatural-config/object,http://www.graceful17.org/shacl/sparnatural-config/type,http://www.graceful17.org/shacl/sparnatural-config/place,http://www.graceful17.org/shacl/sparnatural-config/institution,http://www.graceful17.org/shacl/sparnatural-config/date,http://www.graceful17.org/shacl/sparnatural-config/person,http://www.graceful17.org/shacl/sparnatural-config/archive,http://www.graceful17.org/shacl/sparnatural-config/source,http://www.graceful17.org/shacl/sparnatural-config/entry,http://www.graceful17.org/shacl/sparnatural-config/monetary_value,http://www.graceful17.org/shacl/sparnatural-config/dedication
ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 [An]
HierarchicalClassSelectBuilder.ts:526 [{…}]
SparnaturalComponent.ts:52 Found languages in configuration : 
SHACLSpecificationProvider.ts:405 Initial entity list http://www.graceful17.org/shacl/sparnatural-config/event,http://www.graceful17.org/shacl/sparnatural-config/object,http://www.graceful17.org/shacl/sparnatural-config/type,http://www.graceful17.org/shacl/sparnatural-config/place,http://www.graceful17.org/shacl/sparnatural-config/institution,http://www.graceful17.org/shacl/sparnatural-config/date,http://www.graceful17.org/shacl/sparnatural-config/person,http://www.graceful17.org/shacl/sparnatural-config/archive,http://www.graceful17.org/shacl/sparnatural-config/source,http://www.graceful17.org/shacl/sparnatural-config/entry,http://www.graceful17.org/shacl/sparnatural-config/monetary_value,http://www.graceful17.org/shacl/sparnatural-config/dedication
ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 [An]
HierarchicalClassSelectBuilder.ts:526 [{…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/place', valuePath: ''}
SHACLSpecificationEntity.ts:217 id:http://www.graceful17.org/shacl/sparnatural-config/map
id:http://www.graceful17.org/shacl/sparnatural-config/name
id:http://www.graceful17.org/shacl/sparnatural-config/number
id:http://special/ZZ_Other
id:http://www.graceful17.org/shacl/sparnatural-config/anything !disabled
  id:http://www.graceful17.org/shacl/sparnatural-config/event
    id:http://www.graceful17.org/shacl/sparnatural-config/papal_grace
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_provision
  id:http://www.graceful17.org/shacl/sparnatural-config/object
    id:http://www.graceful17.org/shacl/sparnatural-config/immaterial_object
      id:http://www.graceful17.org/shacl/sparnatural-config/absolution
      id:http://www.graceful17.org/shacl/sparnatural-config/benefice
      id:http://www.graceful17.org/shacl/sparnatural-config/coadjutary
      id:http://www.graceful17.org/shacl/sparnatural-config/commenda
      id:http://www.graceful17.org/shacl/sparnatural-config/dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/indult
      id:http://www.graceful17.org/shacl/sparnatural-config/pension
  id:http://www.graceful17.org/shacl/sparnatural-config/type
  id:http://www.graceful17.org/shacl/sparnatural-config/place
    id:http://www.graceful17.org/shacl/sparnatural-config/continent
    id:http://www.graceful17.org/shacl/sparnatural-config/locality
    id:http://www.graceful17.org/shacl/sparnatural-config/location
    id:http://www.graceful17.org/shacl/sparnatural-config/region
    id:http://www.graceful17.org/shacl/sparnatural-config/subregion
  id:http://www.graceful17.org/shacl/sparnatural-config/institution
    id:http://www.graceful17.org/shacl/sparnatural-config/archdeanery
    id:http://www.graceful17.org/shacl/sparnatural-config/archdiocese
    id:http://www.graceful17.org/shacl/sparnatural-config/deanery
    id:http://www.graceful17.org/shacl/sparnatural-config/ecclesiastical_province
    id:http://www.graceful17.org/shacl/sparnatural-config/parish
    id:http://www.graceful17.org/shacl/sparnatural-config/seat_of_worship
    id:http://www.graceful17.org/shacl/sparnatural-config/suffragan_diocese
    id:http://www.graceful17.org/shacl/sparnatural-config/supreme_body_of_government
    id:http://www.graceful17.org/shacl/sparnatural-config/vicariate
  id:http://www.graceful17.org/shacl/sparnatural-config/date
  id:http://www.graceful17.org/shacl/sparnatural-config/person
    id:http://www.graceful17.org/shacl/sparnatural-config/natural_person
  id:http://www.graceful17.org/shacl/sparnatural-config/archive
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_archive
  id:http://www.graceful17.org/shacl/sparnatural-config/source
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_source
      id:http://www.graceful17.org/shacl/sparnatural-config/textual_source
        id:http://www.graceful17.org/shacl/sparnatural-config/serial_source
  id:http://www.graceful17.org/shacl/sparnatural-config/entry
    id:http://www.graceful17.org/shacl/sparnatural-config/narrative
    id:http://www.graceful17.org/shacl/sparnatural-config/record
  id:http://www.graceful17.org/shacl/sparnatural-config/monetary_value
  id:http://www.graceful17.org/shacl/sparnatural-config/dedication
    id:http://www.graceful17.org/shacl/sparnatural-config/mystery_of_faith
    id:http://www.graceful17.org/shacl/sparnatural-config/saint

ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 (5) [An, An, An, An, An]
HierarchicalClassSelectBuilder.ts:526 (5) [{…}, {…}, {…}, {…}, {…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/name', valuePath: ''}
ObjectPropertyTypeId.ts:189 rootNodes
ObjectPropertyTypeId.ts:190 (3) [An, An, An]
HierarchicalClassSelectBuilder.ts:526 (3) [{…}, {…}, {…}]
ObjectPropertyTypeId.ts:128 {value: 'http://www.graceful17.org/shacl/sparnatural-config/called', valuePath: ''}
WidgetWrapper.ts:70 widget component already there, rendering widget component
SHACLSpecificationProvider.ts:405 Initial entity list http://www.graceful17.org/shacl/sparnatural-config/event,http://www.graceful17.org/shacl/sparnatural-config/object,http://www.graceful17.org/shacl/sparnatural-config/type,http://www.graceful17.org/shacl/sparnatural-config/place,http://www.graceful17.org/shacl/sparnatural-config/institution,http://www.graceful17.org/shacl/sparnatural-config/date,http://www.graceful17.org/shacl/sparnatural-config/person,http://www.graceful17.org/shacl/sparnatural-config/archive,http://www.graceful17.org/shacl/sparnatural-config/source,http://www.graceful17.org/shacl/sparnatural-config/entry,http://www.graceful17.org/shacl/sparnatural-config/monetary_value,http://www.graceful17.org/shacl/sparnatural-config/dedication
ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 [An]
HierarchicalClassSelectBuilder.ts:526 [{…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/place', valuePath: ''}
SHACLSpecificationEntity.ts:217 id:http://www.graceful17.org/shacl/sparnatural-config/map
id:http://www.graceful17.org/shacl/sparnatural-config/name
id:http://www.graceful17.org/shacl/sparnatural-config/number
id:http://special/ZZ_Other
id:http://www.graceful17.org/shacl/sparnatural-config/anything !disabled
  id:http://www.graceful17.org/shacl/sparnatural-config/event
    id:http://www.graceful17.org/shacl/sparnatural-config/papal_grace
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_provision
  id:http://www.graceful17.org/shacl/sparnatural-config/object
    id:http://www.graceful17.org/shacl/sparnatural-config/immaterial_object
      id:http://www.graceful17.org/shacl/sparnatural-config/absolution
      id:http://www.graceful17.org/shacl/sparnatural-config/benefice
      id:http://www.graceful17.org/shacl/sparnatural-config/coadjutary
      id:http://www.graceful17.org/shacl/sparnatural-config/commenda
      id:http://www.graceful17.org/shacl/sparnatural-config/dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/indult
      id:http://www.graceful17.org/shacl/sparnatural-config/pension
  id:http://www.graceful17.org/shacl/sparnatural-config/type
  id:http://www.graceful17.org/shacl/sparnatural-config/place
    id:http://www.graceful17.org/shacl/sparnatural-config/continent
    id:http://www.graceful17.org/shacl/sparnatural-config/locality
    id:http://www.graceful17.org/shacl/sparnatural-config/location
    id:http://www.graceful17.org/shacl/sparnatural-config/region
    id:http://www.graceful17.org/shacl/sparnatural-config/subregion
  id:http://www.graceful17.org/shacl/sparnatural-config/institution
    id:http://www.graceful17.org/shacl/sparnatural-config/archdeanery
    id:http://www.graceful17.org/shacl/sparnatural-config/archdiocese
    id:http://www.graceful17.org/shacl/sparnatural-config/deanery
    id:http://www.graceful17.org/shacl/sparnatural-config/ecclesiastical_province
    id:http://www.graceful17.org/shacl/sparnatural-config/parish
    id:http://www.graceful17.org/shacl/sparnatural-config/seat_of_worship
    id:http://www.graceful17.org/shacl/sparnatural-config/suffragan_diocese
    id:http://www.graceful17.org/shacl/sparnatural-config/supreme_body_of_government
    id:http://www.graceful17.org/shacl/sparnatural-config/vicariate
  id:http://www.graceful17.org/shacl/sparnatural-config/date
  id:http://www.graceful17.org/shacl/sparnatural-config/person
    id:http://www.graceful17.org/shacl/sparnatural-config/natural_person
  id:http://www.graceful17.org/shacl/sparnatural-config/archive
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_archive
  id:http://www.graceful17.org/shacl/sparnatural-config/source
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_source
      id:http://www.graceful17.org/shacl/sparnatural-config/textual_source
        id:http://www.graceful17.org/shacl/sparnatural-config/serial_source
  id:http://www.graceful17.org/shacl/sparnatural-config/entry
    id:http://www.graceful17.org/shacl/sparnatural-config/narrative
    id:http://www.graceful17.org/shacl/sparnatural-config/record
  id:http://www.graceful17.org/shacl/sparnatural-config/monetary_value
  id:http://www.graceful17.org/shacl/sparnatural-config/dedication
    id:http://www.graceful17.org/shacl/sparnatural-config/mystery_of_faith
    id:http://www.graceful17.org/shacl/sparnatural-config/saint

ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 (5) [An, An, An, An, An]
HierarchicalClassSelectBuilder.ts:526 (5) [{…}, {…}, {…}, {…}, {…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/type', valuePath: ''}
ObjectPropertyTypeId.ts:189 rootNodes
ObjectPropertyTypeId.ts:190 (2) [An, An]
HierarchicalClassSelectBuilder.ts:526 (2) [{…}, {…}]
ObjectPropertyTypeId.ts:128 {value: 'http://www.graceful17.org/shacl/sparnatural-config/has_main_type', valuePath: ''}
WidgetWrapper.ts:70 widget component already there, rendering widget component
LoadingSpinner.ts:21 rendering message 'searching...'
SHACLSpecificationProvider.ts:335 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT DISTINCT ?uri ?label
WHERE {
    ?domain <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.graceful17.org/ontology/place> .
    ?domain <http://www.graceful17.org/ontology/has_main_type> ?uri .
    ?uri <http://www.graceful17.org/ontology/called> ?label .
    FILTER(lang(?label) = "" || lang(?label) = 'en')
    FILTER(isIRI(?uri))
}
ORDER BY UCASE(?label)
LIMIT 500

SHACLSpecificationProvider.ts:405 Initial entity list http://www.graceful17.org/shacl/sparnatural-config/event,http://www.graceful17.org/shacl/sparnatural-config/object,http://www.graceful17.org/shacl/sparnatural-config/type,http://www.graceful17.org/shacl/sparnatural-config/place,http://www.graceful17.org/shacl/sparnatural-config/institution,http://www.graceful17.org/shacl/sparnatural-config/date,http://www.graceful17.org/shacl/sparnatural-config/person,http://www.graceful17.org/shacl/sparnatural-config/archive,http://www.graceful17.org/shacl/sparnatural-config/source,http://www.graceful17.org/shacl/sparnatural-config/entry,http://www.graceful17.org/shacl/sparnatural-config/monetary_value,http://www.graceful17.org/shacl/sparnatural-config/dedication
ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 [An]
HierarchicalClassSelectBuilder.ts:526 [{…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/place', valuePath: ''}
SHACLSpecificationEntity.ts:217 id:http://www.graceful17.org/shacl/sparnatural-config/map
id:http://www.graceful17.org/shacl/sparnatural-config/name
id:http://www.graceful17.org/shacl/sparnatural-config/number
id:http://special/ZZ_Other
id:http://www.graceful17.org/shacl/sparnatural-config/anything !disabled
  id:http://www.graceful17.org/shacl/sparnatural-config/event
    id:http://www.graceful17.org/shacl/sparnatural-config/papal_grace
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_provision
  id:http://www.graceful17.org/shacl/sparnatural-config/object
    id:http://www.graceful17.org/shacl/sparnatural-config/immaterial_object
      id:http://www.graceful17.org/shacl/sparnatural-config/absolution
      id:http://www.graceful17.org/shacl/sparnatural-config/benefice
      id:http://www.graceful17.org/shacl/sparnatural-config/coadjutary
      id:http://www.graceful17.org/shacl/sparnatural-config/commenda
      id:http://www.graceful17.org/shacl/sparnatural-config/dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/indult
      id:http://www.graceful17.org/shacl/sparnatural-config/pension
  id:http://www.graceful17.org/shacl/sparnatural-config/type
  id:http://www.graceful17.org/shacl/sparnatural-config/place
    id:http://www.graceful17.org/shacl/sparnatural-config/continent
    id:http://www.graceful17.org/shacl/sparnatural-config/locality
    id:http://www.graceful17.org/shacl/sparnatural-config/location
    id:http://www.graceful17.org/shacl/sparnatural-config/region
    id:http://www.graceful17.org/shacl/sparnatural-config/subregion
  id:http://www.graceful17.org/shacl/sparnatural-config/institution
    id:http://www.graceful17.org/shacl/sparnatural-config/archdeanery
    id:http://www.graceful17.org/shacl/sparnatural-config/archdiocese
    id:http://www.graceful17.org/shacl/sparnatural-config/deanery
    id:http://www.graceful17.org/shacl/sparnatural-config/ecclesiastical_province
    id:http://www.graceful17.org/shacl/sparnatural-config/parish
    id:http://www.graceful17.org/shacl/sparnatural-config/seat_of_worship
    id:http://www.graceful17.org/shacl/sparnatural-config/suffragan_diocese
    id:http://www.graceful17.org/shacl/sparnatural-config/supreme_body_of_government
    id:http://www.graceful17.org/shacl/sparnatural-config/vicariate
  id:http://www.graceful17.org/shacl/sparnatural-config/date
  id:http://www.graceful17.org/shacl/sparnatural-config/person
    id:http://www.graceful17.org/shacl/sparnatural-config/natural_person
  id:http://www.graceful17.org/shacl/sparnatural-config/archive
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_archive
  id:http://www.graceful17.org/shacl/sparnatural-config/source
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_source
      id:http://www.graceful17.org/shacl/sparnatural-config/textual_source
        id:http://www.graceful17.org/shacl/sparnatural-config/serial_source
  id:http://www.graceful17.org/shacl/sparnatural-config/entry
    id:http://www.graceful17.org/shacl/sparnatural-config/narrative
    id:http://www.graceful17.org/shacl/sparnatural-config/record
  id:http://www.graceful17.org/shacl/sparnatural-config/monetary_value
  id:http://www.graceful17.org/shacl/sparnatural-config/dedication
    id:http://www.graceful17.org/shacl/sparnatural-config/mystery_of_faith
    id:http://www.graceful17.org/shacl/sparnatural-config/saint

ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 (5) [An, An, An, An, An]
HierarchicalClassSelectBuilder.ts:526 (5) [{…}, {…}, {…}, {…}, {…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/institution', valuePath: ''}
ObjectPropertyTypeId.ts:189 rootNodes
ObjectPropertyTypeId.ts:190 (2) [An, An]
HierarchicalClassSelectBuilder.ts:526 (2) [{…}, {…}]
ObjectPropertyTypeId.ts:128 {value: 'http://www.graceful17.org/shacl/sparnatural-config/is_primary_place_of', valuePath: ''}
WidgetWrapper.ts:70 widget component already there, rendering widget component
LoadingSpinner.ts:21 rendering message 'searching...'
SHACLSpecificationProvider.ts:335 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT DISTINCT ?uri ?label
WHERE {
    ?domain <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.graceful17.org/ontology/place> .
    ?domain ^<http://www.graceful17.org/ontology/primary_place> ?uri .
    ?uri <http://www.graceful17.org/ontology/called> ?label .
    FILTER(lang(?label) = "" || lang(?label) = 'en')
    FILTER(isIRI(?uri))
}
ORDER BY UCASE(?label)
LIMIT 500

SHACLSpecificationProvider.ts:405 Initial entity list http://www.graceful17.org/shacl/sparnatural-config/event,http://www.graceful17.org/shacl/sparnatural-config/object,http://www.graceful17.org/shacl/sparnatural-config/type,http://www.graceful17.org/shacl/sparnatural-config/place,http://www.graceful17.org/shacl/sparnatural-config/institution,http://www.graceful17.org/shacl/sparnatural-config/date,http://www.graceful17.org/shacl/sparnatural-config/person,http://www.graceful17.org/shacl/sparnatural-config/archive,http://www.graceful17.org/shacl/sparnatural-config/source,http://www.graceful17.org/shacl/sparnatural-config/entry,http://www.graceful17.org/shacl/sparnatural-config/monetary_value,http://www.graceful17.org/shacl/sparnatural-config/dedication
ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 [An]
HierarchicalClassSelectBuilder.ts:526 [{…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/institution', valuePath: ''}
SHACLSpecificationEntity.ts:217 id:http://www.graceful17.org/shacl/sparnatural-config/map
id:http://www.graceful17.org/shacl/sparnatural-config/name
id:http://www.graceful17.org/shacl/sparnatural-config/number
id:http://special/ZZ_Other
id:http://www.graceful17.org/shacl/sparnatural-config/anything !disabled
  id:http://www.graceful17.org/shacl/sparnatural-config/event
    id:http://www.graceful17.org/shacl/sparnatural-config/papal_grace
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/apostolic_provision
  id:http://www.graceful17.org/shacl/sparnatural-config/object
    id:http://www.graceful17.org/shacl/sparnatural-config/immaterial_object
      id:http://www.graceful17.org/shacl/sparnatural-config/absolution
      id:http://www.graceful17.org/shacl/sparnatural-config/benefice
      id:http://www.graceful17.org/shacl/sparnatural-config/coadjutary
      id:http://www.graceful17.org/shacl/sparnatural-config/commenda
      id:http://www.graceful17.org/shacl/sparnatural-config/dispensation
      id:http://www.graceful17.org/shacl/sparnatural-config/indult
      id:http://www.graceful17.org/shacl/sparnatural-config/pension
  id:http://www.graceful17.org/shacl/sparnatural-config/type
  id:http://www.graceful17.org/shacl/sparnatural-config/place
    id:http://www.graceful17.org/shacl/sparnatural-config/continent
    id:http://www.graceful17.org/shacl/sparnatural-config/locality
    id:http://www.graceful17.org/shacl/sparnatural-config/location
    id:http://www.graceful17.org/shacl/sparnatural-config/region
    id:http://www.graceful17.org/shacl/sparnatural-config/subregion
  id:http://www.graceful17.org/shacl/sparnatural-config/institution
    id:http://www.graceful17.org/shacl/sparnatural-config/archdeanery
    id:http://www.graceful17.org/shacl/sparnatural-config/archdiocese
    id:http://www.graceful17.org/shacl/sparnatural-config/deanery
    id:http://www.graceful17.org/shacl/sparnatural-config/ecclesiastical_province
    id:http://www.graceful17.org/shacl/sparnatural-config/parish
    id:http://www.graceful17.org/shacl/sparnatural-config/seat_of_worship
    id:http://www.graceful17.org/shacl/sparnatural-config/suffragan_diocese
    id:http://www.graceful17.org/shacl/sparnatural-config/supreme_body_of_government
    id:http://www.graceful17.org/shacl/sparnatural-config/vicariate
  id:http://www.graceful17.org/shacl/sparnatural-config/date
  id:http://www.graceful17.org/shacl/sparnatural-config/person
    id:http://www.graceful17.org/shacl/sparnatural-config/natural_person
  id:http://www.graceful17.org/shacl/sparnatural-config/archive
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_archive
  id:http://www.graceful17.org/shacl/sparnatural-config/source
    id:http://www.graceful17.org/shacl/sparnatural-config/physical_source
      id:http://www.graceful17.org/shacl/sparnatural-config/textual_source
        id:http://www.graceful17.org/shacl/sparnatural-config/serial_source
  id:http://www.graceful17.org/shacl/sparnatural-config/entry
    id:http://www.graceful17.org/shacl/sparnatural-config/narrative
    id:http://www.graceful17.org/shacl/sparnatural-config/record
  id:http://www.graceful17.org/shacl/sparnatural-config/monetary_value
  id:http://www.graceful17.org/shacl/sparnatural-config/dedication
    id:http://www.graceful17.org/shacl/sparnatural-config/mystery_of_faith
    id:http://www.graceful17.org/shacl/sparnatural-config/saint

ClassTypeId.ts:293 rootNodes
ClassTypeId.ts:294 (5) [An, An, An, An, An]
HierarchicalClassSelectBuilder.ts:526 (5) [{…}, {…}, {…}, {…}, {…}]
ClassTypeId.ts:142 {value: 'http://www.graceful17.org/shacl/sparnatural-config/object', valuePath: ''}
ObjectPropertyTypeId.ts:189 rootNodes
ObjectPropertyTypeId.ts:190 (4) [An, An, An, An]
HierarchicalClassSelectBuilder.ts:526 (4) [{…}, {…}, {…}, {…}]
ObjectPropertyTypeId.ts:128 {value: 'http://www.graceful17.org/shacl/sparnatural-config/holds_immaterial_object', valuePath: ''}
WidgetWrapper.ts:70 widget component already there, rendering widget component
LoadingSpinner.ts:21 rendering message 'searching...'
SHACLSpecificationProvider.ts:335 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT DISTINCT ?uri ?label
WHERE {
    ?domain <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.graceful17.org/ontology/institution> .
    ?domain <http://www.graceful17.org/ontology/holds_immaterial_object> ?uri .
    ?uri <http://www.graceful17.org/ontology/called> ?label .
    FILTER(lang(?label) = "" || lang(?label) = 'en')
    FILTER(isIRI(?uri))
}
ORDER BY UCASE(?label)
LIMIT 500

QueryLoader.ts:153 Uncaught TypeError: Cannot read properties of undefined (reading 'widgetHtml')
    at _h.ch (QueryLoader.ts:153:73)
    at _h.e (QueryLoader.ts:117:27)
    at _h.e (QueryLoader.ts:124:55)
    at QueryLoader.ts:66:57
    at Array.forEach (<anonymous>)
    at _h.oh (QueryLoader.ts:64:18)
    at _h.loadQuery (QueryLoader.ts:28:48)
    at Sh.loadQuery (SparnaturalElement.ts:132:17)
    at HTMLButtonElement.<anonymous> (main.js:120:14)
ch @ QueryLoader.ts:153
e @ QueryLoader.ts:117
e @ QueryLoader.ts:124
(anonymous) @ QueryLoader.ts:66
oh @ QueryLoader.ts:64
loadQuery @ QueryLoader.ts:28
loadQuery @ SparnaturalElement.ts:132
(anonymous) @ main.js:120
LoadingSpinner.ts:21 rendering message ''
LoadingSpinner.ts:21 rendering message ''
LoadingSpinner.ts:21 rendering message ''
ch-sander commented 4 weeks ago

the critical part that breaks the loading seems to be

 "children": [
            {
              "line": {
                "s": "object_8",
                "p": "http://www.graceful17.org/shacl/sparnatural-config/object_related_to_event",
                "o": "event_10",
                "sType": "http://www.graceful17.org/shacl/sparnatural-config/object",
                "oType": "http://www.graceful17.org/shacl/sparnatural-config/event",
                "values": []
              }

object_related_to_event is defined by a sh:PropertyShape with the sh:path as [object_related_to_event](sh:inversePath grace:event_related_to_object)

g17sn:object_related_to_event a sh:PropertyShape ;
    rdfs:label "object related to event"@en ;
    volipi:message "Tooltip for object related to event (This is only a query pattern)" ;
    dash:searchWidget sparnatural:ListProperty ;
    sh:class grace:event ;
    sh:name "subject of" ;
    sh:node g17sn:event ;
    sh:nodeKind sh:IRI ;
    sh:path [ sh:inversePath grace:event_related_to_object ] .

When manually building the branch, the SPARQL forms this correctly:

?object_6 rdf:type <http://www.graceful17.org/ontology/object>;
      ^<http://www.graceful17.org/ontology/event_related_to_object> ?event_16.

What is strange is that a short JSON loads fine as import

{
  "distinct": true,
  "variables": [
    {
      "termType": "Variable",
      "value": "object_1"
    }
  ],
  "order": null,
  "branches": [
    {
      "line": {
        "s": "object_1",
        "p": "http://www.graceful17.org/shacl/sparnatural-config/object_related_to_event",
        "o": "event_2",
        "sType": "http://www.graceful17.org/shacl/sparnatural-config/object",
        "oType": "http://www.graceful17.org/shacl/sparnatural-config/event",
        "values": []
      },
      "children": []
    }
  ]
}
ch-sander commented 4 weeks ago

Probably unrelated but I also get this error when running the query

Error: e is undefined content_script.js:80:218
    G_cp_3a content_script.js:80
    G_cp_Vb content_script.js:115
    (Async: promise callback)
    G_cp_Vb content_script.js:115
    G_cp_id content_script.js:247
    G_cp_zc content_script.js:244
    G_cp_yc content_script.js:244
    G_cp_4c content_script.js:232
    onsubmit ask:1
    submitAction SubmitSection.ts:28
    Xi PlayBtn.ts:18
    jQuery 2
    (Async: EventListener.handleEvent)
    addEventListener ask:1
    jQuery 6
    Xi PlayBtn.ts:15
    render SubmitSection.ts:16
    render SparnaturalComponent.ts:41
    initSpecificationProvider SparnaturalComponent.ts:84
    build SparnaturalSpecificationFactory.ts:53
    buildStore BaseRDFReader.ts:102
    (Async: promise callback)
    buildStore BaseRDFReader.ts:91
    build SparnaturalSpecificationFactory.ts:40
    initSpecificationProvider SparnaturalComponent.ts:82
    render SparnaturalComponent.ts:34
    display SparnaturalElement.ts:64
    connectedCallback SparnaturalElement.ts:41
    <anonym> SparnaturalElement.ts:178
    <anonym> SparnaturalElement.ts:178
    <anonym> SparnaturalElement.ts:178
tfrancart commented 4 weeks ago

Considering the line where it happens is looks more related to the presence of an "optional" clause in the query. I don't have time to investigate further right now. You have multiple nested optionals, which is bad. Nested optionals are not supported in Sparnatural.

ch-sander commented 4 weeks ago

Understood, and no worries. Yet, the query was built this way, including the nested optionals which are sometimes needed, through Sparnatural and executed without problems. It's only the loading if exposed to another session that fails.

tfrancart commented 4 weeks ago

Yet, the query was built this way, including the nested optionals which are sometimes needed

Sparnatural does not support that. The nested optional you have in you JSON export are buggy, they shouldn't be here. Only the outermost criteria should be flagged as optional.

ch-sander commented 3 weeks ago

I see! Thanks for the fix (I will need to wait for the next release though)! I believed that the JSON is creating the SPARQL on the fly, and as the SPARQL looked okay to me (all in one OPTIONAL), I assumed the JSON must have been correct as well.

tfrancart commented 3 weeks ago

Well, for now the JSON and SPARQL are generated separately. But soon soon we will have the SPARQL generated from the JSON.