Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Page Properties
hiddentrue
idPROGRESSDONE

Product Version
Report Note
Assignee

Resources & Remarks

Modification History

NameDateProduct VersionAction
Antje11 JUN 20212021 SummerPage created and writing started.
Agnieszka26 JUL 20212021 SummerrLANG



Excerpt

This example tutorial provides explanations and code examples to get an idea on how to define and specify structured data properties and on how to query them.


Section
bordertrue


Column

Table of Contents

Table of Contents
maxLevel3
exclude(Table of Contents|Read on|Another Tutorial|Another Concept Article|Another interesting TutorialManaging the Schema|Importing Documents via Core API|Search Query Language)


Introduction

yuuvis® Momentum offers a property type for the storage of structured data in JSON format. Thus, it is possible to store interleaved data structures in a queryable way without defining each single sub-property in the schema. The structured data properties should NOT be considered to replace the concept of a well-defined schema. They should be used only if the handling of objects' metadata via the conventional property definitions is not reasonable. Especially, if the structure of metadata and/or the availability of properties differs a lot for the individual object instances, the schema might grow up to a really long list of scarcely used properties. This can be avoided by the usage of a property field that can store a JSON structure as value. In this tutorial, the registration bibliographic information of media in a library is considered an example use case. For this purpose, the set of information for each medium is provided in JSON structure following the concept of BibJSON.

>> Code examples in GitHub

Requirements

This tutorial is dedicated to experienced users. Please find information on requirements, maven and client configuration in our "Importing Documents via Core API" tutorial, on which the variables' names are based. The handling of any IOException is demonstrated there, too.

Definition in the Schema

In the context of the library example, the below displayed app schema is used that . It contains two property definitions and one object type definition referencing the properties. The first property bibjsonsample:bibjson has the property type structureddata. Its id matches the expression expected for the validation and the cardinality is single which is the only accepted value.
>> Structured Data Properties

This property will be used for the storage of the BibJSON structure containing the registration bibliographic information of the corresponding medium. The second property bibjsonsample:locations allows for the assignment of a list of strings indicating storage locations if a printed version is available for the corresponding medium. In the object type definition of bibjsonsample:medium, both properties are referenced. Additionally, a binary content file can be assigned if necessary as defined in line 25 with the value allowed for the contentStreamAllowed attribute.

Code Block
languagexml
titleExample Schema
linenumberstrue
collapsetrue
<?xml version="1.0" encoding="utf-8"?>
<schema xmlns="http://optimal-systems.org/ns/dmscloud/schema/v5.0/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://optimal-systems.org/ns/dmscloud/schema/v5.0/ dmsCloud-schema.xsd">

    <propertyStructuredDataDefinition>
        <id>bibjsonsample:bibjson</id>
        <description>field for the BibJSON structure identifying and describing the medium</description>
        <propertyType>structureddata</propertyType>
        <cardinality>single</cardinality>
        <required>false</required>
    </propertyStructuredDataDefinition>
    <propertyStringDefinition>
        <id>bibjsonsample:locations</id>
        <description>field for storage locations of printed versions of the medium</description>
        <propertyType>string</propertyType>
        <cardinality>multi</cardinality>
        <required>false</required>
    </propertyStringDefinition>
    <typeDocumentDefinition>
        <id>bibjsonsample:medium</id>
        <baseId>system:document</baseId>
        <propertyReference>bibjsonsample:bibjson</propertyReference>
        <propertyReference>bibjsonsample:locations</propertyReference>
        <contentStreamAllowed>allowed</contentStreamAllowed>
    </typeDocumentDefinition>

</schema>

...

The schema for the bibjsonsample app is imported via the POST /api/system/apps/{app}/schema endpoint.

More details and further examples on schema handling are provided in the following tutorial:
>> Managing the Schema

Specifying Values during Import

Two example objects will be created as instances of the object type abbBibjsonsample:medium object type. Both of them get are assigned a BibJSON value for the property appbibjsonsample:bibjson assigned to them.The first object is a book. In addition to the property.
>> Structured Data in Import Bodies

For the individual sub-values of the structured data property, the system can identify integers, booleans and strings. The successfully executed import returns the entire set of metadata for each object, enriched with the system properties.

The first example object is a book. The bibliographic information stored in the property appbibjsonsample:bibjson appBibjsonsample:bibjson property contains one integer value specified in line 21. All other sub-values are stored as strings. In addition to the appBibjsonsample:bibjson property, two storage locations for printed versions are specified.

Code Block
languageyml
titleimport request bookImport Request for a Book
linenumberstrue
collapsetrue
{
  "objects": [{
    "properties": {
      "objectTypeId": {
        "value": "appBibjsonsample:medium"
      },
      "appBibjsonsample:bibjson": {
        "value": {
          "type": "book",
          "title": "My Book Title",
          "author": [
            {"name": "Heinrich Schuetzel"},
            {"name": "Maximilian Sturz"}
          ],
          "year": "1995",
          "owner": "My Library",
          "id": "ID_of_book",
          "url": "http://mylibrary.com/ebooks/36513466534",
          "publisher": "Example Verlag Mustershagen",
          "edition": {
            "number": 2,
            "language": "English"
          },
          "identifier":[
            {
              "id": "0002-9327",
              "type": "issn"
            }
          ]
        }
      },
      "appBibjsonsample:locations": {
        "value": [
          "central library, CN-3214-5324",
          "branch library east, 43-654b"
        ]
      }
    }
  }]
}

...


