diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 478bbb9..14d608c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,11 +22,11 @@ jobs: - name: Validate ontology TTL run: rapper -i turtle ontology/ontology.ttl -c - name: Validate knowledge graph TTL - run: rapper -i turtle ontology/graph.ttl -c - - name: Validate individual graphs TTLs + run: rapper -i turtle graph/graph.ttl -c + - name: Validate individual subgraphs TTLs run: | - for graph in ontology/graphs/*.ttl; do - rapper -i turtle -c "$graph" + for subgraph in graph/subgraphs/*.ttl; do + rapper -i turtle -c "$subgraph" done test: runs-on: ubuntu-latest @@ -63,12 +63,14 @@ jobs: git fetch --tags --prune && \ git reset --hard @{upstream} && \ git clean -d --force" - - name: Generate versioned ontology files + - name: Generate versioned ontology and graph files run: | ssh -p${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \ "cd ${{ secrets.SSH_WORKING_DIR }} && \ for tag in \$(git tag --sort=version:refname); do mkdir -p ontology/\$tag + mkdir -p graph/\$tag + git show \$tag:ontology/ontology.ttl > ontology/\$tag/ontology.ttl - git show \$tag:ontology/graph.ttl > ontology/\$tag/graph.ttl + git show \$tag:graph/graph.ttl > graph/\$tag/graph.ttl done" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9a162c9..ed7870f 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -16,11 +16,11 @@ jobs: - name: Validate ontology TTL run: rapper -i turtle ontology/ontology.ttl -c - name: Validate knowledge graph TTL - run: rapper -i turtle ontology/graph.ttl -c - - name: Validate individual graphs TTLs + run: rapper -i turtle graph/graph.ttl -c + - name: Validate individual subgraphs TTLs run: | - for graph in ontology/graphs/*.ttl; do - rapper -i turtle -c "$graph" + for subgraph in graph/subgraphs/*.ttl; do + rapper -i turtle -c "$subgraph" done check-rdf-issues: diff --git a/.gitignore b/.gitignore index 6e1bc95..e7e6bb9 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,4 @@ venv.bak/ # ===== PROJECT ===================== ontology/v* +graph/v* diff --git a/.python-version b/.python-version index 44305e2..655354d 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.13.12 +3.13.13 diff --git a/README.md b/README.md index c20f59f..cc0e071 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # The Monomyth Ontology -Group project for the Knowledge Representation and Extraction 2024/25 course. - The site of the project is live at [monomyth.metamuses.org](https://monomyth.metamuses.org). The **Monomyth Ontology** is an RDF/OWL ontology for modeling narrative works @@ -30,14 +28,14 @@ The most important components are: novel, or other narrative form. * **Monomyth Expression**: the specific interpretation of a narrative work through the hero's journey framework. -* **Acts and Stages**: the three broad phases of the monomyth, Departure, +* **Acts** and **Stages**: the three broad phases of the monomyth, Departure, Initiation, and Return, articulated through Campbell's seventeen stages. * **Stage Realizations**: the concrete moments in a story where a monomyth stage is realized, described, evaluated, and placed in the narrative sequence. -* **Characters and Archetypes**: the figures involved in the journey, connected -to functional roles such as hero, mentor, herald, shadow, ally, trickster, or -threshold guardian, based on Christopher Vogler's adaptation for screenwriting -of Campbell's work. +* **Characters** and **Archetypes**: the figures involved in the journey, +connected to functional roles such as hero, mentor, herald, shadow, ally, +trickster, or threshold guardian, based on Christopher Vogler's adaptation for +screenwriting of Campbell's work. * **Fit Qualities**: a graded vocabulary for expressing how closely a narrative moment corresponds to a monomyth stage, from perfect alignment to weak, absent, or inverted realization. @@ -48,8 +46,8 @@ forms of variation. mapping, especially where the relationship between the story and the monomyth requires nuance rather than simple classification. -## Graphical framework -![Monomyth Ontology Graphical Framework](https://raw.githubusercontent.com/metamuses/monomyth/refs/heads/main/graphical_framework/ontology.png) +![Monomyth Ontology Graffoo](https://raw.githubusercontent.com/metamuses/monomyth/refs/heads/main/graffoo/ontology.png) + ## Knowledge graphs The full knowledge graph is available at [monomyth.metamuses.org/graph/](https://monomyth.metamuses.org/graph/). @@ -63,7 +61,7 @@ ontology. Analyzed works include: -* **Oedipus Myth**: a classical myth about a king whose attempt to escape +* **Oedipus**: a classical myth about a king whose attempt to escape prophecy leads him toward the discovery of his own hidden guilt. * **Aeneid**: a Latin epic poem about Aeneas's journey from the ruins of Troy toward the foundation of a new destiny in Italy. diff --git a/config/monomyth.nginx b/config/monomyth.nginx index 42408c4..8006715 100644 --- a/config/monomyth.nginx +++ b/config/monomyth.nginx @@ -61,16 +61,17 @@ server { try_files /ontology/ontology.ttl =404; } - # ===== GRAPH ============================ - # serve subgraphs TTL for website modals - location ~ ^/graphs/(.+\.ttl)$ { + # ===== SUBGRAPHS ============================ + # serve subgraphs files with local hosting + location ~ ^/subgraphs/(.+\.ttl)$ { add_header Access-Control-Allow-Origin *; add_header Cache-Control "public, max-age=3600"; default_type text/turtle; - try_files /ontology/graphs/$1 =404; + try_files /graph/subgraphs/$1 =404; } + # ===== GRAPH ============================ # redirect /graph to /graph/ location = /graph { return 301 /graph/; @@ -90,7 +91,7 @@ server { add_header Cache-Control "public, max-age=7776000"; default_type text/turtle; - rewrite ^/([0-9]+\.[0-9]+)/graph\.ttl$ /ontology/v$1/graph.ttl break; + rewrite ^/([0-9]+\.[0-9]+)/graph\.ttl$ /graph/v$1/graph.ttl break; } # serve main graph endpoint @@ -99,7 +100,7 @@ server { add_header Cache-Control "public, max-age=3600"; default_type text/turtle; - try_files /ontology/graph.ttl =404; + try_files /graph/graph.ttl =404; } # ===== SPARQL =========================== diff --git a/graphical_framework/ontology.graphml b/graffoo/ontology.graphml similarity index 99% rename from graphical_framework/ontology.graphml rename to graffoo/ontology.graphml index 42da735..62bf37a 100644 --- a/graphical_framework/ontology.graphml +++ b/graffoo/ontology.graphml @@ -141,7 +141,7 @@ - xsd:string + rdfs:Literal @@ -218,7 +218,7 @@ - xsd:string + rdfs:Literal @@ -285,7 +285,7 @@ http://www.w3.org/2001/XMLSchema# - monomyth: + monomyth: creon: rdfs: rdf: @@ -676,7 +676,7 @@ xsd: - xsd:string + rdfs:Literal diff --git a/graffoo/ontology.png b/graffoo/ontology.png new file mode 100644 index 0000000..4bdfd13 Binary files /dev/null and b/graffoo/ontology.png differ diff --git a/ontology/graph.ttl b/graph/graph.ttl similarity index 100% rename from ontology/graph.ttl rename to graph/graph.ttl diff --git a/ontology/graphs/aeneid.ttl b/graph/subgraphs/aeneid.ttl similarity index 100% rename from ontology/graphs/aeneid.ttl rename to graph/subgraphs/aeneid.ttl diff --git a/ontology/graphs/batman.ttl b/graph/subgraphs/batman.ttl similarity index 100% rename from ontology/graphs/batman.ttl rename to graph/subgraphs/batman.ttl diff --git a/ontology/graphs/lady-bird.ttl b/graph/subgraphs/lady-bird.ttl similarity index 100% rename from ontology/graphs/lady-bird.ttl rename to graph/subgraphs/lady-bird.ttl diff --git a/ontology/graphs/ocarina-of-time.ttl b/graph/subgraphs/ocarina-of-time.ttl similarity index 100% rename from ontology/graphs/ocarina-of-time.ttl rename to graph/subgraphs/ocarina-of-time.ttl diff --git a/ontology/graphs/oedipus.ttl b/graph/subgraphs/oedipus.ttl similarity index 100% rename from ontology/graphs/oedipus.ttl rename to graph/subgraphs/oedipus.ttl diff --git a/ontology/graphs/orlando-furioso.ttl b/graph/subgraphs/orlando-furioso.ttl similarity index 100% rename from ontology/graphs/orlando-furioso.ttl rename to graph/subgraphs/orlando-furioso.ttl diff --git a/ontology/graphs/rostam-haft-khan.ttl b/graph/subgraphs/rostam-haft-khan.ttl similarity index 100% rename from ontology/graphs/rostam-haft-khan.ttl rename to graph/subgraphs/rostam-haft-khan.ttl diff --git a/ontology/graphs/sableFable.ttl b/graph/subgraphs/sable-fable.ttl similarity index 100% rename from ontology/graphs/sableFable.ttl rename to graph/subgraphs/sable-fable.ttl diff --git a/ontology/graphs/the-call-of-the-wild.ttl b/graph/subgraphs/the-call-of-the-wild.ttl similarity index 100% rename from ontology/graphs/the-call-of-the-wild.ttl rename to graph/subgraphs/the-call-of-the-wild.ttl diff --git a/ontology/graphs/the-lion-king.ttl b/graph/subgraphs/the-lion-king.ttl similarity index 100% rename from ontology/graphs/the-lion-king.ttl rename to graph/subgraphs/the-lion-king.ttl diff --git a/ontology/graphs/the-matrix.ttl b/graph/subgraphs/the-matrix.ttl similarity index 100% rename from ontology/graphs/the-matrix.ttl rename to graph/subgraphs/the-matrix.ttl diff --git a/ontology/graphs/walter-mitty.ttl b/graph/subgraphs/walter-mitty.ttl similarity index 100% rename from ontology/graphs/walter-mitty.ttl rename to graph/subgraphs/walter-mitty.ttl diff --git a/graphical_framework/ontology.png b/graphical_framework/ontology.png deleted file mode 100644 index 5cc8195..0000000 Binary files a/graphical_framework/ontology.png and /dev/null differ diff --git a/ontology/ontology.ttl b/ontology/ontology.ttl index 0119b18..1b414d8 100644 --- a/ontology/ontology.ttl +++ b/ontology/ontology.ttl @@ -451,13 +451,13 @@ monomyth:fitNote a owl:DatatypeProperty ; rdfs:comment """An annotation explaining nuances, tensions, or interpretive choices in the stage mapping."""@en ; rdfs:domain monomyth:StageRealization ; - rdfs:range xsd:string . + rdfs:range rdfs:Literal . monomyth:realizationDescription a owl:DatatypeProperty ; rdfs:label "realization description"@en ; rdfs:comment """A prose description of how a stage is realized in a specific narrative."""@en ; rdfs:domain monomyth:StageRealization ; - rdfs:range xsd:string . + rdfs:range rdfs:Literal . monomyth:stageRealizationOrder a owl:DatatypeProperty, owl:FunctionalProperty ; @@ -492,7 +492,7 @@ monomyth:divergenceRationale a owl:DatatypeProperty ; behind a divergence from the monomyth template. Complements a fit note on a stage realization by focusing specifically on the motivation for the departure."""@en ; rdfs:domain creon:ProductDivergence ; - rdfs:range xsd:string . + rdfs:range rdfs:Literal . # ============================================================================== # NAMED INDIVIDUALS diff --git a/scripts/check_rdf_entities.py b/scripts/check_rdf_entities.py index 06d225f..599c992 100644 --- a/scripts/check_rdf_entities.py +++ b/scripts/check_rdf_entities.py @@ -4,7 +4,7 @@ Check Turtle graph files for ontology vocabulary consistency. The script loads ontology/ontology.ttl to discover declared ontology terms, -then loads every .ttl file under ontology/graphs/ and validates Turtle syntax. +then loads every .ttl file under graph/subgraphs/ and validates Turtle syntax. It reports three kinds of issues: - Unknown predicates: ontology predicates used in graphs but not declared as properties @@ -30,7 +30,7 @@ ROOT_DIR = Path(__file__).resolve().parent.parent ONTOLOGY_FILE = ROOT_DIR / "ontology" / "ontology.ttl" -GRAPH_DIR = ROOT_DIR / "ontology" / "graphs" +SUBGRAPHS_DIR = ROOT_DIR / "graph" / "subgraphs" ONTOLOGY_URI = "https://monomyth.metamuses.org/ontology#" @@ -113,7 +113,7 @@ def collect_declared_terms(rdf_graph): used_classes = {} used_object_terms = {} -for graph_file in sorted(GRAPH_DIR.glob("**/*.ttl")): +for graph_file in sorted(SUBGRAPHS_DIR.glob("**/*.ttl")): print(f"Loading {graph_file}") file_graph = Graph() diff --git a/scripts/check_rdf_inverses.py b/scripts/check_rdf_inverses.py index 613cbd7..4da8079 100644 --- a/scripts/check_rdf_inverses.py +++ b/scripts/check_rdf_inverses.py @@ -5,7 +5,7 @@ The script loads ontology/ontology.ttl to discover owl:inverseOf declarations and rdfs:subPropertyOf relationships, then loads every .ttl file under -ontology/graphs/ and validates Turtle syntax. +graph/subgraphs/ and validates Turtle syntax. It checks that every use of a property with an inverse is mirrored by the corresponding inverse triple. Subproperties are handled automatically, so a @@ -29,7 +29,7 @@ ROOT_DIR = Path(__file__).resolve().parent.parent ONTOLOGY_FILE = ROOT_DIR / "ontology" / "ontology.ttl" -GRAPH_DIR = ROOT_DIR / "ontology" / "graphs" +SUBGRAPHS_DIR = ROOT_DIR / "graph" / "subgraphs" MONOMYTH = Namespace("https://monomyth.metamuses.org/ontology#") @@ -92,7 +92,7 @@ def has_any_triple(graph, s, ps, o): data = Graph() -for ttl in sorted(GRAPH_DIR.glob("**/*.ttl")): +for ttl in sorted(SUBGRAPHS_DIR.glob("**/*.ttl")): print(f"Loading {ttl}") parse_turtle_file(data, ttl) diff --git a/scripts/check_rdf_issues.py b/scripts/check_rdf_issues.py index e6b3153..18eb05e 100644 --- a/scripts/check_rdf_issues.py +++ b/scripts/check_rdf_issues.py @@ -3,7 +3,7 @@ """ Check Turtle graph files for RDF consistency issues. -The script loads every .ttl file under ontology/graphs/, validates Turtle +The script loads every .ttl file under graph/subgraphs/, validates Turtle syntax, and inspects local resources belonging to the configured BASE_URI. It reports two kinds of issues: @@ -23,7 +23,7 @@ ROOT_DIR = Path(__file__).resolve().parent.parent # Define the directory containing Turtle graph files -GRAPHS_DIR = ROOT_DIR / "ontology" / "graphs" +SUBGRAPHS_DIR = ROOT_DIR / "graph" / "subgraphs" # Define the URI prefix used to identify local project resources BASE_URI = "https://monomyth.metamuses.org/graph/" @@ -31,8 +31,8 @@ # Create the RDF graph that will contain all parsed triples g = Graph() -# Load every Turtle file in the graphs directory -for ttl_file in sorted(GRAPHS_DIR.glob("**/*.ttl")): +# Load every Turtle file in the subgraphs directory +for ttl_file in sorted(SUBGRAPHS_DIR.glob("**/*.ttl")): print(f"Loading {ttl_file}") # Stop immediately if any Turtle file has invalid syntax diff --git a/scripts/merge_subgraphs.py b/scripts/merge_subgraphs.py index 84a554a..a051124 100644 --- a/scripts/merge_subgraphs.py +++ b/scripts/merge_subgraphs.py @@ -3,9 +3,9 @@ """ Merge selected Turtle subgraph files into the main project graph. -The script preserves the header/prefix section of ontology/graph.ttl, removes +The script preserves the header/prefix section of graph/graph.ttl, removes any previously merged graph body, then appends the body of each configured -subgraph from ontology/graphs/. +subgraph from graph/subgraphs/. Each subgraph is expected to contain a prefix/header section followed by a blank line and then its graph triples. Only the content after the first blank @@ -22,11 +22,11 @@ ROOT_DIR = Path(__file__).resolve().parent.parent # Define the main graph and subgraphs paths -MAIN_GRAPH = ROOT_DIR / "ontology" / "graph.ttl" -SUBGRAPHS_DIR = ROOT_DIR / "ontology" / "graphs" +MAIN_GRAPH = ROOT_DIR / "graph" / "graph.ttl" +SUBGRAPHS_DIR = ROOT_DIR / "graph" / "subgraphs" # List subgraphs in merge order. -SUBGRAPH_FILES = [ +SUBGRAPHS = [ "oedipus.ttl", "aeneid.ttl", "rostam-haft-khan.ttl", @@ -38,7 +38,7 @@ "the-matrix.ttl", "walter-mitty.ttl", "lady-bird.ttl", - "sableFable.ttl", + "sable-fable.ttl", ] # Define the separator between subgraphs @@ -63,7 +63,7 @@ # Collect subgraph bodies before rewriting the main graph subgraph_bodies = [] -for filename in SUBGRAPH_FILES: +for filename in SUBGRAPHS: path = SUBGRAPHS_DIR / filename # Skip missing subgraphs diff --git a/website/img/martina.png b/website/img/martina.png new file mode 100644 index 0000000..7cfbca2 Binary files /dev/null and b/website/img/martina.png differ diff --git a/website/img/maryam.png b/website/img/maryam.png new file mode 100644 index 0000000..f185186 Binary files /dev/null and b/website/img/maryam.png differ diff --git a/website/img/nicol.png b/website/img/nicol.png new file mode 100644 index 0000000..f164acd Binary files /dev/null and b/website/img/nicol.png differ diff --git a/website/img/tommaso.png b/website/img/tommaso.png new file mode 100644 index 0000000..89e29a3 Binary files /dev/null and b/website/img/tommaso.png differ diff --git a/website/index.html b/website/index.html index 94b49cc..64ee3f9 100644 --- a/website/index.html +++ b/website/index.html @@ -462,7 +462,7 @@

Narratives Analyzed

-
+
@@ -686,7 +686,7 @@

Narratives Analyzed

-
+
@@ -822,7 +822,7 @@

Narratives Analyzed

-
+
@@ -937,7 +937,7 @@

Narratives Analyzed

The Matrix

Movie - Knowledge Graph
@@ -1035,7 +1035,7 @@

Stage Fit Profile

The Lion King

Animated Movie - Knowledge Graph
@@ -1152,7 +1152,7 @@

Stage Fit Profile

The Call of the Wild

Novel - Knowledge Graph
@@ -1262,7 +1262,7 @@

Stage Fit Profile

- @@ -1740,7 +1740,7 @@

Stage Fit Profile

Oedipus Rex & Oedipus at Colonus

@@ -1847,9 +1847,9 @@

Stage Fit Profile

- -