SD2E / opil

The Open Protocol Interface Language (OPIL) is intended as a standard language for protocol interfaces
5 stars 1 forks source link

sbol3 complaining that `TimeInterval` is not iterable #160

Closed bjkeller closed 3 years ago

bjkeller commented 3 years ago

sbol3 gives a "not iterable" error when trying to add an opil.TimeInterval to a measurement type.

minimal example

import opil
import sbol3
from tyto import NCIT, OM

sbol3.set_homespace('http://nope.nope/')

interval = opil.TimeInterval()
interval.minTime = opil.Measure(0.0, OM.hour)
interval.maxTime = opil.Measure(24.0, OM.hour)

measurement_type = opil.MeasurementType('flow')
measurement_type.name = "Flow Cytometry"
measurement_type.description = "flow measurement type which is ncit:C78806"
measurement_type.type = NCIT.get_uri_by_term('Flow Cytometer')
measurement_type.allowed_time = interval

protocol = opil.ProtocolInterface('htc')
protocol.name = 'dummy protocol'
protocol.description = 'illustrate failure'
protocol.protocol_measurement_type = [measurement_type]

output

Traceback (most recent call last):
  File "timeinterval_iterable.py", line 15, in <module>
    measurement_type.allowed_time = interval
  File "/root/.local/lib/python3.8/site-packages/sbol3/object.py", line 25, in __setattr__
    self.__dict__[name].set(value)
  File "/root/.local/lib/python3.8/site-packages/sbol3/property_base.py", line 137, in set
    items = [self.from_user(v) for v in value]
TypeError: 'TimeInterval' object is not iterable

Minimal example is

bjkeller commented 3 years ago

user error - should have had a list of intervals

closing