Skip to content

Commit

Permalink
rename default_props to get_default_props
Browse files Browse the repository at this point in the history
  • Loading branch information
Binh Vu committed Jan 16, 2024
1 parent f67b813 commit b87ce15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions kgdata/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@
from functools import cached_property, partial
from importlib import import_module
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Generic, Iterator, Mapping, Optional, TypeVar
from typing import (
TYPE_CHECKING,
Any,
Callable,
Generic,
Iterator,
Mapping,
Optional,
TypeVar,
)

import orjson
import serde.json
from hugedict.prelude import (
CacheDict,
RocksDBCompressionOptions,
Expand All @@ -22,14 +32,12 @@
from hugedict.types import HugeMutableMapping
from loguru import logger
from rdflib import RDF, RDFS, XSD
from sm.namespaces.namespace import KnowledgeGraphNamespace

import serde.json
from kgdata.models.entity import Entity
from kgdata.models.multilingual import MultiLingualString, MultiLingualStringList
from kgdata.models.ont_class import OntologyClass
from kgdata.models.ont_property import OntologyProperty
from sm.namespaces.namespace import KnowledgeGraphNamespace


if TYPE_CHECKING:
from hugedict.core.rocksdb import FileFormat
Expand Down Expand Up @@ -249,8 +257,7 @@ def entity_types(self):
def ontcount(self):
raise NotImplementedError()

@cached_property
def default_props(self):
def get_default_props(self):
return {
str(RDFS.label): OntologyProperty(
id=str(RDFS.label),
Expand All @@ -275,17 +282,15 @@ class URIMappingWrapper(Mapping[str, T]):
def __init__(self, map: Mapping[str, T], kgns: KnowledgeGraphNamespace):
self.map = map
self.kgns = kgns

def __getitem__(self, key: str) -> T:
return self.map[self.kgns.uri_to_id(key)]

def __len__(self):
return len(self.map)

def __iter__(self) -> Iterator[str]:
return (self.kgns.id_to_uri(id) for id in self.map)




def build_database(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kgdata"
version = "6.2.1"
version = "6.3.0"
description = "Library to process dumps of knowledge graphs (Wikipedia, DBpedia, Wikidata)"
readme = "README.md"
authors = [{ name = "Binh Vu", email = "[email protected]" }]
Expand Down

0 comments on commit b87ce15

Please sign in to comment.