Skip to content

Commit

Permalink
update EntityPath attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
msaipraneeth committed Dec 30, 2023
1 parent c7b03fa commit abd9ea2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions cmem_plugin_base/dataintegration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def _get_schema(data: Union[dict, list]):
schema_paths.append(
EntityPath(
path=_key,
is_uri=_type in ('dict', 'list_dict'),
is_attribute=_type not in ('list', 'list_dict')
is_relation=_type in ('dict', 'list_dict'),
is_single_value=_type not in ('list', 'list_dict')
)
)
schema = EntitySchema(
Expand Down
40 changes: 20 additions & 20 deletions tests/test_utils_build_entities_from_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def test_single_object():
assert entities.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("name", False, is_attribute=True),
EntityPath("email", False, is_attribute=True),
EntityPath("name", False, is_single_value=True),
EntityPath("email", False, is_single_value=True),
]
)

Expand Down Expand Up @@ -51,9 +51,9 @@ def test_single_object_one_level():
assert entities.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("name", False, is_attribute=True),
EntityPath("email", False, is_attribute=True),
EntityPath("city", True, is_attribute=True),
EntityPath("name", False, is_single_value=True),
EntityPath("email", False, is_single_value=True),
EntityPath("city", True, is_single_value=True),
]
)
# Validate sub entities
Expand All @@ -64,8 +64,8 @@ def test_single_object_one_level():
assert _.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("name", False, is_attribute=True),
EntityPath("country", False, is_attribute=True)
EntityPath("name", False, is_single_value=True),
EntityPath("country", False, is_single_value=True)
]
)

Expand Down Expand Up @@ -97,9 +97,9 @@ def test_single_object_one_level_array():
assert entities.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("name", False, is_attribute=True),
EntityPath("email", False, is_attribute=True),
EntityPath("city", True, is_attribute=False),
EntityPath("name", False, is_single_value=True),
EntityPath("email", False, is_single_value=True),
EntityPath("city", True, is_single_value=False),
]
)
# Validate sub entities
Expand All @@ -110,8 +110,8 @@ def test_single_object_one_level_array():
assert _.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("name", False, is_attribute=True),
EntityPath("country", False, is_attribute=True)
EntityPath("name", False, is_single_value=True),
EntityPath("country", False, is_single_value=True)
]
)

Expand Down Expand Up @@ -153,9 +153,9 @@ def test_single_object_two_level_array():
assert entities.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("name", False, is_attribute=True),
EntityPath("email", False, is_attribute=True),
EntityPath("city", True, is_attribute=False),
EntityPath("name", False, is_single_value=True),
EntityPath("email", False, is_single_value=True),
EntityPath("city", True, is_single_value=False),
]
)
# Validate sub entities
Expand All @@ -167,16 +167,16 @@ def test_single_object_two_level_array():
assert city_entities.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("name", False, is_attribute=True),
EntityPath("country", False, is_attribute=True),
EntityPath("geo_location", True, is_attribute=True),
EntityPath("name", False, is_single_value=True),
EntityPath("country", False, is_single_value=True),
EntityPath("geo_location", True, is_single_value=True),
]
)

assert location_entities.schema == EntitySchema(
type_uri="",
paths=[
EntityPath("lat", False, is_attribute=True),
EntityPath("long", False, is_attribute=True),
EntityPath("lat", False, is_single_value=True),
EntityPath("long", False, is_single_value=True),
]
)

0 comments on commit abd9ea2

Please sign in to comment.