Skip to content
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

Open
wants to merge 21 commits into
base: mwp_v1
Choose a base branch
from
Open

Entities #405

wants to merge 21 commits into from

Conversation

bigabig
Copy link
Member

@bigabig bigabig commented Jun 27, 2024

No description provided.

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
Copy link
Member Author

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")
Copy link
Member Author

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):
Copy link
Member Author

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")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

span_text_ids

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)
Copy link
Member Author

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(
Copy link
Member Author

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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

das muss weg

@bigabig
Copy link
Member Author

bigabig commented Jun 27, 2024

span text orm muss unique text haben.

},
{} as Record<string, EntityRead>,
);
const projectEntitiesRows = projectEntities.data.map((entity) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add type: EnitityTableRow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant