Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: LODE - Live OWL Documentation Environment
message: >-
New reengineered version of LODE, maintained by
OpenCitations.
type: software
authors:
- given-names: Valentina
family-names: Pasqual
email: valentina.pasqual2@unibo.it
orcid: 'https://orcid.org/0000-0001-5931-5187'
affiliation: >-
Digital Humanities Advanced Research Centre (/DH.arc),
Department of Classical Philology and Italian Studies,
University of Bologna, Bologna, Italy
- given-names: Silvio
family-names: Peroni
email: silvio.peroni@unibo.it
affiliation: >-
Research Centre for Open Scholarly Metadata,
Department of Classical Philology and Italian Studies,
University of Bologna, Bologna, Italy
orcid: 'https://orcid.org/0000-0003-0530-4305'
- given-names: Ahmadreza
family-names: Nazari
orcid: 'https://orcid.org/0009-0000-3884-1575'
email: ahmadreza.nazari@studio.unibo.it
affiliation: >-
Digital Humanities and Digital Knowledge, Department
of Classical Philology and Italian Studies, University
of Bologna, Bologna, Italy
repository-code: 'https://github.com/opencitations/lode'
url: 'https://lode.opencitations.net/'
abstract: >-
LODE is a re-engineered and extensible framework for generating human-readable documentation of semantic artefacts. It preserves the established single-page, W3C Recommendation-style documentation paradigm of its legacy verision, while introducing a modular architecture that decouples artefact interpretation, internal representation, and rendering. This design enables the framework to support multiple semantic artefact types through configurable interpretation modules. The current implementation supports OWL ontology documentation.
keywords:
- Ontology documentation
- OWL ontologies
- Semantic artefacts documentation
- Web tool
license: ISC
19 changes: 12 additions & 7 deletions lode/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,25 @@ def _hold(m):
out = out.replace(f"\x00MD{i}\x00", block)
return out


def _nav_qs(read_as: str, url, upload_id, lang) -> str:
def _nav_qs(read_as: str, url, upload_id, lang, imported, closure) -> str:
p = {"read_as": read_as, "lang": lang or ""}
p["upload_id" if upload_id else "url"] = upload_id or (url or "")
if imported:
p["imported"] = "true"
if closure:
p["closure"] = "true"
return urlencode(p)


def _render_view(request, reader, *, resource, lang, source_url, upload_id, read_as):
def _render_view(request, reader, *, resource, lang, source_url, upload_id, read_as,
imported=None, closure=None):
viewer = reader.get_viewer()
data = viewer.get_view_data(resource_uri=resource, language=lang)
data["warnings"] = reader.get_warnings()
resp = templates.TemplateResponse("viewer.html", {
"request": request,
"source_url": source_url,
"upload_id": upload_id,
"nav_qs": _nav_qs(read_as, source_url, upload_id, lang),
"nav_qs": _nav_qs(read_as, source_url, upload_id, lang, imported, closure),
**data,
})
resp.body = _minify(resp.body.decode("utf-8")).encode("utf-8")
Expand Down Expand Up @@ -491,7 +494,8 @@ def extract_get(

logger.info("=== REQUEST SUCCESS ===")
return _render_view(request, reader, resource=resource, lang=lang,
source_url=url, upload_id=upload_id, read_as=read_as.value)
source_url=url, upload_id=upload_id, read_as=read_as.value,
imported=imported, closure=closure)


@app.post("/extract", response_class=HTMLResponse)
Expand Down Expand Up @@ -520,7 +524,8 @@ async def extract_post(
imported=imported, closure=closure, warnings=warnings,
)
return _render_view(request, reader, resource=resource, lang=lang,
source_url=None, upload_id=token, read_as=read_as.value)
source_url=None, upload_id=token, read_as=read_as.value,
imported=imported, closure=closure)


# ==========================================================================
Expand Down
6 changes: 3 additions & 3 deletions lode/templates/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h1 class="resource-title">
<div class="p-3">
{% else %}
<div>
<div class="p-3">
<div>
<div class="resource-frontmatter">
<h1 class="resource-title">
{% if metadata.title %}
Expand Down Expand Up @@ -178,8 +178,8 @@ <h1 class="resource-title">
{% if single_resource %}</details>{% else %}</div>{% endif %}

<!-- ===== BLOCCO 2: EXPORT — SEMPRE VISIBILE, FUORI DAL DROPDOWN ===== -->
<section class="metadata-block export-block pb-2">
<dl class="mb-0">
<section class="metadata-block export-block">
<dl class="mb-0 pb-3">
{% if source_url or upload_id or export_base %}
{% set _res = request.query_params.get('resource', '') %}
<dt class="fs-7 fw-bold mb-1">Export {% if _res %}entity{% endif %}</dt>
Expand Down
7 changes: 6 additions & 1 deletion lode/viewer/base_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,13 @@ def _find_and_format_metadata(self, all_instances: List[Resource], language=None
# 9. Statements
data.update(self._format_statement(all_instances, ontology_model, language))

# Ordine alfabetico su tutti i metadati (uri/label in testa)
pinned = ['uri', 'label']
rest = sorted(k for k in data if k not in pinned)
data = {k: data[k] for k in pinned if k in data} | {k: data[k] for k in rest}

return data

def _resolve_chain_value(self, chain, language=None) -> dict:
"""Renderizza una property chain ordinata (lista di Relation) come un
unico valore con parti cliccabili unite dall'operatore di composizione."""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "lode"
version = "0.3.9"
version = "0.3.10"
description = "New reengineered version of LODE, maintained by OpenCitations"
authors = [{name = "Valentina Pasqual, Silvio Peroni", email = "valentina.pasqual2@unibo.it"}]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading