Skip to content

Commit

Permalink
Reuse code: GenericDB.get_default_props now calls `ont_property.get…
Browse files Browse the repository at this point in the history
…_default_props`.
  • Loading branch information
Binh Vu committed Mar 12, 2024
1 parent e3fc615 commit 7058d61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 35 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGE LOG

## [Unreleased]

### Changed

- Reuse code: `GenericDB.get_default_props` now calls `ont_property.get_default_props`.

## [6.5.2] (2024-03-08)

### Fixed
Expand Down
37 changes: 2 additions & 35 deletions kgdata/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from kgdata.models.entity import Entity, EntityMetadata
from kgdata.models.multilingual import MultiLingualString, MultiLingualStringList
from kgdata.models.ont_class import OntologyClass
from kgdata.models.ont_property import OntologyProperty
from kgdata.models.ont_property import OntologyProperty, get_default_props
from loguru import logger
from rdflib import RDF, RDFS, XSD
from sm.namespaces.namespace import KnowledgeGraphNamespace
Expand Down Expand Up @@ -267,40 +267,7 @@ def ontcount(self):
raise NotImplementedError()

def get_default_props(self):
return {
str(RDFS.label): OntologyProperty(
id=str(RDFS.label),
label=MultiLingualString.en("label"),
description=MultiLingualString.en(
"a human-readable version of a resource's name"
),
aliases=MultiLingualStringList({"en": ["name"]}, "en"),
datatype=str(XSD.string),
parents=[],
related_properties=[],
equivalent_properties=[],
subjects=[],
inverse_properties=[],
instanceof=[str(RDF.Property)],
ancestors={},
),
str(RDF.type): OntologyProperty(
id=str(RDF.type),
label=MultiLingualString.en("type"),
description=MultiLingualString.en(
"Is used to state that a resource is an instance of a class"
),
aliases=MultiLingualStringList({"en": ["instance of"]}, "en"),
datatype=str(XSD.anyURI),
parents=[],
related_properties=[],
equivalent_properties=[],
subjects=[],
inverse_properties=[],
instanceof=[str(RDF.Property)],
ancestors={},
),
}
return {p.id: p for p in get_default_props()}


class URIMappingWrapper(Mapping[str, T]):
Expand Down

0 comments on commit 7058d61

Please sign in to comment.