Questions tagged [rdflib]

RDFLib is a Python library for working with RDF. It supports parsers and serializers for different syntaxes (RDF/XML, N3, N-Triples, Turtle, TriX and RDFa) as well of remote and local SPARQL queries. Please do not use this tag for rdflib.js.

Resources

Please do not confuse the RDFLib Python library with the rdflib.js Javascript library.

439 questions
2
votes
2 answers

Will RDFLIB Python supports Geosparql queries?

I am trying to execute Geosparql Queries using RDFLIB Python...But I am getting empty results....Is RDFLIB Python supports Geosparql queries ? Please suggest me regarding this. Below is my code to store tripples and query for execution. from rdflib…
Manoj Deshpande
  • 311
  • 2
  • 18
2
votes
1 answer

Is rdflib's ConjunctiveGraph with IOMemory store thread-safe?

I am pulling multiple datasets from multiple sources and want to parallelize that using the threading library in Python 3.8.2. All datasets end in different contexts in a ConjunctiveGraph, which uses an IOMemory store. I saw that a ConcurrentStore…
Torsten Knodt
  • 477
  • 1
  • 5
  • 20
2
votes
2 answers

Is there a way to iteratively add a list to a graph in rdflib?

I have lists of literals that I would like to add as rdf:lists to a graph. I can read rdf:lists without issue using rdflib.collection.Collection, but I haven't been able to add those lists to other graphs, or iteratively generate an rdf:list from a…
Alex
  • 169
  • 1
  • 1
  • 8
2
votes
3 answers

Is there a way to quickly access all annotations and sub-annotations from an OWL (RDF/XML) file?

So I have an ontology I've built in Protege which has annotations and sub-annotations. What I mean by that is that a concept might have a definition and that definition might have a comment. So you might have something like…
user3684314
  • 707
  • 11
  • 31
2
votes
0 answers

Unable to parse .nt file with rdflib

My my_data.nt file looks like this: "Robert" . . I am using this code to parse it: from rdflib import Graph g = Graph() g.parse("my_data.nt", format="nt") for ele in g: print(ele) I am getting this…
Akavall
  • 82,592
  • 51
  • 207
  • 251
2
votes
0 answers

SPARQL Join ttl to dbpedia in Python

So I know that in order to run SPARQL statements against a local ttl file I use rdflib. In order to run SPARQL statements against dbpedia I run Sparqlwrapper. But how do I do both? i.e. suppose I have a local ttl file and I want to leverage some…
Dano13
  • 149
  • 9
2
votes
1 answer

How to use SPARQL to query a ttl file?

I am trying to learn SPARQL and to do that I need to execute queries against a local ttl file. I have researched this and every response says to use rdflib and then run a query against that. Here is the example ttl file I am using # filename:…
Dano13
  • 149
  • 9
2
votes
1 answer

What is the benefit of defining datatypes for literals in an RDF graph?

I am using rdflib in Python to build my first rdf graph. However, I do not understand the explicit purpose of defining Literal datatypes. I have scraped over the documentation and did my due diligence with google and the stackoverflow search, but I…
2
votes
1 answer

how to load Alignment format in python?

Is there a way to load alignment file to python. If I have file like this:
user52028778
  • 27,164
  • 3
  • 36
  • 42
2
votes
1 answer

SPARQL query returns more rows than expected

I'm trying to convert the following Turtle RDF into csv. I just want to keep the values of hasPlaceName, hasICAOcode and hasWKT for each object: :Place_Oberschleissheim_Airport a :Civil_Aerodrome ; :hasPlaceName "OBERSCHLEISSHEIM" ; …
2
votes
1 answer

MemoryError: Cannot allocate memory -- BDB2034 unable to allocate memory for mutex; resize mutex region

I've created a database based on turtle file (of size ~4.5Gb) using rdflib and started querying it using SPARQL, everything was working smoothly, but after a while I start getting this error: MemoryError: (12, 'Cannot allocate memory -- BDB2034…
Bilal
  • 2,883
  • 5
  • 37
  • 60
2
votes
2 answers

visualize n-triple file python

Is there a module or tool in Python that will help me visualize RDF data? I have a N-Triple file and want to load it in python and display the information in it visually. I am currently using RDFLib but it does not have a visualize function. Thank…
Resu
  • 187
  • 1
  • 12
2
votes
2 answers

How to store RDF data to a triplestore in Fuseki SPARQL endpoint using RDFlib in python

New Question: I firstly start the Fuseki Server to create a new dataset called 'address_act': fuseki-server --update --mem /address_act here are the code to get data of each address and then add it to a Triplestore (database) in Fuseki…
SpongeBob
  • 41
  • 5
2
votes
1 answer

get the intersected classes in SPARQL query using RDFLib

I have a class ABC that is a subClassOf the class XYZ and defined as intersections of classes A, B, C as:
Salman
  • 924
  • 1
  • 7
  • 20
2
votes
1 answer

SPARQL: unable to use FactForge endpoint

I am using python to run some sparql queries. I want to extract information from http://factforge.net/sparql sparql = SPARQLWrapper("http://factforge.net/sparql") query = """ # F02: Big Cities in Eastern Europe PREFIX onto:…
emax
  • 6,965
  • 19
  • 74
  • 141