sbol2.property

Module Contents

Classes

Property

Member properties of all SBOL objects are defined

URIProperty

Member properties of all SBOL objects are defined

LiteralProperty

Member properties of all SBOL objects are defined

IntProperty

Member properties of all SBOL objects are defined

FloatProperty

Member properties of all SBOL objects are defined

DateTimeProperty

Member properties of all SBOL objects are defined

TextProperty

Member properties of all SBOL objects are defined

OwnedObject

Member properties of all SBOL objects are defined

ReferencedObject

Member properties of all SBOL objects are defined

Functions

sort_version(obj)

sbol2.property.sort_version(obj)
class sbol2.property.Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules, initial_value=None)

Bases: abc.ABC

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

static valid_lower_bound(x: Union[int, float, str]) str

Validate the lower bound. Allow numeric strings, ints, and floats.

static valid_upper_bound(x: Union[int, float, str]) str

Validate the upper bound. Allow numeric strings, ints, floats, and ‘*’ (to represent infinity).

property logger(self)
getTypeURI(self)
Returns

URI representing the predicate.

getOwner(self)
Returns

The owner of this Property.

getRawValue(self)
property value(self)
abstract set(self, new_value)
abstract add(self, new_value)

Appends the new value to a list of values, for properties that allow it.

remove(self, index)

Remove a property value. By default, we assume this is a literal located at index 0.

clear(self)

Clear all property values.

write(self)

Write property values.

find(self, query)

Check if a value in this property matches the query.

getLowerBound(self)
property lower_bound(self)

Return the lower bound of the property as an integer.

getUpperBound(self)
property upper_bound(self)

Return the upper bound of the property as a number. If the upper bound is ‘*’, this value is math.inf. Otherwise the upper bound is converted to an integer and returned.

validate(self, arg)
__contains__(self, item)
_isHidden(self)
__len__(self)
__str__(self)

Return str(self).

static guess_args(validators, initial_value)

In pysbol there are 4 constructors for each Property. We have to figure out which constructor the user intended to call based on the arguments. The signatures are:

IntProperty(owner, rdf_type, low_bound, high_bound, ValidationRules,

initial_value)

IntProperty(owner, rdf_type, low_bound, high_bound, ValidationRules) IntProperty(owner, rdf_type, low_bound, high_bound, initial_value) IntProperty(owner, rdf_type, low_bound, high_bound)

We have to guess which of the two 5-arg constructors the user intended to call. If both validators and initial_value are None, this is the 4-arg constructor, so return None for both. If neither validators nor initial_value are None, this is the 6-arg constructor so return the values as specified.

For the 5-arg cases, if the isinstance(initial_value, typeinfo) then guess that hte 5th arg is an initial_value. Otherwise assume the 5th arg is a list of validation rules.

class sbol2.property.URIProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules, initial_value=None)

Bases: Property

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

property value(self)
getSinglePropertyValue(self)
getPropertyValueList(self)
set(self, new_value)
setSinglePropertyValue(self, new_value)
setPropertyValueList(self, value)
add(self, new_value)

Appends the new value to a list of values, for properties that allow it.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.property.LiteralProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: Property

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

property value(self)
getSinglePropertyValue(self)
getPropertyValueList(self)
set(self, new_value)
setSinglePropertyValue(self, new_value)
setPropertyValueList(self, new_value)
add(self, new_value)

Appends the new value to a list of values, for properties that allow it.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.property.IntProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.property.FloatProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value: rdflib.Literal) float
convert_from_user(self, value: Any) Union[rdflib.Literal, None]
Raises

ValueError if value cannot be converted to float

class sbol2.property.DateTimeProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.property.TextProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value)
class sbol2.property.OwnedObject(property_owner, sbol_uri, builder, lower_bound, upper_bound, validation_rules=None, first_object=None)

Bases: Property

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

create(self, uri, builder=None)

Creates an instance appropriate for this owned object collection.

uri - the name of the object

add(self, sbol_obj)

Appends the new value to a list of values, for properties that allow it.

__getitem__(self, id)
get_int(self, id)
find(self, query)

Check if a value in this property matches the query.

get_uri(self, id)
find_persistent_identity(self, search_uri)
find_resource(self, uri, resource_namespaces, object_store, parent_obj, typedURI=False)
get(self, uri='')
__setitem__(self, rdf_type, sbol_obj)
convert_to_user(self, value)
getSinglePropertyValue(self)
getPropertyValueList(self)
property value(self)
set(self, new_value)
setSinglePropertyValue(self, new_value)
setPropertyValueList(self, new_value)
remove(self, identifier)

id can be either an integer index or a string URI

removeOwnedObject_int(self, index)
removeOwnedObject_str(self, uri)
clear(self)

Clear all property values.

__len__(self)
class sbol2.property.ReferencedObject(property_owner, type_uri, reference_type_uri, lower_bound, upper_bound, validation_rules, initial_value=None)

Bases: URIProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

get(self, item)

Return reference object at this index. :param item (int) the index

set(self, new_value)
_to_uri(self, obj)

Converts strings, URIRefs, and sbol.Identified instances into rdflib.URIRefs.

setSinglePropertyValue(self, new_value)
setPropertyValueList(self, new_value)
add(self, uri)

Appends the new value to a list of values, for properties that allow it.

addReference(self, uri)
_ensure_uri_ref(self, thing)

This method ensures that what gets returned is an rdflib.URIRef. If the set methods are working properly, this should be unnecessary. Hence the warning message if what it finds is not a URIRef. The goal is to remove this method eventually.

property value(self)