How to use the sbol3.config.parsePropertyName function in sbol3

To help you get started, we’ve selected a few sbol3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SynBioDex / pySBOL / sbol3 / property.py View on Github external
def set_notoplevelcheck(self, sbol_obj):
        # Add to parent object
        if self._rdf_type not in self._sbol_owner.owned_objects:
            self._sbol_owner.owned_objects[self._rdf_type] = []
        if len(self._sbol_owner.owned_objects[self._rdf_type]) == 0:
            self._sbol_owner.owned_objects[self._rdf_type].append(sbol_obj)
        else:
            raise SBOLError("Cannot set " + parsePropertyName(self._rdf_type) + " property. "
                            "The property is already set. Call remove before attempting to overwrite the value.",
                            SBOLErrorCode.SBOL_ERROR_INVALID_ARGUMENT)
        sbol_obj.parent = self._sbol_owner
        # Update URI for the argument object and all its children, if SBOL-compliance is enabled.
        sbol_obj.update_uri()
github SynBioDex / pySBOL / sbol3 / property.py View on Github external
def __setitem__(self, rdf_type, sbol_obj):
        # NOTE: custom implementation. Not sure where this is defined in the original code.
        if self._sbol_owner.is_top_level():
            doc = self._sbol_owner.doc
            if self._isHidden() and doc.find(sbol_obj.identity):
                # In order to avoid a duplicate URI error, don't attempt
                # to add the object if this is a hidden property,
                pass
            else:
                doc.add(sbol_obj)
        # Add to parent object
        if len(self._sbol_owner.owned_objects[rdf_type]) == 0:
            self._sbol_owner.owned_objects[rdf_type].append(sbol_obj)
        else:
            raise SBOLError("Cannot set " + parsePropertyName(rdf_type) + " property. "
                            "The property is already set. Call remove before attempting to overwrite the value.",
                            SBOLErrorCode.SBOL_ERROR_INVALID_ARGUMENT)
        sbol_obj.parent = self._sbol_owner
        # Update URI for the argument object and all its children, if SBOL-compliance is enabled.
        sbol_obj.update_uri()