From 93687fb813adb5e8657a67c3a0a0a2aa524144d4 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Tue, 30 Dec 2025 17:46:26 +0400 Subject: [PATCH 1/3] Special header for PROV --- yaml_ld/document_loaders/content_types.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yaml_ld/document_loaders/content_types.py b/yaml_ld/document_loaders/content_types.py index 826eb49..c914404 100644 --- a/yaml_ld/document_loaders/content_types.py +++ b/yaml_ld/document_loaders/content_types.py @@ -50,6 +50,11 @@ def construct_accept_header(url: URI) -> str: # support content type weights. It will return the text/html version. return 'application/ld+json' + if url.startswith('http://www.w3.org/ns/prov'): + # Content negotiation will not work correctly because w3.org does not + # handle weights for this namespace and returns the HTML variant. + return 'text/turtle' + return DEFAULT_ACCEPT_HEADER From f1df9040af85da38c45058ec0a4c085d1874d731 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Tue, 30 Dec 2025 17:46:32 +0400 Subject: [PATCH 2/3] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b3ffcae..f2ecede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "yaml-ld" -version = "1.1.15" +version = "1.1.16" description = "YAML-LD for Python" authors = ["Anatoly Scherbakov "] license = "MIT" From f4b5e532e02dc6b349e8e46e245d5e6a0e892d26 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Tue, 30 Dec 2025 17:52:56 +0400 Subject: [PATCH 3/3] =?UTF-8?q?Make=20linters=20=F0=9F=9F=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yaml_ld/document_loaders/content_types.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/yaml_ld/document_loaders/content_types.py b/yaml_ld/document_loaders/content_types.py index c914404..32dced8 100644 --- a/yaml_ld/document_loaders/content_types.py +++ b/yaml_ld/document_loaders/content_types.py @@ -15,8 +15,10 @@ # - I've copied it over from pyld; # - It is hard-coded, I think I should handle it dynamically depending on # whatever parsers are available. +APPLICATION_LD_JSON = 'application/ld+json' + DEFAULT_ACCEPT_HEADER = ', '.join([ - 'application/ld+json', + APPLICATION_LD_JSON, 'application/rdf+xml;q=0.8', 'application/json;q=0.5', 'text/html;q=0.8', @@ -48,7 +50,7 @@ def construct_accept_header(url: URI) -> str: if url.startswith('https://w3id.org/fair/fip/terms/'): # Content negotiation will not work correctly because w3id does not # support content type weights. It will return the text/html version. - return 'application/ld+json' + return APPLICATION_LD_JSON if url.startswith('http://www.w3.org/ns/prov'): # Content negotiation will not work correctly because w3.org does not @@ -66,9 +68,9 @@ def by_extension(extension: str) -> str | None: """ return { '.json': 'application/json', - '.jsonld': 'application/ld+json', - '.jldt': 'application/ld+json', - '.jldte': 'application/ld+json', + '.jsonld': APPLICATION_LD_JSON, + '.jldt': APPLICATION_LD_JSON, + '.jldte': APPLICATION_LD_JSON, '.yaml': 'application/yaml', '.yamlld': 'application/ld+yaml', '.html': 'text/html', @@ -94,7 +96,7 @@ def parser_by_content_type_map(): return { 'application/json': YAMLDocumentParser, - 'application/ld+json': YAMLDocumentParser, + APPLICATION_LD_JSON: YAMLDocumentParser, 'application/yaml': YAMLDocumentParser, 'application/x-yaml': YAMLDocumentParser, 'application/ld+yaml': YAMLDocumentParser,