|
|
Line 2: |
Line 2: |
|
| |
|
| ==Topics== | | ==Topics== |
| * Group Presentations.
| | Today's topic involves lifting the unsemantic format CSV into RDF. |
| * SPARQL programming in python with SPARQLWrapper and Blazegraph, or alternatively RDFlib.
| | CSV is already structured in a way that makes the creation of triples based on the data relatively easy. |
|
| |
|
| | ==Tasks== |
|
| |
|
| ==Presentations==
| |
| Today you will be presenting your ideas for the group project in the lab. Andreas Opdahl will be present to give you further feedback and ideas.
| |
|
| |
|
| |
| ==Tasks (if we have additional time)==
| |
|
| |
| After the presentations you can start on the tasks for next week.
| |
| These tasks are about programming SPARQL queries and inserts in a python program. Last week we added triples manually from the web interface.
| |
|
| |
| However, sometimes we would rather want to program the insertion or updates of triples for our graphs/databases.
| |
|
| |
|
| |
| * Redo all the SPARQL queries and updates from [https://wiki.uib.no/info216/index.php/Lab:_SPARQL Lab 4], this time writing a Python program.
| |
|
| |
|
| |
| ==With Blazegraph==
| |
| The most important part is that we need to import a SPARQLWrapper in order to connect to the SPARQL endpoint of Blazegraph.
| |
| When it comes to how to do some queries I recommend scrolling down on this page for help: https://github.com/RDFLib/sparqlwrapper
| |
|
| |
| Remember, before you can program with Blazegraph you have to make sure its running like we did in [https://wiki.uib.no/info216/index.php/Lab:_SPARQL Lab 4].
| |
| Now you will be able to program queries and updates.
| |
|
| |
| <syntaxhighlight>
| |
| # How to establish connection to Blazegraph endpoint.
| |
|
| |
| from SPARQLWrapper import SPARQLWrapper, JSON
| |
|
| |
| sparql = SPARQLWrapper("("http://localhost:9999/bigdata/sparql")")
| |
|
| |
| </syntaxhighlight>
| |
|
| |
|
| |
|
| |
| ==Without Blazegraph==
| |
| If you have not been able to run Blazegraph yet, you can
| |
| instead program SPARQL queries directly with RDFlib.
| |
|
| |
| For help, look at the link below:
| |
|
| |
| [https://rdflib.readthedocs.io/en/4.2.0/intro_to_sparql.html Querying with Sparql]
| |
|
| |
|
| ==Useful Readings== | | ==Useful Readings== |
| *[https://github.com/RDFLib/sparqlwrapper SPARQLWrapper]
| |
| *[https://rdflib.readthedocs.io/en/4.2.0/intro_to_sparql.html RDFlib - Querying with Sparql]
| |