[python] How to add RDF triples to your own Fuseki server using rdflib

I haven't figured out how to handle rdflib, so it's a provisional process. rdflib documentation

Code to add an RDF triple to the Fuseki server

rdf2fuseki.py


import rdflib
from rdflib import Graph,URIRef

if __name__ == '__main__':

    #Preparation of RDF triple to add
    bob    = URIRef("http://example.org#bob")
    like   = URIRef("http://example.org#like")
    tomato = URIRef("http://example.org#tomato")

    #Ready for Endpoint
    endpoint = r"http://localhost:3030/ds/query"
    store = sparqlstore.SPARQLUpdateStore()
    store.open((endpoint,r"http://localhost:3030/ds/update"))
    
    #Graph to add
    default_graph = URIRef('http://example.org/default-graph')
    ng = Graph(store, identifier=default_graph)
    ng.add((bob, like, tomato)) #Added to RDF Triple

RDF triples will be added, but the following warnings will appear and need improvement

WARN : Unrecognize request parameter (ignored): output
WARN : Unrecognize request parameter (ignored): format
WARN : Unrecognize request parameter (ignored): results

Recommended Posts

[python] How to add RDF triples to your own Fuseki server using rdflib
How to install python using anaconda
How to create your own Transform
Add your own content view to mitmproxy
How to add python module to anaconda environment
Connect your SQL Server database to Alibaba Cloud Function Compute using Python
How to access data with object ['key'] for your own Python class
Want to add type hints to your Python decorator?
[Python] Implement your own list-like class using collections.UserList
How to define your own target in Sage
How to add a Python module search path
How to host web app backend processing in Python using a rental server subdomain
Memo to create your own Box with Pepper's Python
How to set up a Python environment using pyenv
Try to improve your own intro quiz in Python
How to auto-submit Microsoft Forms using python (Mac version)
Wagtail Recommendation (5) Let's add your own block to StreamField
How to make a Python package using VS Code
How to add page numbers to PDF files (in Python)
How to exit when using Python in Terminal (Mac)
[Road to intermediate Python] Define in in your own class
How to retrieve multiple arrays using slice in python.
[Introduction to Python] How to stop the loop using break?
How to execute a command using subprocess in Python
[Introduction to Python] How to write repetitive statements using for statements
How to install Python
[Ansible] How to call variables when creating your own module
[Introduction to Python] How to write conditional branches using if statements
[Circuit x Python] How to solve circuit equations symbolically using sympy
How to specify a public directory Python simple HTTP server
How to transpose a 2D array using only python [Note]
(Note) How to pass the path of your own module
How to add new data (lines and plots) using matplotlib
How to update FC2 blog etc. using XMLRPC with python
Try HeloWorld in your own language (with How to & code)
How to install Python [Windows]
python3: How to use bottle (2)
How to update Python Tkinter to 8.6
How to use Python argparse
Start to Selenium using python
[Python] How to use checkio
How to run Notepad ++ Python
How to change Python version
How to develop in Python
[python] How to judge scalar
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Python bytes
How to set cron for regular Python scraping on Sakura server.
Turn your Android Smart Phone into a Web Server using python.
How to get followers and followers from python using the Mastodon API
Make the theme of Pythonista 3 like Monokai (how to make your own theme)
[Python] How to add rows and columns to a table (pandas DataFrame)
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Try to log in to Netflix automatically using python on your PC
How to make your own domain site with heroku (free plan)
Call your own C language shared library from Python using ctypes
When using the zap library in your own Logger with Golang, how to put the hierarchy above Logger in Caller