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

Enabling prefixed uri to be taken into account when building a query #520

Closed PyHahiro closed 1 year ago

PyHahiro commented 1 year ago

Hello, I am facing an issue with sparnatural, using my own endpoint, I can get values that are shortened exemple : I have an internal prefix @Prefix ex: http://exemple.com/ and once I get value from my endpoint with the right format

{
   "rdfterm" : 
   {
      "type": "uri",
      "value" : "ex:test1"
   }
}

the sparnatural query builder will construct the following uri :

actual :

<ex:test1>

expected :

ex:test1

Is there a way of having the expected value or not ?

tfrancart commented 1 year ago

I understand this is an issue in the table result ? then is not Sparnatural, this is YASGUI/YASR. Yasr can take some prefixes as parameters, see https://triply.cc/docs/yasgui-api/#yasr-configuration

PyHahiro commented 1 year ago

I am not using yasgui, the problem comes from sparnatural queryUpdated event listener, which build a queryString from the individual selection after clicking on widgets, I have no way to tell sparnatural that it should build the query string with shortened uri

tfrancart commented 1 year ago

Are you using the "sparqlString" annotation ? If yes, make sure you only use full URIs, not prefixed ones, included in <...>. See http://docs.sparnatural.eu/OWL-based-configuration.html#common-annotations-applicable-to-all-properties, property core:sparqlString

PyHahiro commented 1 year ago

I don't use annotation but I have tried to create custom sparqlString and it has worked when giving full uri, since I handle specific prefix in my endpoint, I can also use prefixed ones in some case, my issue comes from the results, here is my queryUpdated listener :

sparnaturalRef?.current?.addEventListener(
      "queryUpdated",
      (event: SparnaturalEvent) => {
        let queryStr = event?.detail?.queryString;
        if (queryStr) {
          onChange(queryStr);
        }
      }
    );

is there a way for queryUpdated to be like : hey, this uri is a prefixed one and not a full uri, therefore I should not give your prefixed uri <...> when building my event?.detail?.queryString

Or am I misunderstanding something ?

tfrancart commented 1 year ago

I don't understand. Please provide a sample of your configuration file.

PyHahiro commented 1 year ago

Ok, I was misunderstanding something about sparnatural and the way it was working with yasgui, since at the time I didn't use yasgui, my issue was with me missing an implementation for what I wanted to achieve, I will close this issue and create one better related to my current issue