Skip to content

Commit

Permalink
adjusted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ensaremirerol committed Nov 28, 2024
1 parent 445c414 commit 93317a5
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 148 deletions.
Empty file added server/models/__init__.py
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass, field
from enum import StrEnum

from server.service_protocols.fs_service_protocol.models import (
from server.models.file_metadata import (
FileMetadata,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass

from server.service_protocols.workspace_metadata_service_protocol.models import (
from server.models.workspace_metadata import (
WorkspaceMetadataModel,
)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion server/service_protocols/fs_service_protocol/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Protocol

from server.service_protocols.fs_service_protocol.models import (
from server.models.file_metadata import (
FileMetadata,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Protocol

from server.service_protocols.fs_service_protocol.models import (
from server.models.file_metadata import (
FileMetadata,
)
from server.service_protocols.ontology_service_protocol.models import (
from server.models.ontology import (
Ontology,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Protocol

from server.service_protocols.workspace_metadata_service_protocol.models import (
from server.models.workspace_metadata import (
WorkspaceMetadataModel,
)
from server.services.core.sqlite_db_service.tables.workspace_metadata import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Protocol

from server.service_protocols.workspace_service_protocol.models import (
from server.models.workspace import (
WorkspaceModel,
)

Expand Down
2 changes: 1 addition & 1 deletion server/services/core/workspace_metadata_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from server.const.err_enums import ErrCodes
from server.exceptions import ServerException
from server.service_protocols.workspace_metadata_service_protocol.models import (
from server.models.workspace_metadata import (
WorkspaceMetadataModel,
)
from server.services.core.sqlite_db_service import DBService
Expand Down
34 changes: 17 additions & 17 deletions server/utils/ontology_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from rdflib import Graph, Literal
from rdflib.query import ResultRow

from server.service_protocols.ontology_service_protocol import (
models,
from server.models import (
ontology,
)


Expand Down Expand Up @@ -84,16 +84,16 @@ class OntologyIndexer:

def _create_literal_from_rdflib_literal(
self, rdflib_literal: Literal
) -> models.Literal:
return models.Literal(
) -> ontology.Literal:
return ontology.Literal(
value=rdflib_literal.value,
language=rdflib_literal.language or "en",
datatype=rdflib_literal.datatype or "",
)

def get_classes(
self, ontology_uri: str, g: Graph
) -> list[models.Class]:
) -> list[ontology.Class]:
"""
Get classes from the ontology
Expand Down Expand Up @@ -182,9 +182,9 @@ def _update_class_labels_and_descriptions(

def _create_class_models(
self, ontology_uri: str, classes: dict
) -> list[models.Class]:
) -> list[ontology.Class]:
return [
models.Class(
ontology.Class(
belongs_to=ontology_uri,
full_uri=str(class_uri),
label=class_data["label"],
Expand All @@ -197,7 +197,7 @@ def _create_class_models(

def get_properties(
self, ontology_uri: str, g: Graph
) -> list[models.Property]:
) -> list[ontology.Property]:
"""
Get properties from the ontology
Expand Down Expand Up @@ -299,9 +299,9 @@ def _update_property_labels_and_descriptions(

def _create_property_models(
self, ontology_uri: str, properties: dict
) -> list[models.Property]:
) -> list[ontology.Property]:
return [
models.Property(
ontology.Property(
belongs_to=str(ontology_uri),
full_uri=str(property_uri),
label=property_data["label"],
Expand All @@ -320,22 +320,22 @@ def _create_property_models(

def _get_property_type(
self, property_type: str
) -> models.PropertyType:
) -> ontology.PropertyType:
match property_type:
case "http://www.w3.org/2002/07/owl#ObjectProperty":
return models.PropertyType.OBJECT
return ontology.PropertyType.OBJECT
case "http://www.w3.org/2002/07/owl#DatatypeProperty":
return models.PropertyType.DATATYPE
return ontology.PropertyType.DATATYPE
case "http://www.w3.org/2002/07/owl#AnnotationProperty":
return models.PropertyType.ANNOTATION
return ontology.PropertyType.ANNOTATION
case _:
raise ValueError(
f"Unknown property type: {property_type}"
)

def get_individuals(
self, ontology_uri: str, g: Graph
) -> list[models.Individual]:
) -> list[ontology.Individual]:
"""
Get individuals from the ontology
Expand Down Expand Up @@ -410,9 +410,9 @@ def _update_individual_labels_and_descriptions(

def _create_individual_models(
self, ontology_uri: str, individuals: dict
) -> list[models.Individual]:
) -> list[ontology.Individual]:
return [
models.Individual(
ontology.Individual(
belongs_to=ontology_uri,
full_uri=str(individual_uri),
label=individual_data["label"],
Expand Down
38 changes: 0 additions & 38 deletions test/services/core/sqlite_db_service_test.py

This file was deleted.

Loading

0 comments on commit 93317a5

Please sign in to comment.