Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would it be theoretically possible to bundle a small SPARQL engine with the plugin? #37

Open
matentzn opened this issue Feb 19, 2023 · 21 comments
Labels
enhancement New feature or request

Comments

@matentzn
Copy link

matentzn commented Feb 19, 2023

It would be pretty awesome if it was somehow possible to do something like

https://sparql.gtf.fyi

(SORRY submitted issue to fast)

It is most likely out of scope for the plugin, but is it maybe somehow possible to easily query a local ttl file without the need of having a SPARQL endpoint running? Happy for this issue to be immediately closed as out of scope, just checking.

@ktk
Copy link
Member

ktk commented Feb 20, 2023

We talked about this internally already, main problem is that VS Code is not a normal JavaScript environment. It's neither Node.js nor it is a browser. Which means getting things like that to work usually fails on some weird errors that can or cannot be solved easily.

If someone spends time on testing whatever we would need in VS Code we might work on it but without contributions or funding I don't think this will happen anytime soon.

@matentzn
Copy link
Author

Thank you for your answer @ktk, I thought this was the case! Probably a better solution would be to have a web service that can expose an adhoc sparql endpoint based on a file provided, and query that, rather than overloading your plugin.

@ktk ktk added the ideation Collect Ideas label Feb 20, 2023
@ktk
Copy link
Member

ktk commented Feb 24, 2023

@matentzn you might want to try this one as well https://github.com/elsevierlabs-os/linked-data

Didn't try it but it should be able to do SPARQL directly.

@matentzn
Copy link
Author

Thank you @ktk!

@BenjaminHofstetter
Copy link
Collaborator

@matentzn are you still interested to have this feature ? I think i can implement it.
In another project i have the need something similar for testing generated SPARQL queries. I can use the same functionality to implement this featue.

Why do you need this feature? Just to know what is the scope of this feature.

@matentzn
Copy link
Author

matentzn commented Sep 1, 2023

We are developing ontologies, so it's sometimes useful to quickly query a local file turtle or rdfxml file.

@kvistgaard
Copy link

I very often need to query local files. I've been doing this for years only with Topbraid composer.
I came just to add this wish to be able to run a query on a local file when I discovered this issue.
It will be very useful feature of SPARQL Notebook, and I thought it should be feasible because this VSCode plugin is able to do it.

@BenjaminHofstetter
Copy link
Collaborator

Thank you @kvistgaard. I am always happy to get feedback about features like this. The technical implementation is not very hard. It's more the "how to integrate it". But I am on it.

@MathiasVDA
Copy link

I would like to add my support to this feature. I've been using sparql notebooks since a while now and think querying a local file can help with education, data testing, development of ontologies, ... Many thanks!

@BenjaminHofstetter
Copy link
Collaborator

@VBP8501 @kvistgaard @matentzn @ktk The feature is there. It's still a bit hidden, but you can use it. You can find the option in the context menu in the file explorer. The implementation uses Oxigraph, and I've tested it with 103,111 triples.

Please test it in 0.0.27 and give feedback.
local-file-store

@BenjaminHofstetter BenjaminHofstetter added enhancement New feature or request and removed ideation Collect Ideas labels Sep 11, 2023
@MathiasVDA
Copy link

I just tested the functionality and it seems to work perfectly! Good job and thanks! :)

@matentzn
Copy link
Author

Super, super cool! For my personal use cases, this gets me 85% of the way; to round it up to 100, would it be at all in the realms of possible to embed:

# [endpoint=file://my/dir/ontology.ttl]

So that I can have one sparqlbook which I link to X different sparql dumps which I can run all at once?

@BenjaminHofstetter
Copy link
Collaborator

@matentzn Thanks for sharing your feedback. I see your point.

Now a bit unrelated to your need. I have a few questions. Having a local sparql endpoint is not just "run a query on a file". It provides more possibilities e.g.

We can fill the local store with ...

  • load many ttl files
  • load it with a CONSTRUCT query performed to another store (you can call it create Views )
  • load "federated" many CONSTRUCTs to different stores
  • load a TTL file over http e.g. https://www.w3.org/2000/01/rdf-schema#

and you can combine all together.

or we can fill the local store with a CONSTRUCT run SHACL validation on it before we run our SELECT queries.

Any opinion about things like this?

@matentzn
Copy link
Author

I think this is all great, but I must admit that I am working in the context of the Ontology Development Kit which means I use make + robot + jena to process all my files the way I need before querying.. So I don't really need too much to be able to combine files, etc, at least not right this moment.

@BenjaminHofstetter
Copy link
Collaborator

now i see your workflow. Thank you @matentzn

@kvistgaard
Copy link

@BenjaminHofstetter , speaking of construct, I often need to save the resulting file. For example, currently, I have a CONSTRUCT query that works on a Wikibase instance, Wikibase doesn't provide the possibility to save as Turtle. There are ways to overcome that, but it would be way more convenient to view and save the result as Turtle, TriG, N-Quads, or JSON-LD.

@BenjaminHofstetter
Copy link
Collaborator

@matentzn in version 0.0.31 I added a Cell Status Bar showing the SPARQL Target and where it's coming from and the cell source (cell or a query file). You can hover over it to see the url or file path.

In this version you can do this

# [endpoint=./rdf/curia.nt]

the path can be absolute or relative. But I suggest to use relative path. to be portable.

The File Endpoint is loading the triples during cell execution. This makes it a bit slow because it loads the file every time and this takes more time than executing the query :-)

@MathiasVDA
Copy link

MathiasVDA commented Oct 2, 2023

I just found out that a plain RDF file doesn't seem to work as source. I've converted the file into turtle serialization and that worked fine.

And next I found that when the file is refreshed and you relaunch a query, you'll get the same result. You need to redo the click-right-on-file and use-file-as-store

I'm on version v0.0.31

Again... this local-file-as-source feature save so much time during my knowledge graph construction!

@kvistgaard
Copy link

@BenjaminHofstetter is there are a way to query several ttl files at once?

@MathiasVDA
Copy link

@BenjaminHofstetter is there are a way to query several ttl files at once?

What I do now is use ttl-merge to merge several ttl files into one.

It would be very cool if sparql-notebooks could use a similar method as sparql-anything to refer to local files or remote repo's, by using the SERVICE clause.

fyi, here is an example on how sparql-anything would query a local file:

SELECT *
WHERE {
    SERVICE <x-sparql-anything:location=/data/BelgiumRailwayStations.csv,csv.headers=true> {
        ?s ?p ?o
    }
}

Now that I'm making a relation between sparql-notebook and sparql-anything... having a sparql-anything-notebook would be very very nice :)

@BenjaminHofstetter
Copy link
Collaborator

I personally use n-triple files. they can be easily concatenated. But I was thinking about providing the ability to combine multiple file. I am thinking about it how to implement it.

SPARQL anything notebook sounds interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants