You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing data into a ConjunctiveGraph or Dataset, the triples in the
default graphs in the sources were loaded into a graph named publicID.
This behaviour has been changed, and now the triples from the default graph in
source RDF documents will be loaded into ConjunctiveGraph.default_context or
Dataset.default_context.
The publicID parameter to ConjunctiveGraph.parse and Dataset.parse
constructors will now only be used as the base URI for relative URI resolution.
Python 3.7 will be end-of-life on the 27th of June 2023 and the next release of
RDFLib will be a new major version.
This changes the minimum supported version of Python to 3.8.1 as some of the
dependencies we use are not too fond of python 3.8.0. This change also removes
all accommodations for older python versions.
GROUP_CONCAT was handling an empty separator (i.e. "") incorrectly,
it would handle it as if the separator were not set, so essentially it was
treated as a single space (i.e. " ").
This change fixes it so that an empty separator with GROUP_CONCAT
results in a value with nothing between concatenated values.
Replace bare except: with except Exception, there are some cases where it
can be narrowed further, but this is already an improvement over the current
situation.
This is somewhat pursuant to eliminating
flakeheaven, as it no longer
supports the latest version of flake8
[ref]. But it also is
just the right thing to do as bare exceptions can cause problems.
fix: eliminate file intermediary in translate algebra (#2267)
Previously, rdflib.plugins.sparql.algebra.translateAlgebra() maintained state via a file, with a fixed filename query.txt. With this change, use of that file is eliminated; state is now maintained in memory so that multiple concurrent translateAlgebra() calls, for example, should no longer interfere with each other.
The change is accomplished with no change to the client interface. Basically, the actual functionality has been moved into a class, which is instantiated and used as needed (once per call to algrebra.translateAlgebra()).
fix: eliminate some mutable default arguments in SPARQL code (#2301)
This change eliminates some situations where a mutable object (i.e., a dictionary) was used as the default value for functions in the rdflib.plugins.sparql.processor module and related code. It replaces these situations with typing.Optinal that defaults to None, and is then handled within the function. Luckily, some of the code that the SPARQL Processor relied on already had this style, meaning not a lot of changes had to be made.
This change also makes a small update to the logic in the SPARQL Processor's query function to simplify the if/else statement. This better mirrors the implementation in the UpdateProcessor.
Previously, without html5lib installed, literals withrdf:HTML
datatypes were treated as
ill-typed,
even if they were not ill-typed.
With this change, if html5lib is not installed, literals with the
rdf:HTML datatype will not be treated as ill-typed, and will have
Null as their ill_typed attribute value, which means that it is
unknown whether they are ill-typed or not.
This change also fixes the mapping from rdf:HTML literal values to
lexical forms.
Other changes:
Add tests for rdflib.NORMALIZE_LITERALS to ensure it behaves
correctly.
Change the handling of HTTP status code 308 to behave more like
urllib.request.HTTPRedirectHandler, most critically, the new 308 handling will
create a new urllib.request.Request object with the new URL, which will
prevent state from being carried over from the original request.
One case where this is important is when the domain name changes, for example,
when the original URL is http://www.w3.org/ns/adms.ttl and the redirect URL is
https://uri.semic.eu/w3c/ns/adms.ttl. With the previous behaviour, the redirect
would contain a Host header with the value www.w3.org instead of
uri.semic.eu because the Host header is placed in
Request.unredirected_hdrs and takes precedence over the Host header in
Request.headers.
Other changes:
Only handle HTTP status code 308 on Python versions before 3.11 as Python 3.11
Move code which uses http://www.w3.org/ns/adms.ttl and
http://www.w3.org/ns/adms.rdf out of test_guess_format_for_parse into a
separate parameterized test, which instead uses the embedded http server.
This allows the test to fully control the Content-Type header in the
response instead of relying on the value that the server is sending.
This is needed because the server is sending Content-Type: text/plain for
the adms.ttl file, which is not a valid RDF format, and the test is
expecting Content-Type: text/turtle.
Use strict mode when parsing rdf:HTML literals. This ensures that when
lexical-to-value
mapping
(i.e. parsing) of a literal with rdf:HTML data type occurs, a value will
only be assigned if the lexical form is a valid HTML5 fragment.
Otherwise, i.e. for invalid fragments, no value will be associated with
the literal
[ref] and
the literal will be ill-typed.
fix: TriG handling of GRAPH keyword without a graph ID (#2469)
Fix various typing errors that are reported when running with dmypy,
the mypy daemon.
Also add a task for running dmypy to the Taskfile that can be selected
as the default mypy variant by setting the MYPY_VARIANT environment
variable to dmypy.
fix: widen Graph.__contains__ type-hints to accept Path values (#2323)
Change the type-hints for Graph.__contains__ to also accept Path
values as the parameter is passed to the Graph.triples function,
which accepts Path values.
docs: fix comment that doesn't describe behavior (#2443)
Comment refers to a person that knows bob and the code would return a name,
but this would only work if the triple person foaf:name bob . is part of the dataset
As this is a very uncommon way to model a foaf:knows the code was
adjusted to match the description.
docs: fix typo in security considerations documentation
Suggest that contributors first make an issue to get in principle
agreement for pull requests before making the pull request.
Enhancements can be controversial, and we may reject the enhancement
sometimes, even if the code is good, as it may just not be deemed
important enough to increase the maintenance burden of RDFLib.
Other changes:
Updated the checklist in the pull request template to be more accurate to
current practice.
Improved grammar and writing in the pull request template, contribution guide
and developers guide.
docs: remove unicode string form in rdflib/term.py (#2384)
The use of Unicode literals is an artefact of Python 2 and is incorrect in Python 3.
Doctests for docstrings using Unicode literals only pass because ALLOW_UNICODE
is set, but this option should be disabled as RDFLib does not support Python 2 any more.
Add optional keyword only target_graph argument to rdflib.graph.Graph.cbd and use this new argument in evalDescribeQuery.
This makes it possible to compute a concise bounded description without creating a new graph to hold the result, and also without potentially having to copy it to another final graph.