Spaces:
Build error
Build error
Download tapshex/template.py from dcmi/dctap2shex: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/dcmi/dctap2shex/resolve/main/tapshex/template.py
- Command line
-
hf download hf://spaces/dcmi/dctap2shex/tapshex/template.py
-
curl -L -o template.py https://huggingface.co/spaces/dcmi/dctap2shex/resolve/main/tapshex/template.py
1.99 kB
| """Jinja template.""" | |
| SHEX_JINJA = """ | |
| {%- for prefix, uri in namespaces.items() %} | |
| PREFIX {{prefix}} <{{uri}}> | |
| {%- endfor %} | |
| {%- for shape in shapes %} | |
| {{shape.shapeID}}{{" "}} | |
| {%- if shape.closed == 'True' -%} | |
| {{"CLOSED"}} | |
| {%- elif shape.extra is defined -%} | |
| {{"EXTRA "}}{{shape.extra}} | |
| {%- endif -%} | |
| {{" {"}} | |
| {%- for statement in shape.statement_templates %} | |
| {{statement.propertyID}} | |
| {%- if statement._dot %} {{" . "}} {% endif -%} | |
| {%- if statement.valueNodeType %} {{statement.valueNodeType|upper}}{% endif -%} | |
| {%- if statement.valueDataType %} {{statement.valueDataType}}{% endif -%} | |
| {%- if statement.valueShape %} @{{statement.valueShape}}{% endif -%} | |
| {%- if statement.valueConstraint is defined -%} | |
| {%- if not statement.valueConstraintType is defined -%} | |
| {{" "}}[{{ statement.valueConstraint }}] | |
| {%- elif statement.valueConstraintType == 'picklist_quoted' -%} | |
| {{" "}}[{{ statement.valueConstraint | map('tojson') | join(" ") }}] | |
| {%- elif statement.valueConstraintType == "picklist" -%} | |
| {{" "}}[{{ statement.valueConstraint | join(" ") }}] | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- if statement.minoccurs is defined %} { {{- statement.minoccurs -}} | |
| {%- if statement.maxoccurs is not defined -%} | |
| ,} | |
| {%- elif statement.maxoccurs|int == -1 -%} | |
| ,} | |
| {%- else -%} | |
| ,{{statement.maxoccurs}}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- if statement.mininclusive %} MinInclusive {{statement.mininclusive}} {%- endif -%} | |
| {%- if statement.maxinclusive %} MaxInclusive {{statement.maxinclusive}} {%- endif -%} | |
| {%- if not loop.last -%} ;{%- endif -%} | |
| {%- endfor %} | |
| } | |
| {%- endfor %} | |
| """ | |
| # {%- elif statement.valueDataType == 'xsd:integer' or statement.valueDataType == "http://www.w3.org/2001/XMLSchema#integer " -%} | |
| # {{" "}}[{{ statement.valueConstraint | join(" ") }}] | |