Skip to content

Commit

Permalink
rml: fix content negotiation URL
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVanAssche committed Oct 9, 2023
1 parent 8880dd7 commit 80257d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
7 changes: 4 additions & 3 deletions w3id/generate-w3id.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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():
Expand Down
16 changes: 8 additions & 8 deletions w3id/redirections.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===
Expand All @@ -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 ===
Expand All @@ -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 ===
Expand All @@ -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]

Expand All @@ -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]

0 comments on commit 80257d7

Please sign in to comment.