From 80257d752e31468a472c0c73ae8273d36f823e2d Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 9 Oct 2023 13:23:09 +0200 Subject: [PATCH] rml: fix content negotiation URL --- w3id/generate-w3id.py | 7 ++++--- w3id/redirections.htaccess | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/w3id/generate-w3id.py b/w3id/generate-w3id.py index b4ebc4e..1c7e9c0 100755 --- a/w3id/generate-w3id.py +++ b/w3id/generate-w3id.py @@ -61,7 +61,8 @@ def extract_spec(url: str): def template_resources(resources: List[str], spec: str): return \ 'RewriteCond %{REQUEST_URI} (' + '|'.join(resources) + ')$\n' \ - 'RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1.' + spec + '.conneg [NE,R,L]\n' + 'RewriteRule ^(.*)$ https://%{SERVER_NAME}/rml/$1.' + spec + '.conneg [NE,R,L]\n' + def template_ontology(spec: str): return \ @@ -110,11 +111,11 @@ def template_redirect(resource: str, url: str): def template_redirect_negotiate(resource: str, name: str, root: bool): if root: return \ - 'RewriteRule ^$ https://%{SERVER_NAME}/' + name + '.resource.conneg [NE,R,L]\n' + 'RewriteRule ^$ https://%{SERVER_NAME}/rml/' + name + '.resource.conneg [NE,R,L]\n' else: return \ 'RewriteCond %{REQUEST_URI} ' + resource + '$\n' \ - 'RewriteRule (.*)$ https://%{SERVER_NAME}/' + name + '.resource.conneg [NE,R,L]\n' + 'RewriteRule (.*)$ https://%{SERVER_NAME}/rml/' + name + '.resource.conneg [NE,R,L]\n' def read_csv(): diff --git a/w3id/redirections.htaccess b/w3id/redirections.htaccess index bd33632..7f3c2e3 100644 --- a/w3id/redirections.htaccess +++ b/w3id/redirections.htaccess @@ -36,7 +36,7 @@ RewriteRule cc/spec/?$ https://kg-construct.github.io/rml-cc/spec/docs [NE,R,L] RewriteCond %{REQUEST_URI} cc/shapes RewriteRule cc/shapes/?$ https://kg-construct.github.io/rml-cc/shapes/cc.ttl [NE,R,L] RewriteCond %{REQUEST_URI} (gatherAs|allowEmptyListAndContainer|gather|GatherMap|append|cartessianProduct)$ -RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1.cc.conneg [NE,R,L] +RewriteRule ^(.*)$ https://%{SERVER_NAME}/rml/$1.cc.conneg [NE,R,L] # === RML core === @@ -49,7 +49,7 @@ RewriteRule core/shapes/?$ https://kg-construct.github.io/rml-core/shapes/core.t RewriteCond %{REQUEST_URI} core/bc RewriteRule core/bc/?$ https://kg-construct.github.io/rml-core/ontology/rml-core-bc.ttl [NE,R,L] RewriteCond %{REQUEST_URI} (logicalSource|logicalTarget|subject|subjectMap|predicateObjectMap|graph|graphMap|class|predicate|predicateMap|object|objectMap|parentTriplesMap|joinCondition|parentMap|parent|childMap|child|datatype|datatypeMap|language|languageMap|termType|template|reference|constant|strategy|TriplesMap|SubjectMap|PredicateObjectMap|PredicateMap|ObjectMap|RefObjectMap|Join|LanguageMap|GraphMap|Strategy|DatatypeMap|ParentMap|ChildMap|TermMap|ExpressionMap|IRI|Literal|BlankNode)$ -RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1.core.conneg [NE,R,L] +RewriteRule ^(.*)$ https://%{SERVER_NAME}/rml/$1.core.conneg [NE,R,L] # === RML eval17 === @@ -64,7 +64,7 @@ RewriteRule fnml/spec/?$ https://kg-construct.github.io/rml-fnml/spec/docs [NE,R RewriteCond %{REQUEST_URI} fnml/shapes RewriteRule fnml/shapes/?$ https://kg-construct.github.io/rml-fnml/shapes/fnml.ttl [NE,R,L] RewriteCond %{REQUEST_URI} (returnMap|functionExecution|input|functionMap|parameterMap|function|parameter|return|inputValueMap|inputValue|ReturnMap|FunctionExecution|Input|ParameterMap|FunctionMap)$ -RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1.fnml.conneg [NE,R,L] +RewriteRule ^(.*)$ https://%{SERVER_NAME}/rml/$1.fnml.conneg [NE,R,L] # === RML io === @@ -77,19 +77,19 @@ RewriteRule io/shapes/?$ https://kg-construct.github.io/rml-io/shapes/io.ttl [NE RewriteCond %{REQUEST_URI} io/bc RewriteRule io/bc/?$ https://kg-construct.github.io/rml-io/ontology/rml-io-bc.ttl [NE,R,L] RewriteCond %{REQUEST_URI} (source|target|encoding|compression|serialization|null|referenceFormulation|iterator|namespacePrefix|namespaceURL|namespace|LogicalSource|LogicalTarget|ReferenceFormulation|Source|Target|Namespace|Encoding|Compression|JSONPath|XPath|XPathReferenceFormulation|CSV|SQL2008Table|SQL2008Query|UTF-8|UTF-16|none|gzip|zip|tarxz|targzip)$ -RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1.io.conneg [NE,R,L] +RewriteRule ^(.*)$ https://%{SERVER_NAME}/rml/$1.io.conneg [NE,R,L] # === RML resources === -RewriteRule ^$ https://%{SERVER_NAME}/ontology.resource.conneg [NE,R,L] +RewriteRule ^$ https://%{SERVER_NAME}/rml/ontology.resource.conneg [NE,R,L] RewriteCond %{REQUEST_URI} bc$ -RewriteRule (.*)$ https://%{SERVER_NAME}/backwards-compatibility.resource.conneg [NE,R,L] +RewriteRule (.*)$ https://%{SERVER_NAME}/rml/backwards-compatibility.resource.conneg [NE,R,L] RewriteRule portal/?(.*)/?$ https://kg-construct.github.io/rml-resources/portal/$1 [NE,L,R=301] RewriteCond %{REQUEST_URI} shapes$ -RewriteRule (.*)$ https://%{SERVER_NAME}/shapes.resource.conneg [NE,R,L] +RewriteRule (.*)$ https://%{SERVER_NAME}/rml/shapes.resource.conneg [NE,R,L] RewriteRule resources/?(.*)/?$ https://kg-construct.github.io/rml-resources/resources/$1 [NE,L,R=301] @@ -102,7 +102,7 @@ RewriteRule star/spec/?$ https://kg-construct.github.io/rml-star/spec/docs [NE,R RewriteCond %{REQUEST_URI} star/shapes RewriteRule star/shapes/?$ https://kg-construct.github.io/rml-star/shapes/star.ttl [NE,R,L] RewriteCond %{REQUEST_URI} (quotedTriplesMap|StarMap|AssertedTriplesMap|NonAssertedTriplesMap)$ -RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1.star.conneg [NE,R,L] +RewriteRule ^(.*)$ https://%{SERVER_NAME}/rml/$1.star.conneg [NE,R,L] RewriteRule ^(.*)$ https://kg-construct.github.io/rml-resources/404.html [NE,L,R=404]