Skip to content

Commit aa56cdd

Browse files
committed
feat: add annotation support for markdown blocks (oeo, sms, fmi, dogont, brick, s4grid, sargon, s4ener, bont, openadr, dices) and update footer links
Usage: Wrap content with <!-- BEGIN-ANNOTATION: ontology_id --> ... <!-- END-ANNOTATION: ontology_id --> Example: <!-- BEGIN-ANNOTATION: oeo -->Energy is the ability to do work.<!-- END-ANNOTATION: oeo -->
1 parent b14c76f commit aa56cdd

File tree

10 files changed

+234
-19
lines changed

10 files changed

+234
-19
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
venv/
2-
site/
2+
site/
3+
__pycache__/

docs/footer/contact.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# You can reach us here
2+
3+
## Address
4+
National Research Data Infrastructure (NFDI) eV
5+
NFDI Directorate
6+
Albert-Nestler-Straße 13 | 76131 Karlsruhe
7+
8+
## Telephone number
9+
+49 721 988 994 0
10+
11+
## Fax
12+
+49 721 988 994 29
13+
14+
## E-mail
15+
info[at]nfdi.de

docs/footer/legal/imprint.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Imprint and Data Privacy statement
2+
3+
## Imprint
4+
5+
This website presents the work of the project NFDI4Energy. The partners of the NFDI4Energy consortium are funded by the [German Research Foundation (DFG)](https://www.dfg.de/de/foerderung/foerderinitiativen/nfdi) as part of the [Bund-Länder-Agreement on the Establishment and Promotion of the National Research Data Infrastructure (NFDI)](https://www.gwk-bonn.de/themen/weitere-arbeitsgebiete/informationsinfrastrukturen-nfdi) of 26 November 2018 (project number [501865131](https://gepris.dfg.de/gepris/projekt/501865131?language=de)). To coordinate the activities, the partners of NFDI4Energy participate as members of the Association [Nationale Forschungsdateninfrastruktur (NFDI) e. V.](https://www.nfdi.de/) and participate in the various organs and structures of the association in accordance with its statutes.
6+
7+
Responsible within the meaning of § 18 para. 2 MStV:
8+
9+
Prof. Dr.-Ing. Astrid Nieße
10+
Carl von Ossietzky Universität Oldenburg
11+
Faculty II of Computing Science, Business Administration, Economics and Law
12+
Department of Computer Science
13+
Group of Digitalized Energy Systems
14+
15+
Ammerländer Heerstraße 114 - 118
16+
DE - 26129 Oldenburg
17+
18+
Mail: [info@nfdi4energy.org](mailto:info@nfdi4energy.org)
19+
20+
For further information:
21+
[https://uol.de/en/imprint](https://uol.de/en/imprint)
22+
23+
## Data privacy
24+
25+
Data protection law
26+
The European Data Protection Regulation (DSGVO) and the Lower Saxony Data Protection Act (NDSG) as well as the Federal Data Protection Act (BDSG) contain regulations on the processing of personal data.
27+
28+
Right to one's own image
29+
The Art Copyright Act (KunstUrhG) contains the provisions on the right to one's own image. With a few specific exceptions (pictures of public meetings, persons of contemporary history or pictures in which the persons are only accessories), the person's consent is required before publication.
30+
31+
Copyright
32+
The Copyright Act (UrhG) regulates the protection of texts, images, audio and video content (so-called works). In most cases, publication or distribution of such works is only permitted with the consent of the respective rights holder.
33+
34+
For further information:
35+
[https://uol.de/en/data-privacy-statement](https://uol.de/en/data-privacy-statement)

docs/footer/partners/consortium.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Consortium in the NFDI e.V.
2+
3+
The consortium NFDI4Energy is part of the [NFDI e.V.](https://www.nfdi.de/association/?lang=en). Within the NFDI e.V. it consists of the following members:
4+
5+
## Members
6+
7+
| Institution | Representative | Location |
8+
|-------------|---------------|----------|
9+
| [Albert-Ludwigs-Universität Freiburg](https://www.uni-freiburg.de/) | [Prof. Dr. Anke Weidlich](https://www.inatech.de/anke-weidlich) | Freiburg |
10+
| [Carl von Ossietzky Universität Oldenburg](https://uol.de/) | [Prof. Dr. Astrid Nieße (Spokesperson)](https://uol.de/en/des/team/astrid-niesse) | Oldenburg |
11+
| [DLR e.V.](https://www.dlr.de/de) | Carsten Hoyer-Klick | Köln |
12+
| [Forschungszentrum Jülich GmbH](https://www.fz-juelich.de/de) | [Dr. Patrick Kuckertz](https://www.fz-juelich.de/profile/kuckertz_p) | Jülich |
13+
| [Fortiss](https://www.fortiss.org/) | Dr. Markus Duchon | München |
14+
| [Fraunhofer Society](https://www.fraunhofer.de/en.html) | Nikolaus Wirtz | München |
15+
| [Friedrich-Alexander-Universität Erlangen-Nürnberg](https://www.fau.eu/) | [Prof. Dr. Reinhard German](https://www.cs7.tf.fau.eu/person/german/) | Erlangen-Nürnberg |
16+
| [Institut für Angewandte Informatik (InfAI) e.V.](https://infai.org/) | [Dr.-Ing. Sebastian Hellmann](https://infai.org/kompetenzzentren/) | Leipzig |
17+
| [Karlsruher Institut für Technologie](https://www.kit.edu/english/) | [Prof. Dr. Christof Weinhardt](https://im.iism.kit.edu/english/team_111.php) | Karlsruhe |
18+
| [Leibinz Universität Hannover](https://www.fz-juelich.de/de) | [Dr.-Ing. Volker Schöber](https://www.epv.uni-hannover.de/de/personensuche/detailansicht-zur-person/person/dr-ing-volker-schober) | Hannover |
19+
| [OFFIS e.V.](https://www.offis.de/en/) | [Prof. Dr. Sebastian Lehnhoff (Co-Spokesperson)](https://www.offis.de/en/offis/person/sebastian-lehnhoff.html) | Oldenburg |
20+
| [Reiner Lemoine Institut gGmbH](https://reiner-lemoine-institut.de/en/) | [Dipl.-Ing. Mascha Richter](https://reiner-lemoine-institut.de/person/mascha-richter/) | Berlin |
21+
| [RWTH Aachen University](https://www.rwth-aachen.de/en/) | [Prof. Antonello Monti, Ph.D.](https://www.acs.eonerc.rwth-aachen.de/cms/E-ON-ERC-ACS/Das-Institut/Mitarbeiter/Lehrstuhl-Leitung/~fcmz/Monti-Antonello/?allou=1&lidx=1) | Aachen |
22+
| [Soziologisches Forschungsinstitut Göttingen (SOFI) e.V.](https://www.uni-goettingen.de/en/) | [Dr. Franziska Hoffart](http://www.sofi.uni-goettingen.de/nc/de/personen/detail/name/franziska-m-hoffart/) | Göttingen |
23+
| [Technische Informationsbibliothek](https://www.tib.eu/en/) | [Prof. Dr. Sören Auer](https://www.tib.eu/en/research-development/research-groups-and-labs/data-science-digital-libraries/staff/soeren-auer) | Hannover |
24+
| [TU Braunschweig](https://www.tu-braunschweig.de/) | [Dr. rer. nat Peter Michalowski](https://www.tu-braunschweig.de/ipat/institut-1/team/dr-rer-nat-peter-michalowski) | Braunschweig |
25+
| [Universität Bremen](https://www.uni-bremen.de/) | [Dr. Torben Stührmann](https://www.uni-bremen.de/res/team/dr-torben-stuehrmann) | Bremen |
26+
| [Universität Osnabrück](https://www.uni-osnabrueck.de/startseite/) | [Prof. Dr. Till Mossakowski](https://www.lili.uni-osnabrueck.de/institut_fuer_germanistik/lehre/lehrende/mitarbeiterdetails.html?module=TemplatePersondetails&target=18044&source=16087&config_id=048a134a20a6923c450191af9867826c&range_id=825b6af79a277e4749559e88541383e8&username=tmossakowski) | Osnabrück |
27+
| [Öko-Institut e.V.](https://www.oeko.de/) | [Dr. Hannah Förster](https://www.oeko.de/das-institut/team/team-detail/hannah-foerster/) | Freiburg |
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Funded Consortium
2+
3+
The consortium NFDI4Energy is funded by the [DFG](https://www.dfg.de/en/research-funding/funding-initiative/nfdi) with the following applicants and participants:
4+
5+
## Applicant Institution
6+
7+
| Spokesperson | University | Location |
8+
|-----------------|------------|----------|
9+
| [Prof. Dr. Astrid Nieße](https://uol.de/en/des/team/astrid-niesse) | [Carl von Ossietzky Universität Oldenburg](https://uol.de/) | Oldenburg |
10+
11+
## Co-Applicant Institutions
12+
13+
| Co-Spokesperson | University | Location |
14+
|-----------------|------------|----------|
15+
| [Prof. Dr. Anke Weidlich](https://www.inatech.de/anke-weidlich) | [Albert-Ludwigs-Universität Freiburg](https://www.uni-freiburg.de/) | Freiburg |
16+
| [Prof. Dr. Reinhard German](https://www.cs7.tf.fau.eu/person/german/)<br>[Prof. Dr. Johan Lilliestam](https://www.rifs-potsdam.de/en/people/johan-lilliestam) | [Friedrich-Alexander-Universität Erlangen-Nürnberg](https://www.fau.eu/) | Erlangen-Nürnberg |
17+
| [Prof. Dr. Christof Weinhardt](https://im.iism.kit.edu/english/team_111.php)<br>[Prof. Dr. Veit Hagenmeyer](https://www.iai.kit.edu/english/921_1213.php) | [Karlsruher Institut für Technologie](https://www.kit.edu/english/) | Karlsruhe |
18+
| [Prof. Dr. Sebastian Lehnhoff](https://www.offis.de/en/offis/person/sebastian-lehnhoff.html) | [OFFIS e.V.](https://www.offis.de/en/) | Oldenburg |
19+
| [Prof. Antonello Monti, Ph.D.](https://www.acs.eonerc.rwth-aachen.de/cms/E-ON-ERC-ACS/Das-Institut/Mitarbeiter/Lehrstuhl-Leitung/~fcmz/Monti-Antonello/?allou=1&lidx=1) | [RWTH Aachen University](https://www.rwth-aachen.de/en/) | Aachen |
20+
| [Prof. Dr. Berthold Vogel](https://sofi.uni-goettingen.de/nc/personen/detail/name/berthold-vogel/) | [Soziologisches Forschungsinstitut Göttingen (SOFI) e.V.](https://www.uni-goettingen.de/en/) | Göttingen |
21+
| [Prof. Dr. Sören Auer](https://www.tib.eu/en/research-development/research-groups-and-labs/data-science-digital-libraries/staff/soeren-auer) | [Technische Informationsbibliothek](https://www.tib.eu/en/) | Hannover |
22+
23+
## Participants
24+
25+
| Representative | University | Location |
26+
|-----------------|------------|----------|
27+
| [Dipl.-Ing. Mascha Richter](https://reiner-lemoine-institut.de/ueber-uns/team/mascha-richter/) | [Reiner Lemoine Institut gGmbH](https://reiner-lemoine-institut.de/en/) | Berlin |
28+
| [Prof. Dr. Stefan Decker](https://www.fit.fraunhofer.de/de/profil/institutsleitung.html) | [Fraunhofer Institute for Applied Information Technology FIT](https://www.fit.fraunhofer.de/en.html) | Sankt Augustin |

docs/nfdi4ing/01_bp.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
- Process quality assessment
1919
- Performance evaluation methods
2020

21+
<!-- BEGIN-ANNOTATION: oeo -->
22+
## Testing Annotation
23+
electrical energy is a form of energy derived from the potential or kinetic energy of charged particles.
24+
<!-- END-ANNOTATION: oeo -->
25+
2126
[Learn more about our workflows →](02_workflow.md)
2227

2328
*Source: [NFDI4ING QA Metrics](https://nfdi4ing.de/special-interest-groups-sig/qa-metrics/)*

hooks.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import requests
2+
import re
3+
4+
def extract_annotation_blocks(markdown):
5+
6+
supported_ontologies = ["oeo", "sms", "fmi", "dogont", "brick", "s4grid", "sargon", "s4ener", "bont", "openadr", "dices"]
7+
8+
ontology_pattern = '|'.join(supported_ontologies)
9+
annotation_pattern = fr'<!-- BEGIN-ANNOTATION: ({ontology_pattern}) -->(.*?)<!-- END-ANNOTATION: \1 -->'
10+
annotation_matches = re.finditer(annotation_pattern, markdown, re.DOTALL)
11+
12+
annotation_blocks = []
13+
14+
for match in annotation_matches:
15+
full_match = match.group(0)
16+
ontology_id = match.group(1)
17+
content = match.group(2)
18+
annotation_blocks.append((full_match, ontology_id, content))
19+
20+
return annotation_blocks
21+
22+
def get_ontology_annotations(config, ontology_id, text):
23+
24+
api_endpoint = config.get('api_url', 'https://service.tib.eu/sandbox/nfdi4energyannotator/annotate')
25+
26+
try:
27+
response = requests.post(
28+
api_endpoint,
29+
json={'text': text, 'ontology_ids': [ontology_id]},
30+
headers={'Content-Type': 'application/json'},
31+
timeout=30
32+
)
33+
34+
response.raise_for_status()
35+
response_data = response.json()
36+
print(f"Response from {ontology_id} ontology: {response_data}")
37+
38+
if 'matches' in response_data and isinstance(response_data['matches'], list):
39+
text_with_spans = wrap_terms_in_span(text, response_data['matches'])
40+
return text_with_spans
41+
elif 'annotated_text' in response_data:
42+
return response_data['annotated_text']
43+
else:
44+
return text
45+
46+
except Exception as e:
47+
print(f"Error annotating text with {ontology_id} ontology: {str(e)}")
48+
return text
49+
50+
def wrap_terms_in_span(text, matches):
51+
52+
cleaner_matches = [{'matched_term': m['matched_term'], 'start': m['start'], 'end': m['end'], 'iri': m['iri']} for m in matches]
53+
sorted_matches = sorted(cleaner_matches, key=lambda m: (-len(m['matched_term']), -m['start']))
54+
55+
modified_positions = set()
56+
57+
modifications = []
58+
59+
# First pass: determine which matches to process
60+
for match in sorted_matches:
61+
overlap = False
62+
for pos in range(match['start'], match['end'] + 1):
63+
if pos in modified_positions:
64+
overlap = True
65+
break
66+
67+
if overlap:
68+
continue
69+
70+
for pos in range(match['start'], match['end'] + 1):
71+
modified_positions.add(pos)
72+
73+
modifications.append(match)
74+
75+
modifications.sort(key=lambda m: m['start'])
76+
77+
# Second pass: apply modifications
78+
result = ""
79+
last_end = 0
80+
81+
for match in modifications:
82+
result += text[last_end:match['start']]
83+
result += f"<a href={match['iri']} style='border-bottom: 1px dotted #666; text-decoration: none;'>{match['matched_term']}</a> "
84+
last_end = match['end'] + 1
85+
86+
result += text[last_end:]
87+
88+
return result
89+
90+
def on_page_markdown(markdown, page, config, files):
91+
92+
annotation_blocks = extract_annotation_blocks(markdown)
93+
94+
for full_match, ontology_id, content in annotation_blocks:
95+
annotated_content = get_ontology_annotations(config, ontology_id, content)
96+
markdown = markdown.replace(full_match, annotated_content)
97+
98+
return markdown

mkdocs.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@ theme:
2222
icon: material/weather-sunny
2323
name: Switch to light mode
2424
extra_css:
25-
- stylesheets/extra.css
25+
- stylesheets/extra.css
26+
27+
hooks:
28+
- hooks.py
29+
30+
extra:
31+
api_url: "https://service.tib.eu/sandbox/nfdi4energyannotator/annotate"

overrides/partials/footer.html

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,21 @@
6464
<!-- Further information -->
6565
<div class="md-footer-meta md-typeset" style="display: flex; justify-content: center;">
6666
<div class="footer" style="display: flex; justify-content: center; gap: 100px; margin: 19.5px 0;">
67-
<div class="footer-section partners-contact">
68-
<div class="footer-title">Partners and Contact</div>
69-
<a href="" class="footer-link">Consortium in the NFDI e.V.</a>
70-
<a href="" class="footer-link">Funded Consortium</a>
71-
<a href="" class="footer-link">Contact</a>
72-
</div>
73-
<div class="footer-section legals">
74-
<div class="footer-title">Legals</div>
75-
<a href="" class="footer-link">Imprint and Data Privacy Statement</a>
76-
<a href="" class="footer-link">Legals UniOldenburg</a>
77-
</div>
78-
<div class="footer-section follow-us">
79-
<div class="footer-title">Follow us</div>
80-
<a href="" class="footer-link">Linkedin</a>
81-
<a href="" class="footer-link">Facebook</a>
82-
</div>
67+
<div class="footer-section partners-contact">
68+
<div class="footer-title">Partners and Contact</div>
69+
<a href="{{ 'footer/partners/consortium' | url }}" class="footer-link">Consortium in the NFDI e.V.</a>
70+
<a href="{{ 'footer/partners/funded-consortium' | url }}" class="footer-link">Funded Consortium</a>
71+
<a href="{{ 'footer/contact' | url }}" class="footer-link">Contact</a>
72+
</div>
73+
<div class="footer-section legals">
74+
<div class="footer-title">Legals</div>
75+
<a href="{{ 'footer/legal/imprint' | url }}" class="footer-link">Imprint and Data Privacy Statement</a>
76+
<a href="https://www.uol.de/en/imprint" class="footer-link" target="_blank" rel="noopener">Legals UniOldenburg</a>
77+
</div>
78+
<div class="footer-section follow-us">
79+
<div class="footer-title">Follow us</div>
80+
<a href="https://www.linkedin.com/company/nfdi4energy/" class="footer-link">Linkedin</a>
81+
</div>
8382
</div>
8483
<!-- Social links -->
8584
{% if config.extra.social %}

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mkdocs
2-
mkdocs-material
2+
mkdocs-material
3+
requests

0 commit comments

Comments
 (0)