Code Block
languageyml
titleimport request collectionImport Response for a Book
linenumberstrue
collapsetrue
{
    "objects": [
        {
    "properties": {       "objectTypeIdproperties": {
        "value": "appBibjsonsample:medium"
         "system:objectId": {
    },       "appBibjsonsample:bibjson": {         "value": {"aab2b4d9-e829-45dd-981a-2f19a688592d"
          "metadata": {     },
       "collection": "ym_concepts",        "system:baseTypeId": {
   "label": "yuuvis(R) Momentum Core Concepts",             "descriptionvalue": "Documentationsystem:document"
for yuuvis(R) Momentum Core in a structured, theoretical way, with links to the tutorial section.",  },
          "id": "ID_of_collection",     "system:objectTypeId": {
      "owner": "OS",             "createdvalue": "2020-06-09T15:04:12.944771",appBibjsonsample:medium"
               "modified": "2021-06-10T11:05:17.166993" },
            "source    "system:createdBy": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/-4BkAg", {
                    "recordsvalue": 2"275c826c-6a61-4e89-9512-8d935a1631e5"
                },
          "records": [     "system:creationDate": {
      {               "collectionvalue": "ym_concepts",2021-06-14T13:10:52.280Z"
               "type": "article", },
                "title"system: "Schema - Defining Object Types",lastModifiedBy": {
                    "idvalue": "ID_of_schema_article",275c826c-6a61-4e89-9512-8d935a1631e5"
               "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/AYFkAg", },
                "authorsystem:lastModificationDate":[ {
                    {"namevalue": "Heinrich Schuetzel"2021-06-14T13:10:52.280Z"
                },
                {"namesystem:versionNumber": "George Trader"},{
                    {"namevalue": "Johann Fluss"}1
                ]},
                "createdsystem:tenant": "2020-06-09T15:04:12.944771", {
                    "modifiedvalue": "2021-06-10T08:53:23.532949default"
            },    },
        {        "system:traceId": {
     "collection": "ym_concepts",
              "typevalue": "article5681d3bddb4279de",
               "title": "Search Query Language", },
                "idappBibjsonsample:bibjson": "ID_of_query_article",{
              "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/gIFkAg",      "value": {
       "author":[                 {"nametype": "book"Andrea Schumann"},,
                        {"nametitle": "FranzMy Book LissnerTitle"},
                      {  "nameauthor": "Hans Kammer"}, [
                            {"name": "Johann Fluss"}
                 ],               "createdname": "2020-06-16T14:03:01.833660",Heinrich Schuetzel"
              "modified": "2021-06-02T09:54:12.643040"             },
                            ]{
        }       }     }   }]
}

The successfully executed import returns the entire sets of metadata for each object, enriched with the system properties.

Code Block
languageyml
titleimport reaponse book
linenumberstrue
collapsetrue
{         "objectsname": ["Maximilian Sturz"
       {             "properties": {       }
         "system:objectId": {              ],
      "value": "aab2b4d9-e829-45dd-981a-2f19a688592d"                 }"year": "1995",
                "system:baseTypeId": {       "owner": "My Library",
           "value": "system:document"             "id": "ID_of_book",
       },                 "systemurl":objectTypeId "http: {//mylibrary.com/ebooks/36513466534",
                        "valuepublisher": "appBibjsonsample:medium"Example Verlag Mustershagen",
                },        "edition":  {
      "system:createdBy": {                     "valuenumber": "275c826c-6a61-4e89-9512-8d935a1631e5"
    2,
           },                 "system:creationDatelanguage": {"English"
                    "value": "2021-06-14T13:10:52.280Z"   },
             },           "identifier": [
    "system:lastModifiedBy": {                     "value": "275c826c-6a61-4e89-9512-8d935a1631e5"
 {
               },                 "system:lastModificationDateid": {"0002-9327",
                    "value": "2021-06-14T13:10:52.280Z"           "type": "issn"
    },                 "system:versionNumber": {        }
            "value": 1           ]
     },                 "system:tenant": {}
                     "value": "default"
                },
                "systemappBibjsonsample:traceIdlocations": {
                    "value": "5681d3bddb4279de"[
                },        "central library, CN-3214-5324",
      "appBibjsonsample:bibjson": {                 "branch library east,  "value": {43-654b"
                         "type": "book",]
                }
         "title": "My Book Title",}
        }
            ]
}

The second example object is a collection of articles without corresponding printed versions. The structure of the JSON value for the appBibjsonsample:bibjson property looks completely different.

Code Block
languageyml
titleImport Request for a Collection
linenumberstrue
{
  "authorobjects": [{
    "properties": {
      "objectTypeId": {
        "value": "appBibjsonsample:medium"
    {  },
      "appBibjsonsample:bibjson": {
        "value": {
            "namemetadata": {
"Heinrich Schuetzel"           "collection": "ym_concepts",
            "label": "yuuvis(R) Momentum Core }Concepts",
            "description": "Documentation for yuuvis(R) Momentum Core in a structured, theoretical way, with links to the tutorial {section.",
               "id": "ID_of_collection",
                "nameowner": "Maximilian SturzOS",
            "created": "2020-06-09T15:04:12.944Z",
            "modified":  }"2021-06-10T11:05:17.166Z",
            "source": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/Concepts",
           ], "records": 2
           },
          "yearrecords": "1995",[
            {
              "ownercollection": "My Libraryym_concepts",
              "type": "article",
        "id      "title": "ID_of_book",Schema - Defining Object Types",
              "id": "ID_of_schema_article",
              "urllink": "httphttps://mylibraryhelp.optimal-systems.com/ebooks/36513466534/yuuvis_develop/display/YMY/Schema+-+Defining+Object+Types",
              "author":[
         "publisher": "Example Verlag Mustershagen",    {"name": "Heinrich Schuetzel"},
                  {"editionname": {
"George Trader"},
                {"name":           "number": 2,"Johann Fluss"}
              ],
              "languagecreated": "English"2020-06-09T15:04:12.944Z",
               "modified": "2021-06-10T08:53:23.532Z"
            },
            {
              "identifiercollection": ["ym_concepts",
              "type": "article",
               {
 "title": "Search Query Language",
              "id": "ID_of_query_article",
              "idlink": "0002-9327https://help.optimal-systems.com/yuuvis_develop/display/YMY/Search+Query+Language",
              "author":[
                 {"typename": "issnAndrea Schumann"},
                {"name": "Franz Lissner"},
         }       {"name":   "Hans Kammer"},
              ]     {"name": "Johann Fluss"}
              ],
}                 }"created": "2020-06-16T14:03:01.833Z",
              "modified":  "appBibjsonsample:locations": {"2021-06-02T09:54:12.643Z"
            }
         "value": []
        }
      }
    }
  }]
"central library, CN-3214-5324",}


Code Block
titleImport Response for a Collection
linenumberstrue
{
    "objects": [
        {
            "properties": {
  "branch library east, 43-654b"           "system:objectId": {
        ]            "value": "3d4a67be-3341-4317-bb57-c48ea7ab0a1a"
   }             },
        }     ] }
Code Block
languageyml
titleimport response collection
linenumberstrue
collapsetrue
{     "objects"system:baseTypeId": [{
        {            "value": "properties": {system:document"
                },
                "system:objectIdobjectTypeId": {
                    "value": "3d4a67be-3341-4317-bb57-c48ea7ab0a1aappBibjsonsample:medium"
                },
                "system:baseTypeIdcreatedBy": {
                    "value": "system:document275c826c-6a61-4e89-9512-8d935a1631e5"
                },
                "system:objectTypeIdcreationDate": {
                    "value": "appBibjsonsample:medium2021-06-14T13:11:57.770Z"
                },
                "system:createdBylastModifiedBy": {
                    "value": "275c826c-6a61-4e89-9512-8d935a1631e5"
                },
                "system:creationDatelastModificationDate": {
                    "value": "2021-06-14T13:11:57.770Z"
                },
                "system:lastModifiedByversionNumber": {
                    "value": "275c826c-6a61-4e89-9512-8d935a1631e5"1
                },
                "system:lastModificationDatetenant": {
                    "value": "2021-06-14T13:11:57.770Zdefault"
                },
                "system:versionNumbertraceId": {
                    "value": 1"22839c5775801e9c"
                },
                "systemappBibjsonsample:tenantbibjson": {
                    "value": "default"
{
               },         "metadata": {
      "system:traceId": {                     "valuecollection": "22839c5775801e9cym_concepts",
                },                 "appBibjsonsample:bibjson"label": {"yuuvis(R) Momentum Core Concepts",
                 "value": {          "description": "Documentation for yuuvis(R) Momentum Core in a structured, theoretical way, with links to the tutorial section."metadata":,
{                             "collectionid": "ymID_of_conceptscollection",
                            "labelowner": "yuuvis(R) Momentum Core ConceptsOS",
                            "descriptioncreated": "Documentation for yuuvis(R) Momentum Core in a structured, theoretical way, with links to the tutorial section.2020-06-09T15:04:12.944Z",
                            "modified": "2021-06-10T11:05:17.166Z",
                            "idsource": "ID_of_collectionhttps://help.optimal-systems.com/yuuvis_develop/display/YMY/x/-4BkAg",
                            "ownerrecords": "OS", 2
                        },
                        "createdrecords": "2020-06-09T15:04:12.944771",[
                            {
  "modified": "2021-06-10T11:05:17.166993",                             "sourcecollection": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/-4BkAgym_concepts",
                            "records": 2   "type": "article",
                    },            "title": "Schema - Defining Object Types",
       "records": [                          "id": "ID_of_schema_article",
  {                                 "collectionlink": "ym_conceptshttps://help.optimal-systems.com/yuuvis_develop/display/YMY/x/AYFkAg",
                                "typeauthor": "article", [
                                    {
  "title": "Schema - Defining Object Types",                                 "idname": "ID_of_schema_article",Heinrich Schuetzel"
                                 "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/AYFkAg"   },
                                "author": [   {
                                 {       "name": "George Trader"
                               "name": "Heinrich Schuetzel"   },
                                 },   {
                                 {       "name": "Johann Fluss"
                               "name": "George Trader"   }
                                 }],
                                "created": "2020-06-09T15:04:12.944Z",
  {                              "modified": "2021-06-10T08:53:23.532Z"
         "name": "Johann Fluss"                 },
                   }         {
                       ],         "collection": "ym_concepts",
                      "created          "type": "2020-06-09T15:04:12.944771article",
                                "modifiedtitle": "2021-06-10T08:53:23.532949"Search Query Language",
                               } "id": "ID_of_query_article",
                            {    "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/gIFkAg",
                                "collectionauthor": "ym_concepts", [
                                    {
      "type": "article",                                 "titlename": "SearchAndrea QuerySchumann"
Language",                                 "id": "ID_of_query_article"   },
                                "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/gIFkAg",   {
                             "author": [          "name": "Franz Lissner"
                        {            },
                            "name": "Andrea Schumann"      {
                              },          "name": "Hans Kammer"
                        {            },
                            "name": "Franz Lissner"      {
                              },          "name": "Johann Fluss"
                        {             }
                           "name": "Hans Kammer"   ],
                                 }"created": "2020-06-16T14:03:01.833Z",
                                    {
                                        "name": "Johann Fluss""modified": "2021-06-02T09:54:12.643Z"
                                     }
   
                            ],
                    }
           "created": "2020-06-16T14:03:01.833660",    }
            }
        }
      "modified": "2021-06-02T09:54:12.643040"
         ]
}

Search Queries

The individual sub-values within the JSON value for the appBibjsonsample:bibjson property are queryable.
>> Queries on Structured Data

In this chapter, some example search queries are explained.

Example 1

This query statement requests a search for all objects of type appBibjsonsample:medium. The full set of metadata will be returned for each of them. In the example context of this tutorial, only two objects match the query: The book and the collection that were imported before.

Code Block
languagesql
SELECT * FROM appBibjsonsample:medium


Code Block
titleRequest Body
linenumberstrue
{
    "objects": [
        {
          }  "properties": {
                "system:traceId": {
   ]                 "value": "5681d3bddb4279de"
  }              },
  }             } "system:objectTypeId": {
      }     ] }

Search Queries

The individual sub-fields within the JSON value for the property appbibjsonsample:bibjson are queryable. In this chapter, some example search queries are explained.

All objects of type medium.

Code Block
languagesql
SELECT * FROM appBibjsonsample:medium
Code Block
languageyml
titlerequest body
linenumberstrue
collapsetrue
{     "objectsvalue": ["appBibjsonsample:medium"
        {        },
    "properties": {                 "system:traceId"appBibjsonsample:bibjson": {
                    "value": "5681d3bddb4279de"{
                },           "type": "book",
     "system:objectTypeId": {                     "valuetitle": "appBibjsonsample:medium"My Book  Title",
             },                 "appBibjsonsample:bibjson": {
                    "value": {
                        "type": "book",
                        "title": "My Book Title",
                        "author": "author": [
                            {
                                "name": "Heinrich Schuetzel"
                            },
                            {
                                "name": "Maximilian Sturz"
                            }
                        ],
                        "year": "1995",
                        "owner": "My Library",
                        "id": "ID_of_book",
                        "url": "http://mylibrary.com/ebooks/36513466534",
                        "publisher": "Example Verlag Mustershagen",
                        "edition": {
                            "number": 2,
                            "language": "English"
                        },
                        "identifier": [
                            {
                                "id": "0002-9327",
                                "type": "issn"
                            }
                        ]
                    }
                },
                "system:versionNumber": {
                    "value": 1
                },
                "system:createdBy": {
                    "value": "275c826c-6a61-4e89-9512-8d935a1631e5"
                },
                "system:creationDate": {
                    "value": "2021-06-14T13:10:52.280Z"
                },
                "system:lastModificationDate": {
                    "value": "2021-06-14T13:10:52.280Z"
                },
                "system:baseTypeId": {
                    "value": "system:document"
                },
                "system:tenant": {
                    "value": "default"
                },
                "appBibjsonsample:locations": {
                    "value": [
                        "central library, CN-3214-5324",
                        "branch library east, 43-654b"
                    ]
                },
                "system:lastModifiedBy": {
                    "value": "275c826c-6a61-4e89-9512-8d935a1631e5"
                },
                "system:objectId": {
                    "value": "aab2b4d9-e829-45dd-981a-2f19a688592d"
                }
            }
        },
        {
            "properties": {
                "system:traceId": {
                    "value": "22839c5775801e9c"
                },
                "system:objectTypeId": {
                    "value": "appBibjsonsample:medium"
                },
                "appBibjsonsample:bibjson": {
                    "value": {
                        "metadata": {
                            "collection": "ym_concepts",
                            "label": "yuuvis(R) Momentum Core Concepts",
                            "description": "Documentation for yuuvis(R) Momentum Core in a structured, theoretical way, with links to the tutorial section.",
                            "id": "ID_of_collection",
                            "owner": "OS",
                            "created": "2020-06-09T15:04:12.944771944Z",
                            "modified": "2021-06-10T11:05:17.166993166Z",
                            "source": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/-4BkAg",
                            "records": 2
                        },
                        "records": [
                            {
                                "collection": "ym_concepts",
                                "type": "article",
                                "title": "Schema - Defining Object Types",
                                "id": "ID_of_schema_article",
                                "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/AYFkAg",
                                "author": [
                                    {
                                        "name": "Heinrich Schuetzel"
                                    },
                                    {
                                        "name": "George Trader"
                                    },
                                    {
                                        "name": "Johann Fluss"
                                    }
                                ],
                                "created": "2020-06-09T15:04:12.944771944Z",
                                "modified": "2021-06-10T08:53:23.532949532Z"
                            },
                            {
                                "collection": "ym_concepts",
                                "type": "article",
                                "title": "Search Query Language",
                                "id": "ID_of_query_article",
                                "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/gIFkAg",
                                "author": [
                                    {
                                        "name": "Andrea Schumann"
                                    },
                                    {
                                        "name": "Franz Lissner"
                                    },
                                    {
                                        "name": "Hans Kammer"
                                    },
                                    {
                                        "name": "Johann Fluss"
                                    }
                                ],
                                "created": "2020-06-16T14:03:01.833660833Z",
                                "modified": "2021-06-02T09:54:12.643040643Z"
                            }
                        ]
                    }
                },
                "system:lastModificationDate": {
                    "value": "2021-06-14T13:11:57.770Z"
                },
                "system:versionNumber": {
                    "value": 1
                },
                "system:baseTypeId": {
                    "value": "system:document"
                },
                "system:tenant": {
                    "value": "default"
                },
                "system:createdBy": {
                    "value": "275c826c-6a61-4e89-9512-8d935a1631e5"
                },
                "system:creationDate": {
                    "value": "2021-06-14T13:11:57.770Z"
                },
                "system:lastModifiedBy": {
                    "value": "275c826c-6a61-4e89-9512-8d935a1631e5"
                },
                "system:objectId": {
                    "value": "3d4a67be-3341-4317-bb57-c48ea7ab0a1a"
                }
            }
        }
    ],
    "numItems": 2,
    "hasMoreItems": false,
    "totalNumItems": 2
}

...

Example 2

In order to return only the bibliographic information in the result list of the search request, select the appBibjsonsample:bibjson property.

Code Block
languagesql
SELECT appBibjsonsample:bibjson FROM appBibjsonsample:medium


Code Block
languageyml
titleresponse bodyRequest Body
linenumberstrue
collapsetrue
{
    "objects": [
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "type": "book",
                        "title": "My Book Title",
                        "author": [
                            {
                                "name": "Heinrich Schuetzel"
                            },
                            {
                                "name": "Maximilian Sturz"
                            }
                        ],
                        "year": "1995",
                        "owner": "My Library",
                        "id": "ID_of_book",
                        "url": "http://mylibrary.com/ebooks/36513466534",
                        "publisher": "Example Verlag Mustershagen",
                        "edition": {
                            "number": 2,
                            "language": "English"
                        },
                        "identifier": [
                            {
                                "id": "0002-9327",
                                "type": "issn"
                            }
                        ]
                    }
                }
            }
        },
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "metadata": {
                            "collection": "ym_concepts",
                            "label": "yuuvis(R) Momentum Core Concepts",
                            "description": "Documentation for yuuvis(R) Momentum Core in a structured, theoretical way, with links to the tutorial section.",
                            "id": "ID_of_collection",
                            "owner": "OS",
                            "created": "2020-06-09T15:04:12.944771944Z",
                            "modified": "2021-06-10T11:05:17.166993166Z",
                            "source": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/-4BkAg",
                            "records": 2
                        },
                        "records": [
                            {
                                "collection": "ym_concepts",
                                "type": "article",
                                "title": "Schema - Defining Object Types",
                                "id": "ID_of_schema_article",
                                "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/AYFkAg",
                                "author": [
                                    {
                                        "name": "Heinrich Schuetzel"
                                    },
                                    {
                                        "name": "George Trader"
                                    },
                                    {
                                        "name": "Johann Fluss"
                                    }
                                ],
                                "created": "2020-06-09T15:04:12.944771944Z",
                                "modified": "2021-06-10T08:53:23.532949532Z"
                            },
                            {
                                "collection": "ym_concepts",
                                "type": "article",
                                "title": "Search Query Language",
                                "id": "ID_of_query_article",
                                "link": "https://help.optimal-systems.com/yuuvis_develop/display/YMY/x/gIFkAg",
                                "author": [
                                    {
                                        "name": "Andrea Schumann"
                                    },
                                    {
                                        "name": "Franz Lissner"
                                    },
                                    {
                                        "name": "Hans Kammer"
                                    },
                                    {
                                        "name": "Johann Fluss"
                                    }
                                ],
                                "created": "2020-06-16T14:03:01.833660833Z",
                                "modified": "2021-06-02T09:54:12.643040643Z"
                            }
                        ]
                    }
                }
            }
        }
    ],
    "numItems": 2,
    "hasMoreItems": false,
    "totalNumItems": 2
}

