-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entities #405
base: mwp_v1
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
def remove_multi(self, db: Session, *, ids: List[int]) -> List[EntityORM]: | ||
removed = db.query(EntityORM).filter(EntityORM.id.in_(ids)).all() | ||
db.query(EntityORM).filter(EntityORM.id.in_(ids)).delete( | ||
synchronize_session=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
is_human: Optional[bool] = Field( | ||
False, description="Whether the link was created by a human" | ||
) | ||
knowledge_base_id: Optional[str] = Field("", description="Link to wikidata") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default=""
|
||
|
||
# Properties for merging entities/span texts | ||
class EntityMerge(EntityBaseDTO): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
erben von EntityCreate
class EntityRelease(EntityBaseDTO): | ||
project_id: int = Field(description="Id of the current Project") | ||
entity_ids: List[int] = Field(description="List of Entity IDs to merge") | ||
spantext_ids: List[int] = Field(description="List of Span Text IDs to merge") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
span_text_ids
backend/src/api/endpoints/entity.py
Outdated
span_text_ids=[span_text_id], | ||
) | ||
new_entities.append(new_entity) | ||
db_objs = crud_entity.create_multi(db=db, create_dtos=new_entities, force=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte crud_entity.release_... erstellen. und hier aufrufen.
Bei Entity Create fehlt is_human=false
result = self.create_multi(db=db, create_dtos=[create_dto], force=force) | ||
return result[0] if len(result) > 0 else None | ||
|
||
def create_multi( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create multi muss mit hilfe einer hash map umgesetzt werden.
span_text_id -> entity
dann alle entities erstellen.
) | ||
crud_span_text_entity_link.create_multi(db=db, create_dtos=links, force=force) | ||
db.commit() | ||
self.remove_all_unused_entites(db=db) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
das muss weg
span text orm muss unique text haben. |
}, | ||
{} as Record<string, EntityRead>, | ||
); | ||
const projectEntitiesRows = projectEntities.data.map((entity) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add type: EnitityTableRow
from merge and release dtos
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…t aligned), changed spantexts to do as TODO intended, made it so that read_by_text returns the SpanTextORM as intended.
for more information, see https://pre-commit.ci
No description provided.