sparql.anything icon indicating copy to clipboard operation
sparql.anything copied to clipboard

discussion: bidirectionality

Open justin2004 opened this issue 3 years ago • 4 comments

we can consume from, say, a csv file but it might be interesting to think about inserting into a csv file too.

e.g.

/mnt/test3.csv:

name,friend,age
"fred","joe",10
"sally","jim",
"will","bill",""
"joe","N/A",""

and then something like this:

curl --silent 'http://localhost:3000/sparql.anything'  \
--header "Accept: text/csv" \
--data-urlencode 'query=
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX fx: <http://sparql.xyz/facade-x/ns/>
delete { ?s xyz:name "will" }
insert { ?s xyz:name "willomena" }
where {
 SERVICE <x-sparql-anything:> {
   fx:properties fx:location "/mnt/test3.csv" ;
                 fx:csv.headers "true" ;
.
   ?s xyz:name "will" .
 }
}'

could turn /mnt/test3.csv into:

"fred","joe",10
"sally","jim",
"willomena","bill",""
"joe","N/A",""

justin2004 avatar Aug 05 '21 23:08 justin2004

i've since learned this is called "lifting and lowering."

justin2004 avatar Sep 06 '21 01:09 justin2004

Hi,

I just stepped into SPARQL Transformer. Essentially, the tool allows to define prototypes for JSON objects. The prototypes are used for generating a SPARQL queries which serve in turn to instantiate the prototype. I think that a similar approach can be implemented for "lowering" data.

luigi-asprino avatar Oct 07 '21 11:10 luigi-asprino

Nice! The SPARQL Transformer approach could be used to write back to JSON, then. Of course, we don't want to ask users to write those 'lowering' mappings but those should be produced automatically from the facade+format combination. Is there a chance to abstract this approach to any format, defining prototypes automatically for XML, HTML, etc ... so that we can support SPARQL Update on those potentially any format? I mean, the prototyping part is really about projecting the triple in the original format...

wow, we are really flying high here!

enridaga avatar Oct 07 '21 11:10 enridaga

XSPARQL specified this functionality. This looks like it was one of the implementations.

I wonder if the project lost steam because it only supported XML?

justin2004 avatar Oct 07 '21 13:10 justin2004

This is an interesting discussion we need to resume, but, maybe, better to move it to the discussion section and then open specific issues once we start implementing this feature.

luigi-asprino avatar Jun 22 '23 08:06 luigi-asprino