def forwards_func(apps, schema_editor): org_ks={ "Organization": {"name": "A test Organization", "website": "http://new_org.example.com", "description": ""}, "KnowledgeServer": {"name": "A test OKS.", "netloc": "test.thekoa.org", "description": "It has some datasets and structures", "html_home": "", "html_disclaimer": ""} } KnowledgeServer.create_this_ks(org_ks) this_ks_d = KnowledgeServer.this_knowledge_server('default') dssContinentState=DataSetStructure() dssContinentState.name="Test Continent-SubContinent-State"; dssContinentState.SetNotNullFields() dssContinentState.save() mmContinent=dssContinentState.create_model_metadata(name="Continent",module="test1",name_field="name",description_field="") mmSubContinent=dssContinentState.create_model_metadata(name="SubContinent",module="test1",name_field="name",description_field="") mmState=dssContinentState.create_model_metadata(name="State",module="test1",name_field="name",description_field="") # It creates ModelMetadata and a DataSet for each of them; having the DataSetStructure makes it # possible to release and materialize the datasets with dangling references that will be # resolved once the dss is released and materialized. KnowledgeServer.register_models([mmContinent, mmSubContinent, mmState]) # it creates the root node from the ModelMetadata provided dssContinentState.root_model_metadata(mmContinent) # child nodes for two attributes/fields dssContinentState.root_node.children_for(["subcontinent_set", "state_set"], this_ks_d.netloc) dssContinentState.save() dss_dss = DataSetStructure.get_from_name(DataSetStructure.dataset_structure_DSN) ds = DataSet(description='DataSet for data set structure "Continent-SubContinent-State"', knowledge_server=this_ks_d, dataset_structure=dss_dss, root=dssContinentState, version_major=0, version_minor=1, version_patch=0, version_description="") ds.save(); ds.set_released() europe = Continent();europe.name="Europe";europe.save() asia = Continent();asia.name="Asia";asia.save() south_europe=SubContinent();south_europe.name="South Europe";south_europe.continent=europe;south_europe.save() central_europe=SubContinent();central_europe.name="Central Europe";central_europe.continent=europe;central_europe.save() italy=State();italy.name="Italy";italy.sub_continent=south_europe;italy.continent=europe;italy.save() spain=State();spain.name="Spain";spain.sub_continent=south_europe;spain.continent=europe;spain.save() germany=State();germany.name="Germany";germany.sub_continent=central_europe;germany.continent=europe;germany.save() ds = DataSet(knowledge_server=this_ks_d,dataset_structure=dssContinentState,root=europe, description="Europe",version_major=0,version_minor=1,version_patch=0,version_description="") ds.save();ds.set_released(); ds = DataSet(knowledge_server=this_ks_d,dataset_structure=dssContinentState,root=asia, description="Asia",version_major=0,version_minor=1,version_patch=0,version_description="") ds.save();ds.set_released();
def forwards_func(apps, schema_editor): org_ks = { "Organization": { "name": "A test Organization", "website": "http://new_org.example.com", "description": "" }, "KnowledgeServer": { "name": "A demo OKS populated with some test data.", "netloc": "test.beta.thekoa.org", "description": "", "html_home": "", "html_disclaimer": "" } } KnowledgeServer.create_this_ks(org_ks)
def forwards_func(apps, schema_editor): org_ks = { "KnowledgeServer": { "name": "A CLIENT OKS to test importing other OKS' stuff.", "netloc": "client.beta.thekoa.org", "description": "It has no datasets; just browse and import from other OKSs.", "html_home": "<h3>This is an OKS used as a client to import datasets from other OKSs.</h3><p>Try browsing another OKS if you already know its URL. Otherwise please <a href=\"http://www.thekoa.org/contact\">contact us</a>.</p>", "html_disclaimer": "<h4>This is an OKS used as a client to import datasets from other OKSs.</h4><p>Try browsing another OKS if you already know its URL. Otherwise please <a href=\"http://www.thekoa.org/contact\">contact us</a>.</p>" } } KnowledgeServer.create_this_ks(org_ks)
def forwards_func(apps, schema_editor): org_ks = { "Organization": { "name": "A test Organization", "website": "http://new_org.example.com", "description": "" }, "KnowledgeServer": { "name": "A demo OKS used as a client to perform testing.", "netloc": "client.beta.thekoa.org", "description": "", "html_home": "", "html_disclaimer": "" } } KnowledgeServer.create_this_ks(org_ks)
def forwards_func(apps, schema_editor): org_ks = { "Organization": { "name": "A test Organization", "website": "http://new_org.example.com", "description": "" }, "KnowledgeServer": { "name": "A test OKS.", "netloc": "test.thekoa.org", "description": "It has some datasets and structures", "html_home": "", "html_disclaimer": "" } } KnowledgeServer.create_this_ks(org_ks) this_ks_d = KnowledgeServer.this_knowledge_server('default') dssContinentState = DataSetStructure() dssContinentState.name = "Test Continent-SubContinent-State" dssContinentState.SetNotNullFields() dssContinentState.save() mmContinent = dssContinentState.create_model_metadata( "Continent", "test1", "name") mmSubContinent = dssContinentState.create_model_metadata( "SubContinent", "test1", "name") mmState = dssContinentState.create_model_metadata("State", "test1", "name") # It creates ModelMetadata and a DataSet for each of them; having the DataSetStructure makes it # possible to release and materialize the datasets with dangling references that will be # resolved once the dss is released and materialized. KnowledgeServer.register_models([mmContinent, mmSubContinent, mmState]) # it creates the root node of the dataset structure dssContinentState.root_model_metadata(mmContinent) # and child nodes for two attributes/fields dssContinentState.root_node.children_nodes_for( ["subcontinent_set", "state_set"], this_ks_d.netloc) dssContinentState.save() dss_dss = DataSetStructure.get_from_name( DataSetStructure.dataset_structure_DSN) ds = DataSet( description= 'DataSet for data set structure "Continent-SubContinent-State"', knowledge_server=this_ks_d, dataset_structure=dss_dss, root=dssContinentState, version_major=0, version_minor=1, version_patch=0) ds.save() ds.set_released() europe = Continent() europe.name = "Europe" europe.save() asia = Continent() asia.name = "Asia" asia.save() south_europe = SubContinent() south_europe.name = "South Europe" south_europe.continent = europe south_europe.save() central_europe = SubContinent() central_europe.name = "Central Europe" central_europe.continent = europe central_europe.save() italy = State() italy.name = "Italy" italy.sub_continent = south_europe italy.continent = europe italy.save() spain = State() spain.name = "Spain" spain.sub_continent = south_europe spain.continent = europe spain.save() germany = State() germany.name = "Germany" germany.sub_continent = central_europe germany.continent = europe germany.save() ds = DataSet(knowledge_server=this_ks_d, dataset_structure=dssContinentState, root=europe, description="Europe", version_major=0, version_minor=1, version_patch=0, version_description="") ds.save() ds.set_released() ds = DataSet(knowledge_server=this_ks_d, dataset_structure=dssContinentState, root=asia, description="Asia", version_major=0, version_minor=1, version_patch=0, version_description="") ds.save() ds.set_released()
def forwards_func(apps, schema_editor): org_ks={ "Organization": {"name": "A test Organization", "website": "http://new_org.example.com", "description": ""}, "KnowledgeServer": {"name": "A demo OKS used as a client to perform testing.", "netloc": "client.beta.thekoa.org", "description": "", "html_home": "", "html_disclaimer": ""} } KnowledgeServer.create_this_ks(org_ks)
def forwards_func(apps, schema_editor): org_ks={ "KnowledgeServer": {"name": "A CLIENT OKS to test importing other OKS' stuff.", "netloc": "client.beta.thekoa.org", "description": "It has no datasets; just browse and import from other OKSs.", "html_home": "<h3>This is an OKS used as a client to import datasets from other OKSs.</h3><p>Try browsing another OKS if you already know its URL. Otherwise please <a href=\"http://www.thekoa.org/contact\">contact us</a>.</p>", "html_disclaimer": "<h4>This is an OKS used as a client to import datasets from other OKSs.</h4><p>Try browsing another OKS if you already know its URL. Otherwise please <a href=\"http://www.thekoa.org/contact\">contact us</a>.</p>"} } KnowledgeServer.create_this_ks(org_ks)