...

Example 3

It is even possible to return specified sub-values of the JSON structure stored in the appBibjsonsample:bibjson property. If you specify an index within a list, the values for the list elements with lower indices will be replaced by null in the return statement as can be seen in line 9.

Code Block
languagesql
SELECT appBibjsonsample:bibjson.title,appBibjsonsample:bibjson.author[1].name,appBibjsonsample:bibjson.metadata.id FROM appBibjsonsample:medium


Code Block
languageyml
titleresponse bodyRequest Body
linenumberstruecollapsetrue
{
    "objects": [
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "title": "My Book Title",
                        "author": [
                            null,
                            {
                                "name": "Maximilian Sturz"
                            }
                        ]
                    }
                }
            }
        },
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "metadata": {
                            "id": "ID_of_collection"
                        }
                    }
                }
            }
        }
    ],
    "numItems": 2,
    "hasMoreItems": false,
    "totalNumItems": 2
}

...

Example 4

If you know the path of the sub-value within the JSON you want to query, you can directly specify it. The example query configures a search for a specific medium identified by its bibliographic ID.

Code Block
languagesql
SELECT appBibjsonsample:bibjson.metadata.idtitle FROM appBibjsonsample:medium WHERE appBibjsonsample:bibjson.*id = 'ID_of_schema_articlebook'


