{"id":1329,"date":"2021-01-24T17:41:46","date_gmt":"2021-01-24T16:41:46","guid":{"rendered":"https:\/\/smartdatamodels.org\/?page_id=1329"},"modified":"2023-09-15T08:28:58","modified_gmt":"2023-09-15T06:28:58","slug":"draft-a-data-model","status":"publish","type":"page","link":"https:\/\/smartdatamodels.org\/index.php\/draft-a-data-model\/","title":{"rendered":"Draft a data model"},"content":{"rendered":"<p>Steps to create your new data model in json schema<\/p>\n<p>Supposedly you know how many fields you want your data model to have and what data types they would be.<\/p>\n<p>1.- Copy this text<\/p>\n<div class=\"su-accordion su-u-trim\"><div class=\"su-spoiler su-spoiler-style-default su-spoiler-icon-plus su-spoiler-closed\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-spoiler-title\" tabindex=\"0\" role=\"button\"><span class=\"su-spoiler-icon\"><\/span>click on the plus<\/div><div class=\"su-spoiler-content su-u-clearfix su-u-trim\">\n<pre>\/\/ Instructions for creating your schema\r\n\/\/ 1.- respect the HEADER\r\n\/\/ 2.- there are 8 types of examples field1XXX to field9XXX\r\n\/\/ HEADER ***Do not change any of these till next warning***\r\n$schema =   http:\/\/json-schema.org\/schema\r\n$schemaVersion = 0.0.1\r\n$id = https:\/\/smart-data-models.github.io\/XXXSubjectXXX\/XXXDataModelXXX\/schema.json\r\ntitle = Smart Data models -XXXdataModelXXX schema\"\r\nmodelTags = \"\"\r\ndescription = description of a generic entity. You have to change this.\r\ntype = object\r\nrequired[] = id, type\r\nallOf[0]\r\n  $ref=https:\/\/smart-data-models.github.io\/data-models\/common-schema.json#\/definitions\/GSMA-Commons\r\nallOf[1]\r\n  $ref=https:\/\/smart-data-models.github.io\/data-models\/common-schema.json#\/definitions\/Location-Commons\r\n\/\/ HEADER  ***this is the end of the header ***\r\n\/\/ you can start configuring this \r\nallOf[2]\r\n  properties\r\n\r\n\/\/ Create a numeric attribute\r\n    field1XXX\r\n      type = number\r\n      minimum number = 0\r\n      maximum number = 1\r\n      description = Property. Model:'https:\/\/schema.org\/Number'. Example of definition of a numerical attribute\r\n\r\n\/\/ Create a simple string attribute\r\n    field2XXX\r\n      type = string\r\n      description = Property. Model:'https:\/\/schema.org\/Text'. Example of definition of a numerical attribute\r\n\r\n\/\/ Create a date time attribute\r\n    field3XXX \r\n      type = string\r\n      format = date-time\r\n      description = Property. Model:'https:\/\/schema.org\/Text'. Example of definition of a date-time attribute \r\n\r\n\/\/ Create a relationship\r\n    relationship1XX\r\n      anyOf[0]\r\n        type = string\r\n        minLength number = 1\r\n        maxLength number = 256\r\n        pattern = ^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!,:\\\\]+$\r\n        description = Property. Identifier format of any NGSI entity\r\n      anyOf[1]\r\n         type = string\r\n         format = uri\r\n         description = Property. Identifier format of any NGSI entity\r\n       description = Relationship. Reference to the other entity \r\n\r\n\/\/Create an enumeration of strings\r\n    field4XXX\r\n      type = string\r\n      enum[] s = val1, val2, val3\r\n      description = Property. Model:'https:\/\/schema.org\/Text. Example of definition of a enumeration of strings\r\n\r\n\/\/Create an enumeration of numbers\r\n    field5XXX\r\n      type = string\r\n      enum[] number = 1, 2, 3\r\n      description = Property. Model:'https:\/\/schema.org\/Text. Example of definition of a enumeration of numbers\r\n\r\n\/\/Create an enumeration of an object\r\n    field6XXX\r\n      type = object\r\n      description = Property. Model:'https:\/\/schema.org\/Text. Example of definition of a enumeration of objects\r\n      properties\r\n        subproperty1XXX\r\n          type = string\r\n        subproperty2XXX\r\n          type = number\r\n\r\n\/\/Create an array of strings\r\n    field7XXX\r\n      type = array\r\n      description = Property. Model:'https:\/\/schema.org\/Text. Example of definition of a arrayof strings\r\n      items\r\n        type = string\r\n        minitems number = 3\r\n\r\n\/\/Create an array of numbers\r\n    field8XXX\r\n      type = array\r\n      description = Property. Model:'https:\/\/schema.org\/Text. Example of definition of a array of numbers\r\n      items\r\n        type = number\r\n        minitems number = 1\r\n\r\n\/\/ Create a simple boolean attribute \r\n    field9XXX \r\n      type = boolean\r\n      description = Property. Model:'https:\/\/schema.org\/Boolean'. Example of definition of a boolean attribute\r\n required[] string = id, type\r\n derivedFrom = \"\"\r\n license = \"\"\r\n<\/pre>\n<\/div><\/div><\/div>\n<p>2.- Open in a new window <a href=\"https:\/\/objgen.com\/json\/local\/design\" target=\"_blank\" rel=\"noopener\">this web<\/a>.<br \/>\n3.- Paste the text in the left form and in the right you&#8217;ll have the json schema version.<br \/>\n4.- Modify according to your needs (copy and rename attributes). XXX string helps you to see what should be changed.<br \/>\n5.- You&#8217;ll have the code for your json schema on the right text box.<br \/>\n6.- You can validate in <a href=\"https:\/\/www.jsonschemavalidator.net\/\" target=\"_blank\" rel=\"noopener\">this link<\/a> (paste in the left text box) and you will see the result below. On the right you should paste the example in keyvalues format. (leave emtpy) Better if you use chrome browser.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2641\" src=\"https:\/\/smartdatamodels.org\/wp-content\/uploads\/2021\/06\/validation.png\" alt=\"\" width=\"566\" height=\"87\" srcset=\"https:\/\/smartdatamodels.org\/wp-content\/uploads\/2021\/06\/validation.png 566w, https:\/\/smartdatamodels.org\/wp-content\/uploads\/2021\/06\/validation-300x46.png 300w, https:\/\/smartdatamodels.org\/wp-content\/uploads\/2021\/06\/validation-150x23.png 150w\" sizes=\"auto, (max-width: 566px) 100vw, 566px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Steps to create your new data model in json schema Supposedly you know how many fields you want your data model to have and what data types they would be. 1.- Copy this text 2.- Open in a new window this web. 3.- Paste the text in the left form&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/smartdatamodels.org\/index.php\/draft-a-data-model\/\">More&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/template-onecolumn.php","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-1329","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":255,"url":"https:\/\/smartdatamodels.org\/index.php\/how-to-use-data-models\/","url_meta":{"origin":1329,"position":0},"title":"How to use data models","author":"maestro","date":"03\/04\/2020","format":false,"excerpt":"Simple user: Use the csv (comma separated values) like this table, a csv is available in every data model and its specification and explanation in the \/doc\/spec.md that explains the meaning of the fields id type address__addressLocality address__addressCountry atmosphericPressure dataProvider dateObserved location__coordinates precipitation pressureTendency relativeHumidity source stationCode stationName temperature windDirection\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20,"url":"https:\/\/smartdatamodels.org\/index.php\/learning-zone\/","url_meta":{"origin":1329,"position":1},"title":"Learning zone","author":"maestro","date":"17\/03\/2020","format":false,"excerpt":"TEST YOU KNOWLEDGE ABOUT THE INITIATIVE [ays_quiz id='2'] INTRODUCTION TO THE INITIATIVE Frontend and github interface presentation These are our recommendations to encode a data model\u00a0 https:\/\/github.com\/smart-data-models\/data-models\/blob\/master\/guidelines.md Understanding linking elements in data models. Our main page on github https:\/\/github.com\/smart-data-models CREATING YOUR DATA MODEL WITHOUT MUCH TECHNICAL KNOWLEDGE These 3 videos\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/img.youtube.com\/vi\/rqfNEThIx2Q\/0.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":10260,"url":"https:\/\/smartdatamodels.org\/index.php\/metadata-of-the-data-models-catalog-available\/","url_meta":{"origin":1329,"position":2},"title":"Metadata of the data models catalog available","author":"maestro","date":"01\/02\/2024","format":false,"excerpt":"In this link you have all metadata of the catalogue available as a json file. It includes: subject data model version of the data model modelTags title url to $id of the schema description of the data model required attributes yamlUrl link to the yaml version of the schema jsonSchemaUrl\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":948,"url":"https:\/\/smartdatamodels.org\/index.php\/check-a-schema-validates-a-payload\/","url_meta":{"origin":1329,"position":3},"title":"Check a schema validates a payload","author":"maestro","date":"09\/12\/2020","format":false,"excerpt":"Although the service keeps being operative we recommend using this https:\/\/www.jsonschemavalidator.net\/ because it provides more explanations about the errors. If you want to check if a schema validates a payload\u00a0 through this API call Call: https:\/\/smartdatamodels.org\/extra\/validate_payload.php Parameters: (Mandatories) payloadUrl: The url of the payload in RAW version schemaUrl: The link\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3702,"url":"https:\/\/smartdatamodels.org\/index.php\/5-files-for-creating-a-new-data-model\/","url_meta":{"origin":1329,"position":4},"title":"5 files for creating a new data model","author":"maestro","date":"31\/01\/2022","format":false,"excerpt":"Only 5 files are required for submitting a data model through a PR on any of the subjects of the Smart Data Models Program. See the contribution manual and sign the contribution agreement. 1.- The schema with the definitions at the description subattribute. Mandatory schema.json (in JSON schema, contains the\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1829,"url":"https:\/\/smartdatamodels.org\/index.php\/generate-a-ngsi-ld-payload-based-on-a-smart-data-model\/","url_meta":{"origin":1329,"position":5},"title":"Generate a NGSI-LD normalized payload based on a Smart Data Model","author":"maestro","date":"02\/03\/2021","format":false,"excerpt":"This is an alpha version (so you can expect errors and not being complete). Use it at your own risk. Please report them at info@smartdatamodels.org Call: https:\/\/smartdatamodels.org\/extra\/ngsi-ld_generator.php Parameters: (Mandatories) schemaUrl: The link to the RAW version of the json schema (see example) email: your email Example: https:\/\/smartdatamodels.org\/extra\/ngsi-ld_generator.php?schemaUrl=https:\/\/raw.githubusercontent.com\/smart-data-models\/dataModel.Streetlighting\/f56f5a7933ab05d7fce1d5adc0847f25a099cdb4\/StreetlightModel\/schema.json&email=alberto.abella@fiware.org Use any data\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/pages\/1329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/comments?post=1329"}],"version-history":[{"count":190,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/pages\/1329\/revisions"}],"predecessor-version":[{"id":9544,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/pages\/1329\/revisions\/9544"}],"wp:attachment":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/media?parent=1329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}