Skip to content

Copy Function Changes Namespace for Sub-Component Definition #398

@nroehner

Description

@nroehner

When copying a ComponentDefinition "parent" that has a sub-Component "child" into a new namespace, if the definition property of "child" refers to a ComponentDefinition in the same document, then the definition property of the copy of "child" appears to be imported into the same namespace as the copy of "child". As a user, I would expect the copy of "child" to retain the same definition property as the original "child". I would only expect this definition property to be copied into a different namespace if the ComponentDefinition to which it refers is also copied into a new namespace, which it currently is not. Maybe there should be an option to recursively copy in this manner. Here is some example code:

import sbol2

sbol2.Config.setOption('sbol_typed_uris', False)
sbol2.Config.setOption('validate', False)
sbol2.setHomespace('http://synbict.org')

test_doc = sbol2.Document()

parent_comp = test_doc.componentDefinitions.create('parent')

child_sub_comp = parent_comp.components.create('child')

child_sub_comp.definition = 'http://synbict.org/child/1'

child_comp = test_doc.componentDefinitions.create('child')

sbol2.setHomespace('http://sd2e.org')

parent_comp.copy(test_doc, 'http://synbict.org', '1')

parent_copy = test_doc.componentDefinitions.get('http://sd2e.org/parent/1')

child_copy = parent_copy.components.get('http://sd2e.org/parent/child/1')

print('Should be True: ' + str(child_copy .definition == 'http://synbict.org/child/1'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions