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
0 answers

rdflib-jsonld removes a / from URLs while parsing graph

This is my code to populate and parse an rdflib graph: context = { "@context": { "isGiven": URIRef('<'+'https://w3id.org/ontology#isGiven'+rdfLizerItem['ProductByCategory']+'>'), "givenAs":…
kurious
  • 1,024
  • 10
  • 29
0
votes
2 answers

SPARQL Query returns nothing from a specific RDF graph

After creating an RDF graph using RDFLib in python to apply a sensor ontology ( I used for that a sensor ontology, used also namespace and Bnode which is a blank node representing a resource for which a URI or literal is not given). I tried to query…
raeX
  • 3,197
  • 2
  • 14
  • 21
0
votes
1 answer

rdflib-jsonld generates spurious url when '<' is used in '@id'

I'm using rdflib-jsonld to parse some NoSQL data and insert into Sesame. This is the problematic portion of the code: context = { "@context": { "isGiven": URIRef('<'+'http://purl.org/net/something#isGiven'+rdfLizerItem['FooByBar']+'>'), …
kurious
  • 1,024
  • 10
  • 29
0
votes
1 answer

Python RDFLib get object value by subject and predicate

I have a rdf file that looks like this: a little
cirnelle
  • 59
  • 3
  • 8
0
votes
1 answer

How to INSERT all triples from an RDFlib graph into another repository without iterating through every triple?

This question is related to What URI to use for a Sesame repository while executing a SPARQL ADD query. I'm trying to INSERT all triples from a Sesame repository into another (Dydra). There are a couple of ways to do it, such as using SERVICE clause…
kurious
  • 1,024
  • 10
  • 29
0
votes
1 answer

How to iterate over CONSTRUCT output from rdflib?

This is a follow-up question from How to prevent triples from getting mixed up while uploading to Dydra programmatically? I've created a new graph using SPARQL CONSTRUCT query. I now want to iterate over it so that I can add the statements to an…
kurious
  • 1,024
  • 10
  • 29
0
votes
2 answers

How to prevent triples from getting mixed up while uploading to Dydra programmatically?

I am trying to upload some data to Dydra from a Sesame triplestore I have on my computer. While the download from Sesame works fine, the triples get mixed up (the s-p-o relationships change as the object of one becomes object of another). Can…
kurious
  • 1,024
  • 10
  • 29
0
votes
1 answer

RDFLib (Python) to Sesame (JAVA)

I have the following code in python using RDFLib and I want to translate it into JAVA using Sesame libraries. Python restrictionNode= BNode() g.add((nodeIndividualName,rdftype,restrictionNode)) g.add((restrictionNode, rdftype,…
msc87
  • 943
  • 3
  • 17
  • 39
0
votes
1 answer

Unable to log into Dydra using Python

I'm a registered user with Dydra and trying to update a repository programmatically in it. Even though I have logged in, I get a 401 error when trying to update a repository. Following is my code: username = 'myUsername' password =…
kurious
  • 1,024
  • 10
  • 29
0
votes
1 answer

rdflib in Python - xsd:double value without scientific notation

I am looking for hints how to format values in a Turtle RDF graph, rdflib for Python. Currently I get values of datatype double displayed in scientific notation: -4.28322e-01 ; 5.175547e+01 ; and what I need to achieve is "-0.428322"^^xsd:double…
0
votes
1 answer

XML Sparql results from rdflib

I am using Graph() in RDFLib, i am correctly getting results of from the graph using sparql. Is it possible to get the results directly in HTML table format?
Noor
  • 19,638
  • 38
  • 136
  • 254
0
votes
1 answer

How do I add image url with graph add in rdflib

I am using rdflib==4.1.2. This is my code >>> g=rdflib.Graph() >>> s=rdflib.BNode() >>> FOAF = rdflib.Namespace("http://xmlns.com/foaf/0.1/") >>> g.bind('foaf', FOAF) >>> g.add((s,…
trishnag
  • 182
  • 1
  • 3
  • 13
0
votes
1 answer

rdflib using sqlalchemy plugin causes ImportError

When trying to execute the demo given on https://github.com/RDFLib/rdflib-sqlalchemy I receive an error File "store = plugin.get("SQLAlchemy", Store)(identifier=self.ident) File "/usr/local/lib/python3.5/site-packages/rdflib/plugin.py", line 104,…
trevore
  • 425
  • 2
  • 10
0
votes
1 answer

how to parse json-ld file with rdflib.parse() or load()

I am new to json-ld and rdflib usage. I have json-ld file with @context and @graph sections inside. I want to use rdflib open to load this graph. When I try using parse() method, with format='n3', I am getting error BadSyntax: at line 5 of <>: Bad…
chetan pawar
  • 485
  • 3
  • 9
0
votes
1 answer

Can compacting arrays be more selective in JSON-LD framing?

In the question JSON-LD framing single object arrays was asked on how to make arrays from single objects while framing JSON-LD for all arrays (by adding an compactArrays option). Is there any way to do it selectively? Starting from always having…
Roman Susi
  • 4,135
  • 2
  • 32
  • 47