sbol2.object¶
Module Contents¶
Classes¶
An SBOLObject converts a Python data structure into an RDF triple store |
Functions¶
|
|
|
- sbol2.object._compare_properties(obj1, obj2)¶
- sbol2.object._compare_owned_objects(obj1, obj2)¶
- class sbol2.object.SBOLObject(type_uri=rdflib.URIRef(UNDEFINED), uri=rdflib.URIRef('example'))¶
An SBOLObject converts a Python data structure into an RDF triple store and contains methods for serializing and parsing RDF triples.
- abstract _serialize()¶
- abstract _nest()¶
- abstract _makeQName(uri)¶
- property logger¶
- __uri__() rdflib.URIRef¶
Returns a URIRef representing this object.
- Returns
The identity of this object as an rdflib.URIRef
- Return type
rdflib.URIRef
- property type¶
- property this¶
- getTypeURI()¶
- Returns
The uniform resource identifier that describes
the RDF-type of this SBOL Object.
- getClassName(rdf_type)¶
Parses a local class name from the RDF-type of this SBOL Object.
- cast(cls)¶
- find(uri)¶
Search this object recursively to see if an object or any child object with URI already exists.
- Parameters
uri – The URI to search for.
- Returns
The SBOLObject associated with this URI if it exists,
None otherwise.
- abstract cacheObjects(objectCache)¶
TODO document
- Parameters
objectCache – a dictionary mapping strings to SBOLObjects
- Returns
None
- find_property(uri)¶
Search this object recursively to see if it contains a member property with the given RDF type.
- Parameters
uri – The RDF type of the property to search for.
- Returns
The SBOLObject that contains a member property
with the specified RDF type, None otherwise
- find_property_value(uri, value, matches=None)¶
Search this object recursively to see if it contains a member property with the given RDF type and indicated property value.
- Parameters
uri – The RDF type of the property to search for.
value – The property value to match.
matches –
- Returns
A vector containing all objects found that contain
a member property with the specified RDF type
- find_reference(uri)¶
Search this object recursively to see if it contains a member property with the given RDF type and indicated property value.
- Parameters
uri – A URI, either an ontology term or an object reference,
to search for. :return: A vector containing all objects found that contain the URI in a property value.
- compare(other)¶
Compare two SBOLObjects. The behavior is currently undefined for objects with custom annotations or extension classes.
- Parameters
other – The object being compared to this one.
- Returns
True if the objects are identical, False if they are different.
- getPropertyValue(property_uri: str) str¶
Get the value of a custom annotation property by its URI.
- Parameters
property_uri (str) – The URI for the property.
- Returns
The value of the property.
- Return type
str
- Raises
SBOLError(SBOL_ERROR_NOT_FOUND) if property does not exist
- getPropertyValues(property_uri: str) List[str]¶
Get all values of a custom annotation property by its URI.
- Parameters
property_uri (str) – The URI for the property.
- Returns
A vector of property values.
- Return type
list of strings
- Raises
SBOLError(SBOL_ERROR_NOT_FOUND) if property does not exist
- getProperties()¶
Gets URIs for all properties contained by this object. This includes SBOL core properties as well as custom annotations. Use this to find custom extension data in an SBOL file.
- Returns
A vector of URIs that identify the properties contained in this object.
- setPropertyValue(property_uri, val)¶
Set and overwrite the value for a user-defined annotation property.
- Parameters
property_uri –
val – A string
- Returns
None
- abstract addPropertyValue(property_uri, val)¶
Append a value to a user-defined annotation property.
- Parameters
property_uri –
val – Either a literal or URI value.
- Returns
None
- abstract setAnnotation(property_uri, val)¶
Set the value for a user-defined annotation property. Synonymous with setPropertyValue.
- Parameters
property_uri –
val – If the value is a URI,
it should be surrounded by angle brackets, else it will be interpreted as a literal value. :return: None
- abstract getAnnotation(property_uri)¶
Get the value of a custom annotation property by its URI. Synonymous with getPropertyValue.
- Parameters
property_uri – The URI for the property.
- Returns
The value of the property or SBOL_ERROR_NOT_FOUND.
- abstract apply(callback, user_data)¶
Recursively call this callback function on the user_data provided :param callback: the callback function :param user_data: the input to the callback :return: None
- abstract update_uri()¶
Recursively generates SBOL compliant ids for an object and all its owned objects, then checks to make sure that these ids are unique. :return: None
- build_graph(graph)¶
- __str__()¶
Return str(self).
- is_top_level()¶
- __getattribute__(name)¶
Return getattr(self, name).
- _is_transparent_attribute(name)¶
- _set_transparent_attribute(name, value)¶
- __setattr__(name, value)¶
Implement setattr(self, name, value).
- _added_to_document(doc)¶
Classes can override this method to do extra work when being added to a document.