RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.

Overview

RDFLib

Build Status Coveralls branch GitHub stars PyPI PyPI

RDFLib is a pure Python package for working with RDF. RDFLib contains most things you need to work with RDF, including:

  • parsers and serializers for RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, Trig and JSON-LD
  • a Graph interface which can be backed by any one of a number of Store implementations
  • store implementations for in-memory, persistent on disk (Berkeley DB) and remote SPARQL endpoints
  • a SPARQL 1.1 implementation - supporting SPARQL 1.1 Queries and Update statements
  • SPARQL function extension mechanisms

RDFlib Family of packages

The RDFlib community maintains many RDF-related Python code repositories with different purposes. For example:

  • rdflib - the RDFLib core
  • sparqlwrapper - a simple Python wrapper around a SPARQL service to remotely execute your queries
  • pyLODE - An OWL ontology documentation tool using Python and templating, based on LODE.

Please see the list for all packages/repositories here:

Versions & Releases

  • 6.0.1-alpha current master branch
  • 6.x.y current release and support Python 3.7+ only. Many improvements over 5.0.0
  • 5.x.y supports Python 2.7 and 3.4+ and is mostly backwards compatible with 4.2.2.

See https://rdflib.dev for the release schedule.

Documentation

See https://rdflib.readthedocs.io for our documentation built from the code. Note that there are latest, stable 5.0.0 and 4.2.2 documentation versions, matching releases.

Installation

The stable release of RDFLib may be installed with Python's package management tool pip:

$ pip install rdflib

Alternatively manually download the package from the Python Package Index (PyPI) at https://pypi.python.org/pypi/rdflib

The current version of RDFLib is 6.0.0, see the CHANGELOG.md file for what's new in this release.

Installation of the current master branch (for developers)

With pip you can also install rdflib from the git repository with one of the following options:

$ pip install git+https://github.com/rdflib/rdflib@master

or

$ pip install -e git+https://github.com/rdflib/rdflib@master#egg=rdflib

or from your locally cloned repository you can install it with one of the following options:

$ python setup.py install

or

$ pip install -e .

Getting Started

RDFLib aims to be a pythonic RDF API. RDFLib's main data object is a Graph which is a Python collection of RDF Subject, Predicate, Object Triples:

To create graph and load it with RDF data from DBPedia then print the results:

from rdflib import Graph
g = Graph()
g.parse('http://dbpedia.org/resource/Semantic_Web')

for s, p, o in g:
    print(s, p, o)

The components of the triples are URIs (resources) or Literals (values).

URIs are grouped together by namespace, common namespaces are included in RDFLib:

from rdflib.namespace import DC, DCTERMS, DOAP, FOAF, SKOS, OWL, RDF, RDFS, VOID, XMLNS, XSD

You can use them like this:

from rdflib import Graph, URIRef, Literal
from rdflib.namespace import RDFS

g = Graph()
semweb = URIRef('http://dbpedia.org/resource/Semantic_Web')
type = g.value(semweb, RDFS.label)

Where RDFS is the RDFS Namespace, g.value returns an object of the triple-pattern given (or an arbitrary one if more exist).

Or like this, adding a triple to a graph g:

g.add((
    URIRef("http://example.com/person/nick"),
    FOAF.givenName,
    Literal("Nick", datatype=XSD.string)
))

The triple (in n-triples notation) <http://example.com/person/nick> <http://xmlns.com/foaf/0.1/givenName> "Nick"^^<http://www.w3.org/2001/XMLSchema#string> . is created where the property FOAF.giveName is the URI <http://xmlns.com/foaf/0.1/givenName> and XSD.string is the URI <http://www.w3.org/2001/XMLSchema#string>.

You can bind namespaces to prefixes to shorten the URIs for RDF/XML, Turtle, N3, TriG, TriX & JSON-LD serializations:

g.bind("foaf", FOAF)
g.bind("xsd", XSD)

This will allow the n-triples triple above to be serialised like this:

print(g.serialize(format="turtle"))

With these results:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

<http://example.com/person/nick> foaf:givenName "Nick"^^xsd:string .

New Namespaces can also be defined:

dbpedia = Namespace('http://dbpedia.org/ontology/')

abstracts = list(x for x in g.objects(semweb, dbpedia['abstract']) if x.language=='en')

See also ./examples

Features

The library contains parsers and serializers for RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, JSON-LD, RDFa and Microdata.

The library presents a Graph interface which can be backed by any one of a number of Store implementations.

This core RDFLib package includes store implementations for in-memory storage and persistent storage on top of the Berkeley DB.

A SPARQL 1.1 implementation is included - supporting SPARQL 1.1 Queries and Update statements.

RDFLib is open source and is maintained on GitHub. RDFLib releases, current and previous are listed on PyPI

Multiple other projects are contained within the RDFlib "family", see https://github.com/RDFLib/.

Running tests

Running the tests on the host

Run the test suite with pytest.

pytest

Running test coverage on the host with coverage report

Run the test suite and generate a HTML coverage report with pytest and pytest-cov.

pytest --cov

Running the tests in a Docker container

Run the test suite inside a Docker container for cross-platform support. This resolves issues such as installing BerkeleyDB on Windows and avoids the host and port issues on macOS.

make tests

Tip: If the underlying Dockerfile for the test runner changes, use make build.

Running the tests in a Docker container with coverage report

Run the test suite inside a Docker container with HTML coverage report.

make coverage

Viewing test coverage

Once tests have produced HTML output of the coverage report, view it by running:

pytest --cov --cov-report term --cov-report html
python -m http.server --directory=htmlcov

Contributing

RDFLib survives and grows via user contributions! Please read our contributing guide to get started. Please consider lodging Pull Requests here:

You can also raise issues here:

Support & Contacts

For general "how do I..." queries, please use https://stackoverflow.com and tag your question with rdflib. Existing questions:

If you want to contact the rdflib maintainers, please do so via:

