Example #1
0
 def update_property(self, property_info):
     """Add a new property into schema
     """
     validate_property_schema(property_info)
     self.schema["@graph"].append(property_info)
     validate_schema(self.schema)
     logger.info(f"Updated the property {property_info['rdfs:label']} successfully.")
Example #2
0
    def edit_property(self, property_info):
        """Edit an existing property into schema
        """
        for i, schema_property in enumerate(self.schema["@graph"]):
            if schema_property["rdfs:label"] == property_info["rdfs:label"]:
                validate_property_schema(property_info)
                self.schema["@graph"][i] = property_info

                #TODO: check if properties are added/edited multiple times (e.g. look at explore_property)
                break

        validate_schema(self.schema)
        logger.info(f"Edited the property {property_info['rdfs:label']} successfully.")
        self.schema_nx = load_schema_into_networkx(self.schema)
Example #3
0
    def test_validate_property_schema(self, helpers):

        se_obj = helpers.get_schema_explorer("example.model.jsonld")

        mock_class = se_obj.generate_property_template()
        mock_class["@id"] = "bts:MockProperty"
        mock_class["@type"] = "rdf:Property"
        mock_class["@rdfs:comment"] = "This is a mock Patient class"
        mock_class["@rdfs:label"] = "MockProperty"
        mock_class["schema:domainIncludes"]["@id"] = "bts:Patient"

        actual = validate_utils.validate_property_schema(mock_class)

        assert actual is None