Code Block
languageyml
titleresponse bodyRequest Body
linenumberstruecollapsetrue
{
    "objects": [
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "metadatatitle": {"My Book   Title",
                        "idauthor": "ID_of_collection"[
                            null,
        }                    {
}                 }             }  "name": "Maximilian Sturz"
    }     ],     "numItems": 1,     "hasMoreItems": false,     "totalNumItems": 1 }

Search within a list and usage of CONTAINS

Code Block
languagesql
SELECT appBibjsonsample:bibjson.title FROM appBibjsonsample:medium WHERE appBibjsonsample:bibjson.author[*].name CONTAINS('Sturz')
Code Block
languageyml
titleresponse body
linenumberstrue
collapsetrue
{
            "objects": [         {  ]
          "properties": {         }
       "appBibjsonsample:bibjson": {        }
            "value":}
{        }
    ],
    "numItems": 1,
     "titlehasMoreItems": "My Book Title"false,
                     }
                }"totalNumItems": 1
}

Example 5

If you want to search for an object with a specific sub-value but unknown path, a * wildcard can be used. Each object containing the string ID_of_schema_article as a sub-value for the appBibjsonsample:bibjson property will match the query.

Code Block
languagesql
SELECT appBibjsonsample:bibjson.metadata.id FROM appBibjsonsample:medium WHERE appBibjsonsample:bibjson.* = 'ID_of_schema_article'


