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

No OPTIONAL for fetching labels #610

Closed ch-sander closed 3 months ago

ch-sander commented 3 months ago

The default labels are fetched by, e.g., OPTIONAL { ?event_6 rdfs:label ?event_6_label. }.

Is it possible to switch off the OPTIONAL (if the query is built by the widget)? My queries tend to time out because of these optionals and my resources all have a rdsf:label.

ch-sander commented 3 months ago

see also https://github.com/oxigraph/oxigraph/issues/954

tfrancart commented 3 months ago

Yes, on the property that you configure as the default label, do NOT set the core:enableOptional flag to true. Then Sparnatural will not use the OPTIONAL keyword to fetch them. See http://docs.sparnatural.eu/how-to-configure/How-to-configure-Sparnatural.html#_kmiilevbt32l (this is similar if you use a SHACL-based config)

ch-sander commented 3 months ago

Ah, great and very thoughful configuration!

ch-sander commented 3 months ago

I did not configure the rdfs:label property at all for sparnatural. So, if not specified the enableOptional flag will be set to true by default?

tfrancart commented 3 months ago

No is is false by default. Can you share your config ?

ch-sander commented 3 months ago

https://dataria.org/file/results/config.ttl test at https://dataria.org/ask

ch-sander commented 3 months ago

I think I have set a global variable in a central place in the JavaScript to toggle the optional flag. I will check that. Not remembering where...

tfrancart commented 3 months ago

I was wrong. If not set explicitely to false, then the enableOptional flag is true. Hence the behavior you see. Note that the defaultLabelProperty can point to another URI representing a property in your config, itself mapped to rdfs:label using core:sparqlString annotation.

If you are proficient with SHACL, I suggest you move from OWL config to SHACL config : http://docs.sparnatural.eu/SHACL-based-configuration.html