scaife-viewer / sv-mini

front-end for the Scaife "SV Mini" prototype
https://scaife-viewer.org/
MIT License
3 stars 0 forks source link

Implement "record-based" display mode #35

Closed jacobwegner closed 3 years ago

jacobwegner commented 4 years ago

For iliad-word-alignment, we should use text parts to break lines within each column

For iliad-sentence-alignment, we should organize columns by alignment records (similar to the existing sentence alignment widget)

We can hardcode this for now and revisit an ATLAS metadata setting in the future

jacobwegner commented 4 years ago

@paltman I updated the data on the ATLAS endpoint at https://explorehomer-spike-duca-8mwdty.herokuapp.com/graphql/

Here is an illustration (does not have the complete query structure you'll need, but hopefully the gist):

Sample query

{
  textAlignmentChunks(reference: "urn:cts:greekLit:tlg0012.tlg001.perseus-grc2:1.1-1.10", alignment_Slug: "iliad-sentence-alignment") {
    metadata {
      passageReferences
    }
    edges {
      node {
        relations {
          edges {
            node {
              tokens {
                edges {
                  node {
                    veRef
                    wordValue
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

returns

{
  "data": {
    "textAlignmentChunks": {
      "metadata": {
        "passageReferences": [
          "urn:cts:greekLit:tlg0012.tlg001.perseus-grc2:1.1-1.10",
          "urn:cts:greekLit:tlg0012.tlg001.perseus-eng3:1.1"
        ]
      },
      "edges": [
        {
          "node": {
            "relations": {
              "edges": [
                {
                  "node": {
                    "tokens": {
                      "edges": [
                        {
                          "node": {
                            "veRef": "1.1.t1",
                            "wordValue": "μῆνιν"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t2",
                            "wordValue": "ἄειδε"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t3",
                            "wordValue": "θεὰ"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t4",
                            "wordValue": "Πηληϊάδεω"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t5",
                            "wordValue": "Ἀχιλῆος"
                          }
                        }
                      ]
                    }
                  }
                },
                {
                  "node": {
                    "tokens": {
                      "edges": [
                        {
                          "node": {
                            "veRef": "1.1.t1",
                            "wordValue": "The"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t2",
                            "wordValue": "wrath"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t3",
                            "wordValue": "sing"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t4",
                            "wordValue": "goddess"
                          }
                        },
                        {
                          "node": {
                            "veRef": "1.1.t5",
                            "wordValue": "of"
                          }
                        }
                      ]
                    }
                  }
                }
              ]
            }
          }
        },
      ]
    }
  }
}

My thinking is that you could use this to recreate something similar to what we have in the current "sentence alignment" display mode, which is blob based.

You would likely still need to query passageTextParts to get the text part refs, but each textAlignmentChunks.edges.node would be the "break", rather then breaking per text-part.

You can actually A / B with the "old" sentence alignments by toggling display modes if that is helpful. (I've left the "old" data in the deployment)

Old: image

New: image

paltman commented 4 years ago

I'm actually getting something different for:

          textAlignmentChunks(reference: $urn, alignment_Slug: $alignmentSlug) {
              metadata {
                passageReferences
              }
              edges {
                node {
                  id
                  relations {
                    edges {
                      node {
                        id
                        tokens {
                          edges {
                            node {
                              id
                              veRef
                              wordValue
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
Screen Shot 2020-09-01 at 11 29 37 AM
jacobwegner commented 4 years ago

@paltman can you double check that your query matches this sample (on the new endpoint)?

https://tinyurl.com/y54egvax

It looks like from your screenshot that you are passing the iliad-word-alignment slug, and the sample query is passing iliad-sentence-alignment

paltman commented 4 years ago

@jacobwegner sentence alignment are already broken up though so I'm confused by what to do if we are not doing word alignments with this.

jacobwegner commented 4 years ago

To fetch the text part refs you could either do:

A

{
  textAlignmentChunks(reference: "urn:cts:greekLit:tlg0012.tlg001.perseus-grc2:1.1-1.7", alignment_Slug: "iliad-sentence-alignment") {
    metadata {
      passageReferences
    }
    edges {
      node {
        id
        relations {
          edges {
            node {
              id
              tokens {
                edges {
                  node {
                    id
                    veRef
                    wordValue
                    textPart {
                      ref
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

or B:

{
  passageTextParts(reference: "urn:cts:greekLit:tlg0012.tlg001.perseus-grc2:1.1-1.7") {
    edges {
      node {
        id
        ref
        tokens {
          edges {
            node {
              id
            }
          }
        }
      }
    }
  }
}