Code Block
titleRequest Body
linenumberstrue
{
    "objects": [
        {
     }       "properties": {
}     ],     "numItems": 1,     "hasMoreItemsappBibjsonsample:bibjson": false,{
      "totalNumItems": 1 }

Search within the records of collections

Code Block
languagesql
SELECT appBibjsonsample:bibjson.records.title,appBibjsonsample:bibjson.metadata.id FROM appBibjsonsample:medium WHERE appBibjsonsample:bibjson.records[*].created IN LASTYEAR()
Code Block
languageyml
titleresponse body
linenumberstrue
collapsetrue
{     "objectsvalue": [],{
                        "numItemsmetadata": 0, {
                      "hasMoreItems": false,     "totalNumItemsid": 0
}

Summary

"ID_of_collection"
                        }
                    }
                }
            }
        }
    ],
    "numItems": 1,
    "hasMoreItems": false,
    "totalNumItems": 1
}

Example 6

The * wildcard can also be used instead of a specific index within a list. Thus, the condition will be checked for each list entry. Furthermore, full-text search with CONTAINS is possible in case of string sub-values.

Code Block
languagesql
SELECT appBibjsonsample:bibjson.title FROM appBibjsonsample:medium WHERE appBibjsonsample:bibjson.author[*].name CONTAINS('Sturz')


Code Block
titleRequest Body
linenumberstrue
{
    "objects": [
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "title": "My Book Title"
                    }
                }
            }
        }
    ],
    "numItems": 1,
    "hasMoreItems": false,
    "totalNumItems": 1
}

Example 7

Use .. in order to replace unknown parts of a path. The query below specifies a search for objects where the appBibjsonsample:bibjson property contains Schuetzel in the value for the author[*].name key which can be located at any hierarchical level within the JSON. Furthermore, only key-value mappings for keys named id will be displayed in the response body.

Code Block
languagesql
SELECT appBibjsonsample:bibjson..id FROM appBibjsonsample:medium WHERE appBibjsonsample:bibjson..author[*].name CONTAINS('Schuetzel')


Code Block
titleRequest Body
linenumberstrue
{
    "objects": [
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "id": "ID_of_book",
                        "identifier": [
                            {
                                "id": "0002-9327"
                            }
                        ]
                    }
                }
            }
        },
        {
            "properties": {
                "appBibjsonsample:bibjson": {
                    "value": {
                        "metadata": {
                            "id": "ID_of_collection"
                        },
                        "records": [
                            {
                                "id": "ID_of_schema_article"
                            },
                            {
                                "id": "ID_of_query_article"
                            }
                        ]
                    }
                }
            }
        }
    ],
    "numItems": 2,
    "hasMoreItems": false,
    "totalNumItems": 2
}

Summary

The structureddata property type allows for the storage of interleaved data structures in a queryable way without defining each single sub-property in the schema. This tutorial gave some explanations on how to define such a property in the schema, how to set a value during object creation and how to address the individual sub-values in search queries, in the example context of a library.

>> Code examples in GitHub

Info
iconfalse

Read on

Section


Column
width25%

...

Another Tutorial

...

Managing the Schema

Insert excerpt
Managing the Schema
Managing the Schema
nopaneltrue
 Keep reading


Column
width25%

Another Concept Article

Importing Documents via Core API

Insert excerpt
Importing Documents via Core API
Importing Documents via Core API
nopaneltrue
 Keep reading


Column
width25%

...

Another interesting Tutorial

...

Search Query Language

Insert excerpt
Search Query Language
Search Query Language
nopaneltrue
 Keep reading