{"id":7220,"date":"2022-09-28T14:54:28","date_gmt":"2022-09-28T12:54:28","guid":{"rendered":"https:\/\/smartdatamodels.org\/?p=7220"},"modified":"2022-09-28T14:54:28","modified_gmt":"2022-09-28T12:54:28","slug":"release-the-script-for-subjects-context-consolidation","status":"publish","type":"post","link":"https:\/\/smartdatamodels.org\/index.php\/release-the-script-for-subjects-context-consolidation\/","title":{"rendered":"Release the script for subjects&#8217; context consolidation."},"content":{"rendered":"<p>The <a href=\"https:\/\/github.com\/smart-data-models\/data-models\/tree\/master\/utils\">utils<\/a> directory at the <a href=\"https:\/\/github.com\/smart-data-models\/data-models\">data models<\/a> compiles some scripts we use internally.<\/p>\n<p>Now you have available <a href=\"https:\/\/github.com\/smart-data-models\/data-models\/blob\/master\/utils\/context_local_generator_V1.0.py\">a script for consolidating several @contexts from several subjects<\/a>.<\/p>\n<p>It is the script called by the main menu options Home-&gt;tools -&gt; <a href=\"https:\/\/smartdatamodels.org\/index.php\/generate-a-local-context-based-on-smart-data-models-iris\/\">Subjects&#8217; @context merger<\/a><\/p>\n<p><a href=\"https:\/\/smartdatamodels.org\/index.php\/generate-a-local-context-based-on-smart-data-models-iris\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3681\" src=\"https:\/\/smartdatamodels.org\/wp-content\/uploads\/2022\/01\/SmartDataModels_logo.png\" alt=\"\" width=\"180\" height=\"55\" srcset=\"https:\/\/smartdatamodels.org\/wp-content\/uploads\/2022\/01\/SmartDataModels_logo.png 180w, https:\/\/smartdatamodels.org\/wp-content\/uploads\/2022\/01\/SmartDataModels_logo-150x46.png 150w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><\/p>\n<p>the help of the script<\/p>\n<p># This file takes several @contexts and merges them creating two files<br \/>\n# context.jsonld with the elements successfully merged<br \/>\n# and conflicts.json that shows those attributes clashing.<br \/>\n# clashing in conflicts file has to be solved manually<br \/>\n# INPUT PARAMETERS (merge_subjects_context.json, outputToFile)<br \/>\n# parameter merge_subjects_context.json<br \/>\n# it is the full path to a file where the path to the @contexts will be located<br \/>\n# See an example of the file below<br \/>\n# If not provided it merges all subjects in the smart data models program<br \/>\n# {<br \/>\n# &#8220;dataModel.Weather&#8221;: &#8220;https:\/\/raw.githubusercontent.com\/smart-data-models\/dataModel.Weather\/master\/context.jsonld&#8221;,<br \/>\n# &#8220;dataModel.Battery&#8221;: &#8220;https:\/\/raw.githubusercontent.com\/smart-data-models\/dataModel.Battery\/master\/context.jsonld&#8221;,<br \/>\n# &#8220;dataModel.Building&#8221;: &#8220;https:\/\/raw.githubusercontent.com\/smart-data-models\/dataModel.Building\/master\/context.jsonld&#8221;,<br \/>\n# &#8220;dataModel.Device&#8221;: &#8220;https:\/\/raw.githubusercontent.com\/smart-data-models\/dataModel.Device\/master\/context.jsonld&#8221;,<br \/>\n# }<br \/>\n# parameter ouputToFile<br \/>\n# when True it outputs two files conflicts.json and context.jsonld<br \/>\n# conflicts.json stores the conflict in the name of attributes (to be solved manually)<br \/>\n# context.jsonld has the attribute name and the Smart Data Models local IRI<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The utils directory at the data models compiles some scripts we use internally. Now you have available a script for consolidating several @contexts from several subjects. It is the script called by the main menu options Home-&gt;tools -&gt; Subjects&#8217; @context merger the help of the script # This file takes&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/smartdatamodels.org\/index.php\/release-the-script-for-subjects-context-consolidation\/\">More&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[84],"tags":[],"class_list":["post-7220","post","type-post","status-publish","format-standard","hentry","category-governance"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":18419,"url":"https:\/\/smartdatamodels.org\/index.php\/use-smart-data-models-as-a-service-first-draft\/","url_meta":{"origin":7220,"position":0},"title":"Use smart data models as a service. First draft","author":"maestro","date":"04\/06\/2025","format":false,"excerpt":"In the data-models repository you can access to the first version to use smart data models as a service. Thanks to the works for the Cyclops project. The files available create a wrap up around pysmartdatamodels package and also add one service for the online validation of NGSI-LD payloads. Here\u2026","rel":"","context":"In &quot;Cross Sector&quot;","block_context":{"text":"Cross Sector","link":"https:\/\/smartdatamodels.org\/index.php\/category\/cross-sector\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3255,"url":"https:\/\/smartdatamodels.org\/index.php\/local-context-service\/","url_meta":{"origin":7220,"position":1},"title":"Local context service","author":"maestro","date":"22\/10\/2021","format":false,"excerpt":"If you want to use data models coming from several subjects you will have to merge (somehow) their @contexts. In this first step, we offer you a service that allows you to choose what subjects you need to merge and to generate the @context. See the instructions on the page.\u2026","rel":"","context":"In &quot;Cross Sector&quot;","block_context":{"text":"Cross Sector","link":"https:\/\/smartdatamodels.org\/index.php\/category\/cross-sector\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6680,"url":"https:\/\/smartdatamodels.org\/index.php\/new-customization-option-for-context\/","url_meta":{"origin":7220,"position":2},"title":"New customization option for context","author":"maestro","date":"18\/08\/2022","format":false,"excerpt":"The Smart Data Models Program does not define canonically and uniquely the terms used in the data models. There are many ontologies and vocabularies providing solutions to this issue. For those users of linked data solutions, every subject includes a context.jsonld file (see example) with long IRI for the terms\u2026","rel":"","context":"In &quot;Cross Sector&quot;","block_context":{"text":"Cross Sector","link":"https:\/\/smartdatamodels.org\/index.php\/category\/cross-sector\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7671,"url":"https:\/\/smartdatamodels.org\/index.php\/release-source-code-for-some-of-the-services-for-python-developers\/","url_meta":{"origin":7220,"position":3},"title":"Release source code for some of the services. For python developers.","author":"maestro","date":"22\/11\/2022","format":false,"excerpt":"In the tools option of the main menu, there are a few services to help you to use, create and debug your data models. Although working, some of these services are limited. We are releasing the code for some of the services to allow you to contribute with improvments. It\u2026","rel":"","context":"In &quot;Cross Sector&quot;","block_context":{"text":"Cross Sector","link":"https:\/\/smartdatamodels.org\/index.php\/category\/cross-sector\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/smartdatamodels.org\/wp-content\/uploads\/2022\/11\/python-logo-master-v3-TM-flattened-300x101.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":13212,"url":"https:\/\/smartdatamodels.org\/index.php\/new-script-for-testing-several-data-models-at-the-same-time\/","url_meta":{"origin":7220,"position":4},"title":"New script for testing several data models at the same time.","author":"maestro","date":"27\/02\/2025","format":false,"excerpt":"Most of the files of the testing process have been updated and make it available the source code: https:\/\/github.com\/smart-data-models\/data-models\/tree\/master\/test_data_model But also there is a new file multiple_tests.py This file enables you to test all the data models located in a internal subject (subdirectories of the root one). Currently this option\u2026","rel":"","context":"In &quot;Cross Sector&quot;","block_context":{"text":"Cross Sector","link":"https:\/\/smartdatamodels.org\/index.php\/category\/cross-sector\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/smartdatamodels.org\/wp-content\/uploads\/2022\/01\/favicon-300x300.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1641,"url":"https:\/\/smartdatamodels.org\/index.php\/create-your-data-model-with-a-google-spreadsheet\/","url_meta":{"origin":7220,"position":5},"title":"Create your data model with a google spreadsheet","author":"maestro","date":"15\/02\/2021","format":false,"excerpt":"NEW VERSION!! This post became obsolete, go for the new master sheet \u00a0 This is a resource, especially for those who have limited knowledge of JSON schema. If you want to create a basic version of a data model (not all JSON schema is implemented), you can use a copy\u2026","rel":"","context":"In &quot;Cross Sector&quot;","block_context":{"text":"Cross Sector","link":"https:\/\/smartdatamodels.org\/index.php\/category\/cross-sector\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/smartdatamodels.org\/wp-content\/uploads\/2021\/02\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/smartdatamodels.org\/wp-content\/uploads\/2021\/02\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/smartdatamodels.org\/wp-content\/uploads\/2021\/02\/image.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/posts\/7220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"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=7220"}],"version-history":[{"count":1,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/posts\/7220\/revisions"}],"predecessor-version":[{"id":7221,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/posts\/7220\/revisions\/7221"}],"wp:attachment":[{"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/media?parent=7220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/categories?post=7220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartdatamodels.org\/index.php\/wp-json\/wp\/v2\/tags?post=7220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}