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

size and pagination break when grouped models are empty/falsy #155

Closed
kevinstadler opened this issue Dec 2, 2024 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@kevinstadler
Copy link

Model:

from typing import Annotated

from pydantic import AnyUrl, BaseModel  # noqa: F401
from rdfproxy import SPARQLBinding


class WrittenWork_WorkCreationAssertion_WorkCreation(BaseModel):
    class Config:
        title = "text_creation"
        model_bool = "id"
        group_by = "written_work__work_creation_assertion__work_creation"
    id: Annotated[AnyUrl | None, SPARQLBinding(
        "written_work__work_creation_assertion__work_creation")] = None
    work_creation_6464e7f7408f5: Annotated[list[AnyUrl], SPARQLBinding(
        "written_work__work_creation_assertion__work_creation__work_creation_6464e7f7408f5")]
    text_creation_timeframe_assertio: Annotated[AnyUrl | None, SPARQLBinding(
        "written_work__work_creation_assertion__work_creation__text_creation_timeframe_assertio")] = None


class WrittenWork_WorkCreationAssertion(BaseModel):
    class Config:
        title = "text_creation_assertion"
        model_bool = "id"
    id: Annotated[AnyUrl | None, SPARQLBinding(
        "written_work__work_creation_assertion")] = None
    work_creation: Annotated[WrittenWork_WorkCreationAssertion_WorkCreation | None, SPARQLBinding(
        "written_work__work_creation_assertion__work_creation")] = None
    work_creation_assertion_by: Annotated[AnyUrl | None, SPARQLBinding(
        "written_work__work_creation_assertion__work_creation_assertion_by")] = None
    work_creation_assertion_by_64676da87229e: Annotated[AnyUrl | None, SPARQLBinding(
        "written_work__work_creation_assertion__work_creation_assertion_by_64676da87229e")] = None


class WrittenWork(BaseModel):
    class Config:
        title = "Text Expression"
        model_bool = "id"
        group_by = "written_work"
    id: Annotated[AnyUrl | None, SPARQLBinding("written_work")] = None
    written_work_label: Annotated[str | None, SPARQLBinding(
        "written_work__written_work_label")] = None
    work_creation_assertion: Annotated[list[WrittenWork_WorkCreationAssertion], SPARQLBinding(
        "written_work__work_creation_assertion")]

Query (query result)

PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX lrmoo: <http://iflastandards.info/ns/lrm/lrmoo/>
PREFIX star: <https://r11.eu/ns/star/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX r11: <https://r11.eu/ns/spec/>
PREFIX r11pros: <https://r11.eu/ns/prosopography/>

SELECT
?written_work
  ?written_work__written_work_label
  ?written_work__work_creation_assertion
    ?written_work__work_creation_assertion__work_creation
      ?written_work__work_creation_assertion__work_creation__work_creation_6464e7f7408f5
      ?written_work__work_creation_assertion__work_creation__text_creation_timeframe_assertio
    ?written_work__work_creation_assertion__work_creation_assertion_by
    ?written_work__work_creation_assertion__work_creation_assertion_by_64676da87229e

WHERE {
?written_work a r11:Text_Expression.

  ?written_work crm:P3_has_note ?written_work__written_work_label.

  OPTIONAL {
  ?written_work__work_creation_assertion a star:E13_lrmoo_R17.
  ?written_work__work_creation_assertion crm:P141_assigned ?written_work.

    ?written_work__work_creation_assertion__work_creation a lrmoo:F28_Expression_Creation.
    ?written_work__work_creation_assertion___wc crm:P141_assigned ?written_work__work_creation_assertion.
    ?written_work__work_creation_assertion___wc crm:P140_assigned_attribute_to ?written_work__work_creation_assertion__work_creation.

      OPTIONAL {
      ?written_work__work_creation_assertion__work_creation__work_creation_6464e7f7408f5 a star:E13_crm_P14.
      ?written_work__work_creation_assertion__work_creation___wc6 crm:P141_assigned ?written_work__work_creation_assertion__work_creation.
      ?written_work__work_creation_assertion__work_creation___wc6 crm:P140_assigned_attribute_to ?written_work__work_creation_assertion__work_creation___wc6___wc6.
      ?written_work__work_creation_assertion__work_creation__work_creation_6464e7f7408f5 crm:P140_assigned_attribute_to ?written_work__work_creation_assertion__work_creation___wc6___wc6.
      }

      ?written_work__work_creation_assertion__work_creation__text_creation_timeframe_assertio a star:E13_crm_P4.
      ?written_work__work_creation_assertion__work_creation___tcta crm:P141_assigned ?written_work__work_creation_assertion__work_creation.
      ?written_work__work_creation_assertion__work_creation___tcta crm:P140_assigned_attribute_to ?written_work__work_creation_assertion__work_creation___tcta___tcta.
      ?written_work__work_creation_assertion__work_creation__text_creation_timeframe_assertio crm:P140_assigned_attribute_to ?written_work__work_creation_assertion__work_creation___tcta___tcta.

    ?written_work__work_creation_assertion__work_creation_assertion_by a crm:E21_Person.
    ?written_work__work_creation_assertion___wcab crm:P141_assigned ?written_work__work_creation_assertion.
    ?written_work__work_creation_assertion___wcab crm:P14_carried_out_by ?written_work__work_creation_assertion__work_creation_assertion_by.

    ?written_work__work_creation_assertion__work_creation_assertion_by_64676da87229e a r11:Author_Group.
    ?written_work__work_creation_assertion___wcab6 crm:P141_assigned ?written_work__work_creation_assertion.
    ?written_work__work_creation_assertion___wcab6 crm:P14_carried_out_by ?written_work__work_creation_assertion__work_creation_assertion_by_64676da87229e.
  }
}
@kevinstadler kevinstadler added the bug Something isn't working label Dec 2, 2024
@lu-pl lu-pl closed this as completed Dec 3, 2024
@lu-pl
Copy link
Contributor

lu-pl commented Dec 3, 2024

Fixed by #157 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants