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.

341 questions
13
votes
4 answers

How to export graph in RDF file using RDFLib

I'm trying to generate RDF data using RDFLib in Python 3.4. A minimal example: from rdflib import Namespace, URIRef, Graph from rdflib.namespace import RDF, FOAF data = Namespace("http://www.example.org#") g = Graph() g.add( (URIRef(data.Alice),…
Arthur Vaïsse
  • 1,411
  • 1
  • 12
  • 23
9
votes
4 answers

SPARQL query on the remote remote endpoint RDFLib / Redland

I'm trying to query remote endpoints and get get owl:sameAs mappings, I've tried both RDFLib and Redland but neither worked for me, probably I'm not dealing with namespaces correctly. Here is my attempt in RDFLib: import rdflib …
user52028778
  • 22,840
  • 3
  • 30
  • 38
9
votes
1 answer

how to parse big datasets using RDFLib?

I'm trying to parse several big graphs with RDFLib 3.0, apparently it handles first one and dies on the second (MemoryError)... looks like MySQL is not supported as store anymore, can you please suggest a way to somehow parse those? Traceback (most…
user52028778
  • 22,840
  • 3
  • 30
  • 38
9
votes
2 answers

Using SPARQL for limited RDFS and OWL reasoning

What I'm currently using rdflib for creating and managing RDF graphs in Python. RDFlib doesn't do any RDFS or OWL reasoning, though. This leads to results like the following: If I have A rdf:type MyType . MyType rdfs:subClassOf SuperType . and…
Alex
  • 139
  • 5
8
votes
1 answer

Reading a Turtle/N3 RDF File with Python

I'm trying to encode some botanical data in Turtle format, and read this data from Python using RDFLib. However, I'm having trouble, and I'm not sure if it's because my Turtle is malformed or I'm misusing RDFLib. My test data is: @PREFIX rdf:…
Cerin
  • 50,711
  • 81
  • 269
  • 459
7
votes
2 answers

Writing RDF/XML file from rdf Triples in rdflib

I have got rdf triples with me, now I am interested in generating RDF/XML file using rdflib in Python. Could you please give me some sample code to start. Thanks
Muhammad Imran
  • 991
  • 1
  • 8
  • 6
7
votes
2 answers

How to run IN and NOT IN SPARQL statements in python rdflib to remove the intersection of two graphs

I'm trying to use the IN and NOT IN statements (that were if I understand correctly, introduced in SPARQL 1.1) on the python implementation of SPARQL (now in rdfextras) but it seems that the syntax is not recognised. Let's consider two sets (A and…
Alexis Métaireau
  • 8,372
  • 5
  • 21
  • 34
7
votes
1 answer

Apache Jena and Python

I have been working on various relationship extraction models in python and all the relationships are currently saved in dataframes or csv files. Eventually I would like to create an RDF graph. Since I am working in python I was going to create the…
Joe124
  • 169
  • 1
  • 6
7
votes
1 answer

Excluding Blank Nodes from SPARQL query results

I am using RDFLib to query on the Semantic Dicom Ontology. I am querying for owl:Class in the graph constructed from the above ontology. RDFLib returns results which contain blank nodes and I wish to exclude such queries. My query - from rdflib…
Anmol Kagrecha
  • 137
  • 2
  • 8
7
votes
2 answers

error: invalid command 'build_sphinx'

how can I install the documentation for rdflib in mac osx 10.10.1 python 2.7.9? I have followed the instructions as outlined in 1 and I get error: invalid command 'build_sphinx' the documentation does not install. the library rdflib works well, I…
7
votes
1 answer

Using Python rdflib: how to include literals in sparql queries?

I can include URIs and variables in my queries, but I can't include literals in my queries. Here, I have some code which successfully reads an RDF file, finds all the RDF triples with skos:prefLabels, counts them, and then identifies a couple of…
7
votes
2 answers

SPARQL Query gives unexpected result

I hope someone can help me on this probably totally easy-to-solve problem: I want to run a SPARQL query against the following RDF (noted in N3, the RDF/XMl sits here). This is the desription of a journal article and descriptions of the journal,…
fab
  • 71
  • 1
7
votes
2 answers

INSERT/DELETE/UPDATE query using SPARQLWrapper

Although I have gone through lot of examples on the web explaining the use of python SPARQLWrapper using SELECT statements for fetching data from sesame triple store, but not sure how can we INSERT/DELETE/UPDATE statements in sesame using it. Can…
imran
  • 179
  • 2
  • 11
6
votes
1 answer

Determining Hypernym or Hyponym using wordnet nltk

I want to check for the hypernyms/hyponym relation between two words (given by the user) which means any of them can be hypernym of other or it can also be the case that there is no hypernym relation between the two.Can I use path_similarity for…
ankita singh
  • 105
  • 1
  • 1
  • 8
6
votes
0 answers

Adding triples to Virtuoso triplestore with Python and RDFLib

I need to make a program to add triples to a Virtuoso triplestore, I'm using Python and RDFLib. I've installed the Virtuoso plugin and tried a connection as seen in http://pythonhosted.org/virtuoso/rdflib.html#virtuoso-storage. I got: from…
FontFranch
  • 61
  • 3
1
2 3
22 23