Skip to content
Open
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,20 @@ The following URIs will resolve to the KGCL standard:

[Read more here.](https://incatools.github.io/kgcl/)

## How to run project locally
install python 3.9, using mise (optional), get mise from [here](https://mise.jdx.dev/)
```bash
mise install python 3.9
```
install poetry
```bash
pip install poetry
```
install dependencies
```bash
poetry install
```
run tests
```bash
poetry run pytest
```
33 changes: 33 additions & 0 deletions src/kgcl_schema/datamodel/kgcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ class ObjectPropertyCreationId(NodeCreationId):
class NodeDeletionId(NodeChangeId):
pass

class ClassDeletionId(NodeDeletionId):
pass


class NodeDirectMergeId(NodeObsoletionId):
pass
Expand Down Expand Up @@ -2531,6 +2534,36 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
super().__post_init__(**kwargs)
self.type = str(self.class_name)

@dataclass
class ClassDeletion(NodeDeletion):
"""
A node deletion where the owl type is 'owl:Class'
"""
_inherited_slots: ClassVar[List[str]] = []

class_class_uri: ClassVar[URIRef] = KGCL.ClassDeletion
class_class_curie: ClassVar[str] = "kgcl:ClassDeletion"
class_name: ClassVar[str] = "ClassDeletion"
class_model_uri: ClassVar[URIRef] = KGCL.ClassDeletion

id: Union[str, ClassDeletionId] = None
superclass: Optional[Union[str, NodeId]] = None
change_description: Optional[str] = None

def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, ClassDeletionId):
self.id = ClassDeletionId(self.id)

if self.superclass is not None and not isinstance(self.superclass, NodeId):
self.superclass = NodeId(self.superclass)

if self.change_description is not None and not isinstance(self.change_description, str):
self.change_description = str(self.change_description)

super().__post_init__(**kwargs)


@dataclass(repr=False)
class NodeDirectMerge(NodeObsoletion):
Expand Down
8 changes: 8 additions & 0 deletions src/kgcl_schema/schema/kgcl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,14 @@ classes:
slot_usage:
change_description:
string_serialization: delete {about_node}
ClassDeletion:
is_a: NodeDeletion
description: A node deletion where the owl type is 'owl:Class'
slots:
- superclass
slot_usage:
change_description:
string_serialization: delete class {about_node}
NodeDirectMerge:
is_a: NodeObsoletion
mixins:
Expand Down