Commit fb9677a8 authored by Noé Gaumont's avatar Noé Gaumont 🐙
Browse files

feat: use ExternalUri to store equivalent class

parent 23a9a5adb1e5
Pipeline #91655 failed with stages
in 5 minutes and 21 seconds
import subprocess
import re
import os
from pathlib import Path
import shutil
from typing import Iterable, Optional, List, Dict
from argparse import ArgumentParser
......@@ -18,6 +20,7 @@
from owl2yams.generate_postcreate import generate_postcreate
here = os.path.dirname(__file__)
RDFS.Literal: "String",
......@@ -178,22 +181,6 @@
if "CWUri" in schema:
raise ValueError("CWUri is reserved keyword, please rename it in your model")
cwuri_entitytype = schema.add_entity_type(EntityType("CWUri"))
if "cw_fragment" in schema:
raise ValueError(
"'cw_fragment' is reserved keyword, please rename it in your model"
cw_fragment_type = schema.add_relation_type(RelationType("cw_fragment"))
RelationDefinition(cwuri_entitytype, cw_fragment_type, "String")
if "cw_uri" in schema:
raise ValueError("'cw_uri' is reserved keyword, please rename it in your model")
cw_uri_type = schema.add_relation_type(RelationType("cw_uri"))
schema.add_relation_def(RelationDefinition(cwuri_entitytype, cw_uri_type, "String"))
return schema, entitytype_fragment_to_uri, relationtype_fragment_to_uri
......@@ -268,6 +255,10 @@
cube_subfolder = cube_master_folder.replace("-", "_")
with open(f"{cube_master_folder}/{cube_subfolder}/", "a") as f:
model_schema_path = Path(f"{cube_master_folder}/{cube_subfolder}/schema/")
model_schema_path.parent.mkdir(parents=True, exist_ok=True)
with open(model_schema_path, "a") as f:
......@@ -272,5 +263,8 @@
base_schema_path = Path(f"{cube_master_folder}/{cube_subfolder}/schema/")
shutil.copy(str(f"{here}/"), str(base_schema_path))
with open(
f"{cube_master_folder}/{cube_subfolder}/migration/", "a"
) as f:
from yams.buildobjs import *
class equivalent_class(RelationDefinition):
subject = ("CWEType", "CWRelation")
object = ("ExternalUri",)
cardinality = "*?"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment