ietf-tools / bibxml-service

Django-based Web service implementing IETF BibXML APIs
https://bib.ietf.org
BSD 3-Clause "New" or "Revised" License
17 stars 19 forks source link

What does "JSON containment" mean? #415

Open cabo opened 6 months ago

cabo commented 6 months ago

Describe the issue

the page https://bib.ietf.org offers a choice "JSON containment". What does this phrase mean? Where are this and other aspects of the search feature documented?

Code of Conduct

kesara commented 6 months ago

There's a description available. Hidden under Search Help.

Screenshot 2024-05-16 at 12 53 28

JSON containment (json_struct in API) query must be a valid JSON structure, and items containing this structure will match:

{"series": [{"title": {"content": "RFC"}}]}
cabo commented 6 months ago

Thanks. I don't know what a "JSON structure" is, though, and I also have no idea what kind of JSON we are talking about (bib entries are in XML?).

kesara commented 6 months ago

Bibliographic data is stored as JSONb in a PostgreSQL database. That interface allows you to search those entries as JSON queries. As for the structure:

{
  "data": {
    "abstract": {
      "content": "string",
      "format": "string",
      "language": "string",
      "script": "string"
    },
    "biblionote": [
      {
        "content": "string",
        "type": "string"
      }
    ],
    "contributor": [
      {
        "organization": {
          "abbreviation": {
            "content": "string",
            "format": "string",
            "language": "string",
            "script": "string"
          },
          "contact": [
            {
              "address": {
                "city": "string",
                "country": "string",
                "postcode": "string",
                "state": "string",
                "street": [
                  "string"
                ]
              },
              "email": "string",
              "phone": {
                "content": "string",
                "type": "string"
              },
              "uri": "string"
            }
          ],
          "name": [
            {
              "content": "string",
              "format": "string",
              "language": "string",
              "script": "string"
            }
          ],
          "url": "string"
        },
        "person": {
          "affiliation": [
            {
              "organization": {
                "abbreviation": {
                  "content": "string",
                  "format": "string",
                  "language": "string",
                  "script": "string"
                },
                "contact": [
                  {}
                ],
                "name": [
                  {}
                ],
                "url": "string"
              }
            }
          ],
          "contact": [
            {
              "address": {
                "city": "string",
                "country": "string",
                "postcode": "string",
                "state": "string",
                "street": [
                  "string"
                ]
              },
              "email": "string",
              "phone": {
                "content": "string",
                "type": "string"
              },
              "uri": "string"
            }
          ],
          "name": {
            "addition": {
              "content": "string",
              "format": "string",
              "language": "string",
              "script": "string"
            },
            "completename": {
              "content": "string",
              "format": "string",
              "language": "string",
              "script": "string"
            },
            "given": {
              "forename": [
                {
                  "content": "string",
                  "format": "string",
                  "initial": "string",
                  "language": "string",
                  "script": "string"
                }
              ],
              "formatted_initials": {
                "content": "string",
                "format": "string",
                "language": "string",
                "script": "string"
              }
            },
            "prefix": {
              "content": "string",
              "format": "string",
              "language": "string",
              "script": "string"
            },
            "surname": {
              "content": "string",
              "format": "string",
              "language": "string",
              "script": "string"
            }
          }
        },
        "role": [
          {
            "description": [
              {
                "content": "string",
                "format": "string",
                "language": "string",
                "script": "string"
              }
            ],
            "type": "string"
          }
        ]
      }
    ],
    "copyright": [
      {
        "from": 0,
        "owner": [
          {
            "abbreviation": {
              "content": "string",
              "format": "string",
              "language": "string",
              "script": "string"
            },
            "contact": [
              {
                "address": {
                  "city": "string",
                  "country": "string",
                  "postcode": "string",
                  "state": "string",
                  "street": [
                    null
                  ]
                },
                "email": "string",
                "phone": {
                  "content": "string",
                  "type": "string"
                },
                "uri": "string"
              }
            ],
            "name": [
              {
                "content": "string",
                "format": "string",
                "language": "string",
                "script": "string"
              }
            ],
            "url": "string"
          }
        ]
      }
    ],
    "date": [
      {
        "type": "string",
        "value": "string"
      }
    ],
    "docid": [
      {
        "id": "string",
        "primary": true,
        "scope": "string",
        "type": "string"
      }
    ],
    "docnumber": "string",
    "doctype": "string",
    "edition": {
      "content": "string",
      "number": "string"
    },
    "extent": {
      "locality": [
        {
          "reference_from": "string",
          "reference_to": "string",
          "type": "string"
        }
      ]
    },
    "fetched": "2019-08-24",
    "formattedref": {
      "content": "string",
      "format": "string",
      "language": "string",
      "script": "string"
    },
    "keyword": [
      {
        "content": "string"
      }
    ],
    "language": "string",
    "link": [
      {
        "content": "string",
        "type": "string"
      }
    ],
    "place": "string",
    "relation": [
      {
        "bibitem": {},
        "description": {
          "content": "string",
          "format": "string",
          "language": "string",
          "script": "string"
        },
        "type": "string"
      }
    ],
    "revdate": "string",
    "script": "string",
    "series": [
      {
        "abbrev": "string",
        "formattedref": {
          "content": "string",
          "format": "string",
          "language": "string",
          "script": "string"
        },
        "number": "string",
        "organization": "string",
        "partnumber": "string",
        "place": "string",
        "run": "string",
        "title": {
          "content": "string",
          "format": "string",
          "language": "string",
          "script": "string"
        },
        "type": "main"
      }
    ],
    "title": [
      {
        "content": "string",
        "format": "string",
        "language": "string",
        "script": "string",
        "type": "string"
      }
    ],
    "type": "string",
    "version": [
      {
        "draft": "string"
      }
    ]
  }
}

It's from https://bib.ietf.org/api/v1/#operation/getBibItemByDocId

Yes, this should be better documented. And maybe we don't need this kind of complexity.