CLARIAH / grlc

grlc builds Web APIs using shared SPARQL queries
http://grlc.io
MIT License
137 stars 32 forks source link

Insert data #370

Closed MiharyR closed 2 years ago

MiharyR commented 2 years ago

Expected behavior

According to this page https://github.com/CLARIAH/grlc/wiki/Features : "INSERT DATA queries are now mapped automatically to POST requests. Support is limited to queries with no WHERE clause, and parameters are always expected to be values for g (named graph where to insert the data) and data (with the triples to insert, in ntriples format). The INSERT query pattern is so far static, as defined in static.py. Only tested with Virtuoso."

Actual behavior

image

Steps to reproduce the behavior

In a github repo file named my_insert.rq, I wrote this query:

#+ summary: test insert
#+ endpoint: http://127.0.0.1:8890/sparql
#+ tags:
#+   - SPARQL
#+ method: POST

PREFIX ex: <http://example.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

INSERT DATA {
    GRAPH ex:myGraph {
        ex:ali foaf:name "Alice" .
        ex:bob foaf:name "Bob" .
    }
}
c-martinez commented 2 years ago

@albertmeronyo -- do we have an insert example in one of the tutorials? I'm not sure what the exact syntax should be.

MiharyR commented 2 years ago

Solved as per the implementation provided in https://github.com/Orange-OpenSource/grlc

c-martinez commented 2 years ago

Would it be useful to integrate this functionality? A pull request with this functionality would be most welcome :-)

MiharyR commented 2 years ago

@c-martinez Hello, It would be a pleasure to merge our projects ^^

However, I need your opinion on how to do this pull request. Indeed, I deleted a lot of parts of your code. I even deleted more code than added.

Specifically, at some point of your code, you have the SPARQL query and the parameters. But then, you do a lot of processing that I don't understand (e.g rewrite the query). I found this code "useless" so I deleted it. In my code, I kept all your code where you are getting the SPARQL query and the parameters. But then, I directly execute the query.

Despite that, I think a pull request is still possible. I remain available to discuss with you :-)

c-martinez commented 2 years ago

Hi @MiharyR,

I know what you mean -- grlc has quite a bit of code which could be cleaned up. Perhaps you could join one of our developer meetings (with @albertmeronyo and me) and we could discuss how to integrate your code?

MiharyR commented 2 years ago

Hello @c-martinez,

It's a good idea ! My schedule is very light. So, I let you suggest the meeting times that suit you.

PS: Like you probably see, I work on GRLC as part of my job. So you can contact me even in the middle of a working day

c-martinez commented 2 years ago

Hi @MiharyR,

Sorry for the delay in getting back to you -- could you get in touch with me via email (c.martinez@esciencecenter.nl) so I can propose dates and setup a meeting?

c-martinez commented 2 years ago

Hey @MiharyR and @albertmeronyo ,

I had a look at the diff between with https://github.com/Orange-OpenSource/grlc, and I think we could pull changes relatively easily. But there might be a few details to discuss. So I suggest we split the changes in separate issues. I've created 3 issues #375,#376 and #377, so we can discuss details there :-)

c-martinez commented 2 years ago

Hey @MiharyR -- first of these issues is addressed by #381 in case you might have any comments.

GenEars commented 1 year ago

Hello @c-martinez. Thanks for the many comments you sent to @MiharyR earlier on this issue. @MiharyR is unfortunately no longer a member of the https://github.com/Orange-OpenSource group, therefore I will take over on the follow up about https://github.com/Orange-OpenSource/grlc Thereon, I sent the https://github.com/CLARIAH/grlc/pull/384 minutes ago to start the merge work.

GenEars commented 1 year ago

Hey @MiharyR -- first of these issues is addressed by #381 in case you might have any comments.

Hello @c-martinez, no comment on #381, this is indeed good practice to have license text in each file.