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
0
votes
1 answer

Error parsing a RDF XML file with rdflib in Python

I am trying to parse this RDF:
Yuri Malheiros
  • 1,400
  • 10
  • 16
0
votes
1 answer

how to remove tuples with similar content by different orders in SPARQL

I have a query returning a couple of variable, ?a and ?b. The problem is that the results contain, for instance, 10, 15, and 15, 10. I need only one of these. How can I check if the tuple already exists? My query is messy but looks like…
msc87
  • 943
  • 3
  • 17
  • 39
0
votes
1 answer

Difficulty reading a matrix as a node in rdflib

I created an RDF file where images are stored in nodes as matrices. However when I try to read them I cannot get the matrix form: For example from rflib import Literal mm = np.random.normal(0,1,(3,3)) L = Literal(mm) it is very easy to get the…
0
votes
3 answers

Retrieving distinct values with rdflib

The following python code is part of a larger piece (everything else is working fine): import rdflib g1 = rdflib.Graph() g1.parse("existing_graph.nt", format="nt") q = "select ?ent_a ?ent_b where { ?ent_a ?c . " \ …
GalB1t
  • 265
  • 1
  • 3
  • 13
0
votes
1 answer

performing sparql query on the rdf data stored in relational database

I have stored large amount of RDF data into a relational database with the help of rdflib_sqlalchemy.SQLAlchemy.Now I want to execute Sparql query over the same.I can not find any thing to know how to implement sparql query here. Can anyone help.
Niharika Roy
  • 103
  • 1
  • 1
  • 7
0
votes
0 answers

SPARQL query parsing trouble in rdflib

I am trying to write SPARQL queries using rdflib in python and here below is my code. I want the queries just to return the values of the class or the entities without the URI or the namespace. I don't want to parse the results using regex. I am…
suv_12
  • 3
  • 2
0
votes
0 answers

how to unpack dmoz urls from rdf dump with python and rdflib?

i tried to open rdf file (dmoz rdf dump), but a get this error message Traceback (most recent call last): File "/media/_dev_/ODP_RDF_get_links.py", line 4, in result = g.parse("data/content.rdf") File…
user2307154
0
votes
1 answer

How to solve SPARQL warning?

I am trying to retrieve the name of inkers of Comic books. I am trying to build an ontology. Inkers has dbpprop and I have imported rdlib and sparqlWrapper whilst I am having following error. Is there any one who understand this problem? …
Sandesh Rana
  • 81
  • 4
  • 13
0
votes
2 answers

How can I convert SPARQL query into JSON format?

This is my code #!/usr/bin/python # -*- coding: utf-8 -*- import requests from requests.auth import HTTPBasicAuth from abc import ABCMeta, abstractmethod class PPTSparqlClient: """Minimal Class to access PPT SparqlEndpoints""" def…
Kushal Shah
  • 165
  • 1
  • 13
0
votes
1 answer

Error tolerant RDF parsing using RDFlib in python

I am writing a code, that gathers some statistics about ontologies. as input I have a folder with files some are RDF/XML, some are turtle or nt. My problem is, that when I try to parse a file using wrong format, next time even if I parse it with…
Andrejs
  • 130
  • 5
0
votes
1 answer

RDFlib with Fuseki running queries very slowly on local server

I have a small wsgi app, running a local Cherry server, and I use the RDFlib to turn human language queries into SPARQL queries for querying a ttl file loaded to fuseki. It works, but it is incredibly slow! The previous version of this script…
user3241376
  • 407
  • 7
  • 20
0
votes
0 answers

RDFlib namespace or prefix parsing error

I have a problem when I get the results of a SPARQL query executed on a simple turtle model. In the model on which the query is executed, I have a prefix which is called "ex1" and another prefix "op" which comes from an imported ontology. However,…
0
votes
1 answer

Extraction of datatype and label names from rdflib.term.Literal

I am executing sparql query through python rdflib like r=sparql.prepareQuery('SELECT ?label WHERE { <%s> rdfs:label ?label . }'%i) My aim is to get the labels for the concepts in this way. As a result I get something like…
ankita singh
  • 115
  • 1
  • 1
  • 9
0
votes
2 answers

Using IPython Notebook (with rdflib?) to log SPARQL queries and results

I want to use IPython Notebook to record SPARQL queries together with the results of those queries. Since any command-line tool can be called from IPython Notebook with a "bang", I can of course run: !arq --data dcterms.ttl --query test1.rq or with…
Tom Baker
  • 683
  • 5
  • 17
0
votes
1 answer

Trouble with rdfstore with mysql - how to debug?

I have a mysql server running and can connect to it from my Django ORM. Can't connect using the rdflib functionality. How can I debug this problem? Thanks. rdflib 2.4.2, python 2.6, MySQL Community 5.1.42 Trace: configString =…
user265775
  • 39
  • 3