Comments
  • Configure pytest

    Configure pytest

    This needs to be rebased after #1267 is merged.

    Proposed Changes

    • Remove nose
    • Use pytest

    Nose has been in maintenance mode for the past several years and will likely cease without a new person/team to take over maintainership. New projects should consider using Nose2, py.test, or just plain unittest/unittest2. (https://nose.readthedocs.io/en/latest/#note-to-users)

    The test coverage is not the same, some tests are not yet executed.

    Check: https://docs.pytest.org/en/stable/nose.html

    yield tests are not supported by pytest. (This was how they worked in nose) Some are changed to direct calls, but maybe we want to actually have test generators in these cases. We might use https://hypothesis.readthedocs.io/en/latest/quickstart.html for this.

    The migration is no simple task. Additional contributions are very welcome!

    help wanted 
    opened by white-gecko 46
  • namespace.py fix compute_qname missing namespaces

    namespace.py fix compute_qname missing namespaces

    The way the compute_qname worked was to call split_uri and then see if there was a match in self.store.prefix. This produced incomplete behavior for namesapces that end in LETTERS_ instead of / or #. This commit corrects this behavior by iterating through name and testing namespace + name[:i] to see if there is a matching prefix.

    serialization discussion 
    opened by tgbugs 46
  • Add tests demonstrating forward-slash behaviors in Turtle, JSON-LD, and SPARQL

    Add tests demonstrating forward-slash behaviors in Turtle, JSON-LD, and SPARQL

    This pull request supports Issue 1871.

    A follow-on PR will be required to finish resolving that issue.

    Summary of changes

    • Add tests to confirm conformance to SPARQL specification on handling of forward-slash and backslash characters outside of string-literals.
    • Backwards-incompatibility: Current SPARQL engine permits backslash characters where SPARQL specification does not. Revisions that would get these new tests to pass will now raise parsing errors from SPARQL queries that were similarly misaligned with the SPARQL specification. However, this may be preferable, as these queries are likely to be silently failing.

    Checklist

    • [x] Checked that there aren't other open pull requests for the same change.
    • [x] Added tests for any changes that have a runtime impact.
    • [x] Checked that all tests and type checking passes.
    • For changes that have a potential impact on users of this project:
      • [ ] Updated relevant documentation to avoid inaccuracies.
      • [x] Considered adding additional documentation.
      • [ ] Considered adding an example in ./examples for new features.
      • [ ] Considered updating our changelog (CHANGELOG.md).
    • [x] Considered granting push permissions to the PR branch, so maintainers can fix minor issues and keep your PR up to date.
    opened by ajnelson-nist 36
  • test re-org

    test re-org

    Summary of changes

    Collected variously-scattered test data files into a single data folder, refreshed the w3c test suite, using the published RDF 1.1. test data, updated involved test files to reference the relocated test suites, renamed some otherwise rather cryptic test data folder names to communicate more clearly the purpose / relevance. Migrated some more tests from the test directory into sub-folders.

    Checklist

    • [x] Checked that there aren't other open pull requests for the same change (working with @aucampia on this).
    • [x] Added tests for any changes that have a runtime impact.
    • [x] Checked that all tests pass (test result stats "5050 passed, 5 skipped, 108 xfailed, 51 warnings" same as before).
    • [x] Considered granting push permissions to the PR branch, so maintainers can fix minor issues and keep your PR up to date.
    critical 
    opened by gjhiggins 36
  • raise BadSyntax(self._thisDoc, self.lines, argstr, i, msg) rdflib.plugins.parsers.notation3.BadSyntax:

    raise BadSyntax(self._thisDoc, self.lines, argstr, i, msg) rdflib.plugins.parsers.notation3.BadSyntax:

    I tried to parse a file in turtle format but I am getting this error and cannot find how to solve it :

    link to the database : http://kaiko.getalp.org/about-dbnary/download/

       Traceback (most recent call last):
      File "/gpfs7kw/linkhome/rech/genlig01//test/expe_5/dbnary_corpus/extract.py", line 25, in <module>
        result = g.parse('fr_dbnary_ontolex.ttl', format='n3')
      File "/linkhome/rech/genlig01//.conda/envs/bert/lib/python3.9/site-packages/rdflib/graph.py", line 1078, in parse
        parser.parse(source, self, **args)
      File "/linkhome/rech/genlig01//.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 1915, in parse
        TurtleParser.parse(self, source, conj_graph, encoding, turtle=False)
      File "/linkhome/rech/genlig01/u/.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 1886, in parse
        p.loadStream(source.getByteStream())
      File "/linkhome/rech/genlig01/u/.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 442, in loadStream
        return self.loadBuf(stream.read())    # Not ideal
      File "/linkhome/rech/genlig01/umg16uw/.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 448, in loadBuf
        self.feed(buf)
      File "/linkhome/rech/genlig01//.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 474, in feed
        i = self.directiveOrStatement(s, j)
      File "/linkhome/rech/genlig01//.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 495, in directiveOrStatement
        j = self.statement(argstr, i)
      File "/linkhome/rech/genlig01//.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 733, in statement
        j = self.property_list(argstr, i, r[0])
      File "/linkhome/rech/genlig01//.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 1096, in property_list
        self.BadSyntax(argstr, j,
      File "/linkhome/rech/genlig01//.conda/envs/bert/lib/python3.9/site-packages/rdflib/plugins/parsers/notation3.py", line 1623, in BadSyntax
        raise BadSyntax(self._thisDoc, self.lines, argstr, i, msg)
    rdflib.plugins.parsers.notation3.BadSyntax: at line 2093929 of <>:
    Bad syntax (objectList expected) at ^ in:
    "...b'rotecteur."@fr ] .\n\n<http://kaiko.getalp.org/dbnary/fra/__tr'^b'_eng_1_facteur_d\xe2\x80\x99att\xc3\xa9nuation__nom__1>\n        rdf:type   '..."
    
    

    I made a search in the file but the line is correctly written. So I do not how to dit, I have to parse the file.

    here code :

    read specific columns of csv file using Pandas

    import csv
    import os
    import pprint
    
    import rdflib
    from rdflib import Graph, Literal, RDF, URIRef
    # rdflib knows about quite a few popular namespaces, like W3C ontologies, schema.org etc.
    from rdflib.namespace import FOAF , XSD
    
    g = rdflib.Graph()
    
    result = g.parse('fr_dbnary_ontolex.ttl', format='n3') # 
    
    q_noun = """
        
    SELECT * WHERE {
           ?lexeme a ontolex:LexicalEntry ;
             rdfs:label ?label ;
             lexinfo:partOfSpeech lexinfo:noun;
             dbnary:synonym   ?syn .
        }
    
    """
    for p, o, s in g.query(q_noun):
          with open("dbnary_synonym.tsv", 'a', encoding='utf-8') as f:
    	      f.write(p + "\t" + o + "\t" + s + '\n')
    

    I changed the format to turtle but the error is still produced. I checked the file and it correctly written.

    file look like this : small view since the file is quite huge.

    
    @prefix dbetym:   <http://etytree-virtuoso.wmflabs.org/dbnaryetymology#> .
    @prefix dbnary:   <http://kaiko.getalp.org/dbnary#> .
    @prefix dbstats:  <http://kaiko.getalp.org/dbnary/statistics/> .
    @prefix dcterms:  <http://purl.org/dc/terms/> .
    @prefix decomp:   <http://www.w3.org/2002/07/owl#> .
    @prefix fra:      <http://kaiko.getalp.org/dbnary/fra/> .
    @prefix lexinfo:  <http://www.lexinfo.net/ontology/2.0/lexinfo#> .
    @prefix lexvo:    <http://lexvo.org/id/iso639-3/> .
    @prefix lime:     <http://www.w3.org/ns/lemon/lime#> .
    @prefix olia:     <http://purl.org/olia/olia.owl#> .
    @prefix ontolex:  <http://www.w3.org/ns/lemon/ontolex#> .
    @prefix qb:       <http://purl.org/linked-data/cube#> .
    @prefix rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs:     <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix skos:     <http://www.w3.org/2004/02/skos/core#> .
    @prefix synsem:   <http://www.w3.org/ns/lemon/synsem#> .
    @prefix vartrans: <http://www.w3.org/ns/lemon/vartrans#> .
    @prefix wikt:     <https://fr.wiktionary.org/wiki/> .
    @prefix xs:       <http://www.w3.org/2001/XMLSchema#> .
    fra:accueil__nom__1  rdf:type  ontolex:Word , ontolex:LexicalEntry ;
            rdfs:label             "accueil"@fr ;
            dbnary:partOfSpeech    "-nom-" ;
            dbnary:synonym         fra:home , fra:main_page , <http://kaiko.getalp.org/dbnary/fra/page_d’accueil> ;
            dcterms:language       lexvo:fra ;
            lexinfo:partOfSpeech   lexinfo:noun ;
            lime:language          "fr" ;
            ontolex:canonicalForm  fra:__cf_accueil__nom__1 ;
            ontolex:sense          fra:__ws_1_accueil__nom__1 , fra:__ws_2_accueil__nom__1 , fra:__ws_3_accueil__nom__1 , fra:__ws_4_accueil__nom__1 , fra:__ws_5_accueil__nom__1 .
    fra:__cf_accueil__nom__1
            rdf:type             ontolex:Form ;
            lexinfo:gender       lexinfo:masculine ;
            ontolex:phoneticRep  "a.kœj"@fr-fonipa ;
            ontolex:writtenRep   "accueil"@fr .
    fra:lire__verb__1  rdf:type    ontolex:Word , ontolex:LexicalEntry ;
            rdfs:label             "lire"@fr ;
            dbnary:partOfSpeech    "-verb-" ;
            dbnary:synonym         fra:lire ;
            dcterms:language       lexvo:fra ;
            lexinfo:partOfSpeech   lexinfo:verb ;
            lime:language          "fr" ;
            ontolex:canonicalForm  fra:__cf_lire__verb__1 ;
            ontolex:sense          fra:__ws_1_lire__verb__1 , fra:__ws_2_lire__verb__1 , fra:__ws_3_lire__verb__1 , fra:__ws_4_lire__verb__1 , fra:__ws_5_lire__verb__1 , fra:__ws_6_lire__verb__1 , fra:__ws_7_lire__verb__1 , fra:__ws_8_lire__verb__1 , fra:__ws_9_lire__verb__1 .      
    fra:meuble__adj__1  rdf:type   ontolex:Word , ontolex:LexicalEntry ;
            rdfs:label             "meuble"@fr ;
            dbnary:antonym         fra:dur , fra:solide , fra:immeuble ;
            dbnary:partOfSpeech    "-adj-" ;
            dcterms:language       lexvo:fra ;
            lexinfo:partOfSpeech   lexinfo:adjective ;
            lime:language          "fr" ;
            ontolex:canonicalForm  fra:__cf_meuble__adj__1 ;
            ontolex:sense          fra:__ws_1_meuble__adj__1 , fra:__ws_2_meuble__adj__1 .
    fra:militaire__adj__1
            rdf:type               ontolex:Word , ontolex:LexicalEntry ;
            rdfs:label             "militaire"@fr ;
            dbnary:antonym         fra:civil ;
            dbnary:partOfSpeech    "-adj-" ;
            dbnary:synonym         fra:martial , fra:guerrier ;
            dcterms:language       lexvo:fra ;
            lexinfo:partOfSpeech   lexinfo:adjective ;
            lime:language          "fr" ;
            ontolex:canonicalForm  fra:__cf_militaire__adj__1 ;
            ontolex:sense          fra:__ws_1_militaire__adj__1 , fra:__ws_2_militaire__adj__1 , fra:__ws_3_militaire__adj__1 .
    
    fra:mercredi__adv__1  rdf:type  ontolex:Word , ontolex:LexicalEntry ;
            rdfs:label             "mercredi"@fr ;
            dbnary:partOfSpeech    "-adv-" ;
            dbnary:synonym         fra:civil1 ;
            dcterms:language       lexvo:fra ;
            lexinfo:partOfSpeech   lexinfo:adverb ;
            lime:language          "fr" ;
            ontolex:canonicalForm  fra:__cf_mercredi__adv__1 ;
            ontolex:sense          fra:__ws_1_mercredi__adv__1 .
    
    fra:mercredi__adv__1  rdf:type  ontolex:Word , ontolex:LexicalEntry ;
            rdfs:label             "mercredi"@fr ;
            dbnary:synonym         fra:civil2 ;
            dbnary:partOfSpeech    "-adv-" ;
            dcterms:language       lexvo:fra ;
            lexinfo:partOfSpeech   lexinfo:adverb ;
            lime:language          "fr" ;
            ontolex:canonicalForm  fra:__cf_mercredi__adv__1 ;
            ontolex:sense          fra:__ws_1_mercredi__adv__1 .
    
    <http://kaiko.getalp.org/dbnary/fra/page_d’accueil>
            rdf:type          dbnary:Page ;
            dbnary:describes  <http://kaiko.getalp.org/dbnary/fra/page_d’accueil__nom__1> .
    
    <http://kaiko.getalp.org/dbnary/fra/page_d’accueil>
            rdf:type          dbnary:Page ;
            dbnary:describes  <http://kaiko.getalp.org/dbnary/fra/page_d’accueil__nom__1> .
    
    opened by keloemma 33
  • Migrate from nosetest to pytest

    Migrate from nosetest to pytest

    This patch replace all uses of nose with pytest. It also includes a pytest plugin for creating EARL reports for tests with a rdf_test_uri parameter.

    Some caveats:

    • HTML report directory is now htmlcov instead of coverage
    • ~~There is some warning related to the EARL reporting plugin which I can't quite figure out:~~
      .venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676
        /home/iwana/sw/d/github.com/iafork/rdflib/.venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: test.earl
          self.import_plugin(import_spec)
      

      ~~This is not causing any problems as far as I can tell, but still annoying.~~ (this problem has been fixed in the latest commit)

    • python setup.py test won't work anymore, I can make it work but this is not advised by pytest: https://github.com/pytest-dev/pytest-runner/#deprecation-notice
    • run_test.py is still there but it's not really referenced anymore from anywhere and the options it accepts are completely different as it's options were based on nose. I would say it should be removed entirely but for now it is basically just a wrapper around pytest that basically does nothing.
    • Removed references to test attributes as currently they are not being used anywhere anyway, I guess we can add them back if there is some use for them later.
    • A lot of tests are still marked to skip when really they should be marked with xfail. This is also affecting the RDFT test manifests and result in reports saying tests are skipped when really we know they will fail and they are only skipped for this reason. But there is no change here from before, and pytest makes it easier to dynamically do expected failures.

    Special thanks to Wes Turner for his advice and inputs on this process.

    Other info

    Fixes #1414 Closes #1268

    The work in this PR is based on #1268 which was started by @white-gecko.

    Coverage can be seen at https://coveralls.io/github/RDFLib/rdflib

    Proposed Changes

    • Replace nose with pytest
    • Use a pytest plugin for EARL reporting
    opened by aucampia 33
  • Bind prefixes choices

    Bind prefixes choices

    Fixes #1679

    Proposed Changes

    • a bunch of reST documentation updates
    • updates to inline docc for term.py classes (RDF 1.1, not 1.0 explanations)
    • new param for Graph(): bind_namespaces
      • with options for none, core prefixes (default), all RDFLib Namespaces or use of prefix.cc

    Since this PR is really needed - see the comments - I'm pushing it up to review before the prefix.cc option is implemented.

    opened by nicholascar 28
  • RDF*/SPARQL* support?

    RDF*/SPARQL* support?

    There is currently a W3C working group considering the adoption of Olaf Hartig's work on RDF*/SPARQL* as a W3C standard (http://olafhartig.de/files/Hartig_AMW2017_RDFStar.pdf). Several DB vendors already support this syntax (Anzo, Stardog, Blazegraph), and others are working on adding it as a feature. It provides a great bridge between RDF and Property graphs.

    Could this be possibly added to rdflib?

    enhancement SPARQL 
    opened by sa-bpelakh 26
  • Move Store API to work with identifiers, not graphs

    Move Store API to work with identifiers, not graphs

    This is a rebase of PR #958, PR #409 rebased against master to fix #167

    Proposed Changes

    As per original PR, all instances of Graph objects as contexts changed to Graph identifiers.

    • graph.py
    • auditable.py
    • notation3.py
    • sparqlstore.py
    • store.py
    • update.py
    • corresponding changes to tests and three annotations of failure.
    opened by gjhiggins 25
  • Invalid URI

    Invalid URI

    I got this:

    File "ws23/ws23.py", line 35, in web_search_to_triples triples = g.serialize(format=RDFLIB_FORMAT).split("\n")
    File "/usr/local/lib/python2.7/dist-packages/rdflib/graph.py", line 936, in serialize serializer.serialize(stream, base=base, encoding=encoding, **args)
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 208, in serialize if self.statement(subject) and not firstTime:
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/n3.py", line 92, in statement or super(N3Serializer, self).statement(subject))
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 269, in statement return self.s_squared(subject) or self.s_default(subject)
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 282, in s_squared self.predicateList(subject)
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 373, in predicateList self.objectList(properties[propList[0]])
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 388, in objectList self.path(objects[0], OBJECT)
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/n3.py", line 96, in path super(N3Serializer, self).path(node, position, newline)
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 288, in path or self.p_default(node, position, newline)):
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 294, in p_default self.write(self.label(node, position))
    File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/serializers/turtle.py", line 310, in label return self.getQName(node, position == VERB) or node.n3()
    File "/usr/local/lib/python2.7/dist-packages/rdflib/term.py", line 224, in n3 raise Exception('"%s" does not look like a valid URI, I cannot serialize this as N3/Turtle. Perhaps you wanted to urlencode it?'%self)
    Exception: "http://www.imdb.com/title/tt0091369//search/title?locations=West Wycombe Park, West Wycombe, Buckinghamshire, England, UK&ref_=tt_dt_dt" does not look like a valid URI, I cannot serialize this as N3/Turtle. Perhaps you wanted to urlencode it?  
    

    This is the full triple:

    _:node81b1978fce492c4b779bdd9d709f9e7f <http://schema.org/Movie/url> <http://www.imdb.com/title/tt0091369//search/title?locations=West Wycombe Park, West Wycombe, Buckinghamshire, England, UK&ref_=tt_dt_dt> .
    

    I could observe that the triple is correctly parsed but cannot be serialized:

    from rdflib import Graph
    t = "_:node81b1978fce492c4b779bdd9d709f9e7f <http://schema.org/Movie/url> <http://www.imdb.com/title/tt0091369//search/title?locations=West Wycombe Park, West Wycombe, Buckinghamshire, England, UK&ref_=tt_dt_dt> ."
    g = Graph()
    g.parse(data=t, format="n3")
    for s, p, o in g:
        print s, p, o
    g.serialize(format="n3")
    

    Please, tell me if you need more details.

    discussion 
    opened by petrux 24
  • new version does not parse URL in windows

    new version does not parse URL in windows

    The old version(5) does parse remote URL in windows, however, the new version shows error "[WinError 123] The syntax for the file name, directory name or disk label is incorrect:" when parse. Is it possible to change it?Thanks

    bug 
    opened by yuechenbam 23
  • build(deps): update sphinx requirement from <6,>=5 to >=5,<7

    build(deps): update sphinx requirement from <6,>=5 to >=5,<7

    Updates the requirements on sphinx to permit the latest version.

    Release notes

    Sourced from sphinx's releases.

    v6.0.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    Changelog

    Sourced from sphinx's changelog.

    Release 6.0.0 (released Dec 29, 2022)

    Dependencies

    • #10468: Drop Python 3.6 support
    • #10470: Drop Python 3.7, Docutils 0.14, Docutils 0.15, Docutils 0.16, and Docutils 0.17 support. Patch by Adam Turner

    Incompatible changes

    • #7405: Removed the jQuery and underscore.js JavaScript frameworks.

      These frameworks are no longer be automatically injected into themes from Sphinx 6.0. If you develop a theme or extension that uses the jQuery, $, or $u global objects, you need to update your JavaScript to modern standards, or use the mitigation below.

      The first option is to use the sphinxcontrib.jquery_ extension, which has been developed by the Sphinx team and contributors. To use this, add sphinxcontrib.jquery to the extensions list in conf.py, or call app.setup_extension("sphinxcontrib.jquery") if you develop a Sphinx theme or extension.

      The second option is to manually ensure that the frameworks are present. To re-add jQuery and underscore.js, you will need to copy jquery.js and underscore.js from the Sphinx repository_ to your static directory, and add the following to your layout.html:

      .. code-block:: html+jinja

      {%- block scripts %} {{ super() }} {%- endblock %}

      .. _sphinxcontrib.jquery: https://github.com/sphinx-contrib/jquery/

      Patch by Adam Turner.

    • #10471, #10565: Removed deprecated APIs scheduled for removal in Sphinx 6.0. See :ref:dev-deprecated-apis for details. Patch by Adam Turner.

    • #10901: C Domain: Remove support for parsing pre-v3 style type directives and roles. Also remove associated configuration variables c_allow_pre_v3 and c_warn_on_allowed_pre_v3. Patch by Adam Turner.

    Features added

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 1
  • Fix for `SELECT *` inside `SELECT *` bug

    Fix for `SELECT *` inside `SELECT *` bug

    Summary of changes

    Fixing use of SELECT * in sub-select within SELECT * parent query as discovered in https://github.com/RDFLib/rdflib/issues/1722.

    Now when an instance of SELECT * is encountered, the query tree/plan builder now correctly considers the projected variables of any sub-select statements when deciding which variables should be projected out.

    Checklist

    • [X] Checked that there aren't other open pull requests for the same change.
    • [X] Added tests for any changes that have a runtime impact.
    • [X] Checked that all tests and type checking passes.
    • For changes that have a potential impact on users of this project:
      • [x] (NA) Updated relevant documentation to avoid inaccuracies.
      • [x] (NA) Considered adding additional documentation.
      • [x] (NA) Considered adding an example in ./examples for new features.
      • [x] (NA) Considered updating our changelog (CHANGELOG.md).
    • [X] Considered granting push permissions to the PR branch, so maintainers can fix minor issues and keep your PR up to date.
    opened by robons 1
  • Fixing bug applying VALUES outside of a GROUP BY

    Fixing bug applying VALUES outside of a GROUP BY

    Summary of changes

    Altering order in which aggregate variable aliases are renamed to user-defined variable names to ensure that when defining a VALUES pattern outside of a GROUP BY, the variables in the query are correctly joined to those defined in the VALUES pattern.

    The change fixes the following bug...

    Example of bug

    from pprint import pprint
    
    from rdflib import Graph, URIRef, Literal, RDFS
    
    graph = Graph()
    
    graph.add((URIRef("http://example.com/something"), RDFS.label, Literal("Match on this.")))
    graph.add((URIRef("http://example.com/something-else"), RDFS.label, Literal("Don't match on this.")))
    
    results = graph.query("""
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    
    SELECT ?obj ?label
    WHERE {
        ?obj rdfs:label ?label
    }
    GROUP BY ?obj ?label
    VALUES ( ?obj ) {
        ( <http://example.com/something> )
    }
    """)
    
    pprint([row.asdict() for row in results])
    

    results in the following erroneous output:

    [{'label': rdflib.term.Literal('Match on this.'),
      'obj': rdflib.term.URIRef('http://example.com/something')},
     {'label': rdflib.term.Literal("Don't match on this."),
      'obj': rdflib.term.URIRef('http://example.com/something-else')}]
    

    I would expect the the VALUES pattern to have filtered the results down to only include the result where ?obj is http://example.com/something, i.e.:

    [{'label': rdflib.term.Literal('Match on this.'),
      'obj': rdflib.term.URIRef('http://example.com/something')}]
    

    this is indeed the outcome when passing the data and query through the Apache JENA command line tools.

    Checklist

    • [X] Checked that there aren't other open pull requests for the same change.
    • [X] Added tests for any changes that have a runtime impact.
    • [X] Checked that all tests and type checking passes.
    • For changes that have a potential impact on users of this project:
      • [x] (NA) Updated relevant documentation to avoid inaccuracies.
      • [x] (NA) Considered adding additional documentation.
      • [x] (NA) Considered adding an example in ./examples for new features.
      • [x] (NA) Considered updating our changelog (CHANGELOG.md).
    • [X] Considered granting push permissions to the PR branch, so maintainers can fix minor issues and keep your PR up to date.
    opened by robons 0
  • move to poetry for dependency management; consolidate more settings into pyproject.toml

    move to poetry for dependency management; consolidate more settings into pyproject.toml

    Summary

    Goals:

    1. move from setup.py & setuptools to poetry, for dependency and project management.
    2. move other settings, from setup.cfg, into pyproject.toml.
    3. Consolidate all dependencies into one file, pyproject.toml, and remove the need for all requirements*txt files.

    Includes moving the package version into pyproject.toml, and in __init__.py, reading the version from pyproject.toml via use of importlib.metadata.

    TODO

    • ~Fixes to tox.ini are still needed.~ DONE
    • ~Updates to pyproject.toml are needed, to add more dependency groups, which should then be referenced in tox.ini and other build/linting configs that have steps requiring development-dependencies.~ DONE (preserving extras for now; the move to poetry dependency-groups is deferred as probably out-of-scope)
    • Remove references to requirements*txt files from
      • Taskfile.yaml
      • workflows/validate.yaml
    • Remove requirements*txt files once they are no longer referenced anywhere.

    Other details

    • With this change, versions of package dependencies are now explicit.
    • This change eliminates the use of static requirements*txt files from Dockerfile.devcontainer

    Summary of changes

    Checklist

    • [x] Checked that there aren't other open pull requests for the same change.
    • [ ] Added tests for any changes that have a runtime impact.
    • [x] Checked that all tests and type checking passes.
    • For changes that have a potential impact on users of this project:
      • [x] Updated relevant documentation to avoid inaccuracies.
      • [ ] Considered adding additional documentation.
      • [ ] Considered adding an example in ./examples for new features.
      • [ ] Considered updating our changelog (CHANGELOG.md).
    • [x] ~Considered~ granting push permissions to the PR branch, so maintainers can fix minor issues and keep your PR up to date.
    opened by jclerman 26
  • rdflib 5.0.0 to 6.2.0: pickled graph size increased

    rdflib 5.0.0 to 6.2.0: pickled graph size increased

    We currently use rdflib to process our thesaurus STW. We use the Graph.parse method to parse the corresponding RDF XML and the resulting graph is pickled (either by pickle from stdlib or with joblib) when saving different types of machine learning models/objects.

    I noticed that the size of the models increased a lot when updating from 5.0.0 to 6.2.0. I could recreate this behavior with a simple script:

    from pathlib import Path
    from pickle import dump
    
    from rdflib import Graph
    
    STW_PATH = Path("/path/to/stw_9.12.rdf")
    OUTPUT = Path("/tmp/output_x.y.z.pickle")
    
    if __name__ == '__main__':
        g = Graph()
        g.parse(str(STW_PATH))
    
        with OUTPUT.open("wb") as f:
            dump(g, f)
    
    $ ll -h /tmp/*.pickle
    -rw-rw-r-- 1 1000 1000 7,2M Dez 20 09:33 /tmp/output_5.0.0.pickle
    -rw-rw-r-- 1 1000 1000  21M Dez 20 09:35 /tmp/output_6.2.0.pickle
    

    The size of the stw RDF file is 15 MB.

    I wanted to report this behavior as it is cleary a step backwards in terms of disk space used and may be relevant to others as well. Although I'm not sure if the method of serialization by pickling is supported by you. I could only find one chapter in your docs about saving RDF in human readable formats. However, loading a pickled graph is much faster than parsing a graph, which is relevant when using a graph in a production system (where launch times matter).

    opened by cbartz 0
Releases(6.2.0)
  • 6.2.0(Jul 16, 2022)

    This is a minor release that includes bug fixes and features.

    User facing changes

    This section lists changes that have a potential impact on users of RDFLib, changes with no user impact are not included in this section.

    • SPARQL: Fixed handing of HAVING clause with variable composition. Closed issue #936 and issue #935, PR #1093.
    • JSON-LD parser: better support for content negotiation. Closed issue #1423, PR #1436.
    • Removed the following functions that were marked as deprecated and scheduled for removal in version 6.0.0: Graph.load, Graph.seq, Graph.comment, Graph.label. PR #1527.
    • Use functools.total_ordering to implement most comparison operations for rdflib.paths.Path. Closed issue #685, PR #1528.
    • Fixed error handling for invalid URIs. Closed issue #821, PR #1529.
    • InfixOWL: Fixed handling of cardinality 0. Closed issue #1453 and issue #944, PR #1530.
    • Added quad support to handling to rdflib.graph.ReadOnlyGraphAggregate.quads. Closed issue #430, PR #1590
    • Fixed base validation used when joining URIs. PR #1607.
    • Add GEO defined namespace for GeoSPARQL. Closed issue #1371, PR #1622.
    • Explicitly raise exception when rdflib.plugins.stores.sparqlstore.SPARQLStore.update is called. Closed issue #1032, PR #1623.
    • Added rdflib.plugins.sparql.processor.prepareUpdate. Closed issue #272 and discussion #1581, PR #1624.
    • Added rdflib.namespace.DefinedNamespaceMeta.__dir__. Closed issue #1593, PR #1626.
    • Removed TypeCheckError, SubjectTypeError, PredicateTypeError, ObjectTypeError and ContextTypeError as these exceptions are not raised by RDFLib and their existence will only confuse users which may expect them to be used. Also remove corresponding check_context, check_subject, check_predicate, check_object, check_statement, check_pattern that is unused. PR #1640.
    • Improved the population of the Accept HTTP header so that it is correctly populated for all formats. PR #1643.
    • Fixed some issues with SPARQL Algebra handling/translation. PR #1645.
    • Add nquads to recognized file extensions. PR #1653.
    • Fixed issues that prevented HexTuples roundtripping. PR #1656.
    • Make rdflib.plugins.sparql.operators.unregister_custom_function idempotent. Closed issue #1492, PR #1659.
    • Fixed the handling of escape sequences in the N-Triples and N-Quads parsers. These parsers will now correctly handle strings like "\\r". The time it takes for these parsers to parse strings with escape sequences will be increased, and the increase will be correlated with the amount of escape sequences that occur in a string. For strings with many escape sequences the parsing speed seems to be almost 4 times slower. Closed issue #1655, PR #1663.
      • Also marked rdflib.compat.decodeStringEscape as deprecated as this function is not used anywhere in RDFLib anymore and the utility that it does provide is not implemented correctly. It will be removed in RDFLib 7.0.0
    • Added an abstract class IdentifiedNode as a superclass of BNode and URIRef. Closed issue #1526, PR #1680.
    • Fixed turtle serialization of rdf:type in subject, object. Closed issue #1649, PR #1649.
    • Fixed turtle serialization of PNames that contain brackets. Closed issue #1661, PR #1678.
    • Added support for selecting which namespace prefixes to bind. Closed issue #1679 and issue #1880, PR #1686, PR #1845 and PR #2018.
      • Also added ConjunctiveGraph.get_graph.
      • Also added an override argument to Store.bind which behaves similarly to the override parameter for NamespaceManager.bind.
      • Also fixed handing of support of the override parameter to NamespaceManager.bind by passing.
    • Eliminated a DeprecationWarning related to plugin loading issue #1631, PR #1694.
    • Removed the rdflib.graph.ContextNode and rdflib.graph.DatasetQuad type aliases. These were not being widely used in RDFLib and were also not correct. PR #1695.
    • Added DefinedNamespace.as_jsonld_context. PR #1706.
    • Added rdflib.namespace.WGS for WGS84. Closed issue #1709, PR #1710.
    • Improved performance of DefinedNamespace by caching attribute values. PR #1718.
    • Only configure python logging if sys.stderr has a isatty attribute. Closed issue #1760, PR #1761.
    • Removed unused rdflib.compat.etree_register_namespace. PR #1768.
    • Fixed numeric shortcut handling in rdflib.util.from_n3. Closed issue #1769, PR #1771.
    • Add ability to detect and mark ill-typed literals. Closed issue #1757 and issue #848, PR #1773 and PR #2003.
    • Optimized NamespaceManager.compute_qname by caching validity. PR #1779.
    • SPARQL: Fixed the handling of EXISTS inside BIND for SPARQL. This was raising an exception during evaluation before but is now correctly handled. Closed issue #1472, PR #1794.
    • Propagate exceptions from SPARQL TSV result parser. Closed issue #1477, PR #1809
    • Eliminate usage of rdflib.term.RDFLibGenid as a type as this caused issues with querying. Closed issue #1808, PR #1821
    • Fixed handing of DefinedNamespace control attributes so that inspect.signature works correctly on defined namespaces. PR #1825.
    • Fixed namespace rebinding in Memory, SimpleMemory and BerkelyDB stores. Closed issue #1826, PR #1843.
    • Fixed issues with the N3 serializer. Closed issue #1701 and issue #1807, PR #1858:
      • The N3 serializer was incorrectly considers a subject as seralized if it is serialized in a quoted graph.
      • The N3 serializer does not consider that the predicate of a triple can also be a graph.
    • Added NamespaceManager.expand_curie. Closed issue #1868, PR #1869.
    • Added Literal.__sub__ and support for datetimes to both Literal.__add__ and Literal.__sub__. PR #1870.
    • SPARQL: Fix None/undefined handing in GROUP_CONCAT. Closed issue #1467, PR #1887.
    • SPARQL: Fixed result handling for SERVICE directive. Closed issue #1278, PR #1894.
    • Change the skolem default authority for RDFLib from http://rdlib.net/ to https://rdflib.github.io and also change other uses of http://rdlib.net/ to https://rdflib.github.io. Closed issue #1824, PR #1901.
    • Fixes handling of non-ascii characters in IRIs. Closed issue #1429, PR #1902.
    • Pass generate to NamespaceManager.compute_qname from NamespaceManager.compute_qname_strict so it raises an error in the same case as the "non-strict" version. PR #1934.
    • Log warnings when encountering ill-typed literals. PR #1944.
    • Fixed error handling in TriX serializer. PR #1945.
    • Fixed QName generation in XML serializer. PR #1951
    • Remove unnecessary hex expansion for PN_LOCAL in SPARQL parser. Closed issue #1957, PR #1959.
    • Changed the TriX parser to support both trix and TriX as root element. PR #1966.
    • Fix SPARQL CSV result serialization of blank nodes. PR #1979.
    • Added a URIRef.fragment property. PR #1991.
    • Remove superfluous newline from N-Triples output. Closed issue #1998, PR #1999.
    • Added a bunch of type hints. The following modules have nearly complete type hints now:
      • rdflib.namespace
      • rdflib.term
      • rdflib.parser
    Source code(tar.gz)
    Source code(zip)
    rdflib-6.2.0-py3-none-any.whl(488.53 KB)
    rdflib-6.2.0.tar.gz(4.53 MB)
  • 6.1.1(Dec 19, 2021)

    Better testing and tidier code.

    This is a semi-major release that:

    • add support for Python 3.10
    • updates the test suite to pytest (from nose)
    • tidies up a lot of continuous integration
    • gets more tests tested, not skipped
    • implements lots of mypy tests
    • updates several parsers and serializers
      • supports the new HexTuples format!
    • many bug fixes

    This release contains many, many hours of updates from Iwan Aucamp, so thank you Iwan!

    Source code(tar.gz)
    Source code(zip)
  • 6.0.2(Oct 10, 2021)

  • 6.0.1(Sep 17, 2021)

  • 6.0.0(Jul 20, 2021)

    6.0.0 is a major stable release that drops support for Python 2 and Python 3 < 3.7. Type hinting is now present in much of the toolkit as a result.

    It includes the formerly independent JSON-LD parser/serializer, improvements to Namespaces that allow for IDE namespace prompting, simplified use of g.serialize() (turtle default, no need to decode()) and many other updates to documentation, store backends and so on.

    Performance of the in-memory store has also improved since Python 3.6 dictionary improvements.

    There are numerous supplementary improvements to the toolkit too, such as:

    • inclusion of Docker files for easier CI/CD
    • black config files for standardised code formatting
    • improved testing with mock SPARQL stores, rather than a reliance on DBPedia etc
    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Apr 18, 2020)

    5.0.0 is a major stable release and is the last release to support Python 2 & 3.4. 5.0.0 is mostly backwards- compatible with 4.2.2 and is intended for long-term, bug fix only support.

    5.0.0 comes two weeks after the 5.0.0RC1 and includes a small number of additional bug fixes. Note that rdflib-jsonld has released a version 0.5.0 to be compatible with rdflib 5.0.0.

    There is a large list of changes since the 4.2.2 release, see the CHANGELOG for details.

    See https://rdflib.dev for the proposed future release schedule.

    Source code(tar.gz)
    Source code(zip)
  • 4.2.2(Jan 29, 2017)

    This is a bug-fix release, and the last release in the 4.X.X series.

    Bug fixes:

    • SPARQL bugs fixed:
      • Fix for filters in sub-queries #693
      • Fixed bind, initBindings and filter problems #294 #555 #580 #586 #601 #615 #617 #619 #630 #653 #686 #688 #692
      • Fixed unexpected None value in SPARQL-update #633 #634
      • Fix sparql, group by and count of null values with optional #631
      • Fixed sparql sub-query and aggregation bugs #607 #610 #628 #694
      • Fixed parsing Complex BGPs as triples #622 #623
      • Fixed DISTINCT being ignored inside aggregate functions #404 #611 #678
      • Fix unicode encoding errors in sparql processor #446 #599
      • Fixed SPARQL select nothing no longer returning a None row #554 #592
      • Fixed aggregate operators COUNT and SAMPLE to ignore unbound / NULL values #564 #563 #567 #568
      • Fix sparql relative uris #523 #524
      • SPARQL can now compare xsd:date type as well, fixes #532 #532 #533
      • fix sparql path order on python3: "TypeError: unorderable types: SequencePath() < SequencePath()"" #492 #525
      • SPARQL parser now robust to spurious semicolon #381 #528
      • Let paths be comparable against all nodes even in py3 (preparedQuery error) #545 #552
      • Made behavior of initN in update and query more consistent #579 #600
    • SparqlStore:
      • SparqlStore now closes underlying urllib response body #638 #683
      • SparqlStore injectPrefixes only modifies query if prefixes present and if adds a newline in between #521 #522
    • Fixes and tests for AuditableStore #537 #557
    • Trig bugs fixed:
      • trig export of multiple graphs assigns wrong prefixes to prefixedNames #679
      • Trig serialiser writing empty named graph name for default graph #433
      • Trig parser can creating multiple contexts for the default graph #432
      • Trig serialisation handling prefixes incorrectly #428 #699
    • Fixed Nquads parser handling of triples in default graph #535 #536
    • Fixed TypeError in Turtle serializer (unorderable types: DocumentFragment() > DocumentFragment()) #613 #648 #666 #676
    • Fixed serialization and parsing of inf/nan #655 #658
    • Fixed RDFa parser from failing on time elements with child nodes #576 #577
    • Fix double reduction of \ escapes in from_n3 #546 #548
    • Fixed handling of xsd:base64Binary #646 #674
    • Fixed Collection.setitem broken #604 #605
    • Fix ImportError when main already loaded #616
    • Fixed broken top_level.txt file in distribution #571 #572 #573

    Enhancements:

    • Added support for Python 3.5+ #526
    • More aliases for common formats (nt, turtle) #701
    • Improved RDF1.1 ntriples support #695 #700
    • Dependencies updated and improved compatibility with pyparsing, html5lib, SPARQLWrapper and elementtree #550 #589 #606 #641 #642 #650 #671 #675 #684 #696
    • Improved prefix for SPARQL namespace in XML serialization #493 #588
    • Performance improvements:
      • SPARQL Aggregation functions don't build up memory for each row #678
      • Collections now support += (iadd), fixes slow creation of large lists #609 #612 #691
      • SPARQL Optimisation to expand BGPs in a smarter way #547
    • SPARQLStore improvements
      • improved SPARQLStore BNode customizability #511 #512 #513 #603
      • Adding the option of using POST for long queries in SPARQLStore #672 #673
      • Exposed the timeout of SPARQLWrapper #531
    • SPARQL prepared query now carries the original (unparsed) parameters #565
    • added .n3 methods for path objects #553
    • Added support for xsd:gYear and xsd:gYearMonth #635 #636
    • Allow duplicates in rdf:List #223 #690
    • Improved slicing of Resource objects #529

    Cleanups:

    • cleanup: SPARQL Prologue and Query new style classes #566
    • Reduce amount of warnings, especially closing opened file pointers #518 #651
    • Improved ntriples parsing exceptions to actually tell you what's wrong #640 #643
    • remove ancient and broken 2.3 support code. #680 #681
    • Logger output improved #662
    • properly cite RGDA1 #624
    • Avoid class reference to imported function #574 #578
    • Use find_packages for package discovery. #590
    • Prepared ClosedNamespace (and _RDFNamespace) to inherit from Namespace (5.0.0) #551 #595
    • Avoid verbose build logging #534
    • (ultra petty) Remove an unused import #593

    Testing improvements:

    • updating deprecated testing syntax #697
    • make test 375 more portable (use sys.executable rather than python) #664 #668
    • Removed outdated, skipped test for #130 that depended on content from the internet #256
    • enable all warnings during travis nosetests #517
    • travis updates #659
    • travis also builds release branches #598

    Doc improvements:

    • Update list of builtin serialisers in docstring #621
    • Update reference to "Emulating container types" #575 #581 #583 #584
    • docs: clarify the use of an identifier when persisting a triplestore #654
    • DOC: unamed -> unnamed, typos #562
    Source code(tar.gz)
    Source code(zip)
  • 4.2.1(Aug 12, 2015)

    This is a bug-fix release.

    Minor enhancements:

    • Added a Networkx connector #471, #507
    • Added a graph_tool connector #473
    • Added a graphs method to the Dataset object #504, #495
    • Batch commits for SPARQLUpdateStore #486

    Bug fixes:

    • Fixed bnode collision bug #506, #496, #494
    • fix util.from_n3() parsing Literals with datatypes and Namespace support #503, #502
    • make Identifier.__hash__ stable wrt. multi processes #501, #500
    • fix handling URLInputSource without content-type #499, #498
    • no relative import in algebra when run as a script #497
    • Duplicate option in armstrong theme.conf removed #491
    • Variable.__repr__ returns a python representation string, not n3 #488
    • fixed broken example #482
    • trig output fixes #480
    • set PYTHONPATH to make rdfpipe tests use the right rdflib version #477
    • fix RDF/XML problem with unqualified use of rdf:about #470, #468
    • AuditableStore improvements #469, #463
    • added asserts for graph.set([s,p,o]) so s and p aren't None #467
    • threading.RLock instances are context managers #465
    • SPARQLStore does not transform Literal('') into Literal('None') anymore #459, #457
    • slight performance increase for graph.all_nodes() #458

    Testing improvements:

    • travis: migrate to docker container infrastructure #508
    • test for narrow python builds (chars > 0xFFFF) (related to #453, #454 ) #456, #509
    • dropped testing py3.2 #448
    • Running a local fuseki server on travis and making it failsafe #476, #475, #474, #466, #460
    • exclude def main(): functions from test coverage analysis #472
    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Feb 19, 2015)

    This is a new minor version of RDFLib including a handful of new features:

    • Supporting N-Triples 1.1 syntax using UTF-8 encoding #447, #449, #400
    • Graph comparison now really works using RGDA1 (RDF Graph Digest Algorithm 1) #441 #385
    • More graceful degradation than simple crashing for unicode chars > 0xFFFF on narrow python builds. Parsing such characters will now work, but issue a UnicodeWarning. If you run python -W all you will already see a warning on import rdflib will show a warning (ImportWarning). #453, #454
    • URLInputSource now supports json-ld #425
    • SPARQLStore is now graph aware #401, #402
    • SPARQLStore now uses SPARQLWrapper for updates #397
    • Certain logging output is immediately shown in interactive mode #414
    • Python 3.4 fully supported #418

    Minor enhancements & bugs fixed:

    • Fixed double invocation of 2to3 #437
    • PyRDFa parser missing brackets #434
    • Correctly handle \uXXXX and \UXXXXXXXX escapes in n3 files #426
    • Logging cleanups and keeping it on stderr #420 #414 #413
    • n3: allow @base URI to have a trailing '#' #407 #379
    • microdata: add file:// to base if it's a filename so rdflib can parse its own output #406 #403
    • TSV Results parse skips empty bindings in result #390
    • fixed accidental test run due to name #389
    • Bad boolean list serialization to Turtle & fixed ambiguity between Literal(False) and None #387 #382
    • Current version number & PyPI link in README.md #383
    Source code(tar.gz)
    Source code(zip)
Owner
RDFLib
RDFlib, the GitHub organization, is a volunteer-maintained collection of Python tools for working with RDF data.
RDFLib
Simple yet flexible natural sorting in Python.

natsort Simple yet flexible natural sorting in Python. Source Code: https://github.com/SethMMorton/natsort Downloads: https://pypi.org/project/natsort

Seth Morton 712 Dec 23, 2022
MoBioTools A simple yet versatile toolkit to automatically setup quantum mechanics/molecular mechanics

A simple yet versatile toolkit to setup quantum mechanical/molecular mechanical (QM/MM) calculations from molecular dynamics trajectories.

MoBioChem 17 Nov 27, 2022
A Python wrapper API for operating and working with the Neo4j Graph Data Science (GDS) library

gdsclient NOTE: This is a work in progress and many GDS features are known to be missing or not working properly. This repo hosts the sources for gdsc

Neo4j 100 Dec 20, 2022
Simple project to assist in tracking/logging my working hours

Fill working hours Basic script to assist in the logging/tracking of my working hours How it works Create a file called projects.json in this director

Robin Kennedy-Reid 2 Oct 31, 2022
Yet another Python Implementation of the Elo rating system.

Python Implementation - Elo Rating System Yet another Python Implementation of the Elo rating system (how innovative am I right?). Only supports 1vs1

Kraktoos 5 Dec 22, 2022
Yet another basic python package.

ironmelts A basic python package. Easy to use. Minimum requirements. Installing Linux python3 -m pip install -U ironmelts macOS python3 -m pip install

IRONMELTS 1 Oct 26, 2021
A simple language for new programmers and a toy language ;)

Yell An extremely simple, yet powerful language for new programmers, as well as a toy language ;) Explore the docs » Report Bug · Request Feature Yell

Yell 4 Dec 28, 2021
Yet another Airflow plugin using CLI command as RESTful api, supports Airflow v2.X.

中文版文档 Airflow Extended API Plugin Airflow Extended API, which export airflow CLI command as REST-ful API to extend the ability of airflow official API

Eric Cao 106 Nov 9, 2022
Utility functions for working with data from Nix in Python

Pynixutil - Utility functions for working with data from Nix in Python Examples Base32 encoding/decoding import pynixutil input = "v5sv61sszx301i0x6x

Tweag 11 Dec 16, 2022
Module for working with the site dnevnik.ru with python

dnevnikru Module for working with the site dnevnik.ru with python Dnevnik object accepts login and password from the dnevnik.ru account Methods: homew

Aleksandr 21 Nov 21, 2022
The first Python 1v1.lol triggerbot working with colors !

1v1.lol TriggerBot Afin d'utiliser mon triggerbot, vous devez activer le plein écran sur 1v1.lol sur votre naviguateur (quelque-soit ce dernier). Vous

Venax 5 Jul 25, 2022
Python tools for working with Orbit Ephemeris Messages (OEMs).

Python Orbit Ephemeris Message tools Python tools for working with Orbit Ephemeris Messages (OEMs). Development Status Installation The oem package is

Brad Sease 4 Apr 6, 2022
This is a working model for which I have used python.

Jarvis_voiceAssistance This is a working model for which I have used python. This model can: 1)Play a video or song on youtube. 2)Tell us time. 3)Tell

Hardik Jain 1 Jan 30, 2022
Ikaros is a free financial library built in pure python that can be used to get information for single stocks, generate signals and build prortfolios

Ikaros is a free financial library built in pure python that can be used to get information for single stocks, generate signals and build prortfolios

Salma Saidane 64 Sep 28, 2022
Python library for datamining glitch information from Gen 1 Pokémon GameBoy ROMs

g1utils This is a Python library for datamining information about various glitches (glitch Pokémon, glitch maps, etc.) from Gen 1 Pokémon ROMs. TODO A

null 1 Jan 13, 2022
Open source tools to allow working with ESP devices in the browser

ESP Web Tools Allow flashing ESPHome or other ESP-based firmwares via the browser. Will automatically detect the board type and select a supported fir

ESPHome 195 Dec 31, 2022
Wisdom Tree is a concentration app i am working on.

Wisdom Tree Wisdom Tree is a tui concentration app I am working on. Inspired by the wisdom tree in Plants vs. Zombies which gives in-game tips when it

NO ONE 241 Jan 1, 2023
Team Curie is a group of people working together to achieve a common aim

Team Curie is a group of people working together to achieve a common aim. We are enthusiasts!.... We are setting the pace!.... We offer encouragement and motivation....And we believe TeamWork makes the DreamWork.

null 4 Aug 7, 2021
A basic layout of atm working of my local database

Software for working Banking service ?? This project was developed for Banking service. mysql server is required To have mysql server on your system u

satya 1 Oct 21, 2021