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(self)¶
- abstract _nest(self)¶
- abstract _makeQName(self, uri)¶
- property logger(self)¶
- __uri__(self) sbol2.constants.rdflib.URIRef ¶
Returns a URIRef representing this object.
- Returns
The identity of this object as an rdflib.URIRef
- Return type
rdflib.URIRef
- property type(self)¶
- property this(self)¶
- getTypeURI(self)¶
- Returns
The uniform resource identifier that describes
the RDF-type of this SBOL Object.
- getClassName(self, rdf_type)¶
Parses a local class name from the RDF-type of this SBOL Object.
- cast(self, cls)¶
- find(self, 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(self, objectCache)¶
TODO document
- Parameters
objectCache – a dictionary mapping strings to SBOLObjects
- Returns
None
- find_property(self, 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(self, 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(self, 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(self, 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(self, 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(self, 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(self)¶
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(self, property_uri, val)¶
Set and overwrite the value for a user-defined annotation property.
- Parameters
property_uri –
val – A string
- Returns
None
- abstract addPropertyValue(self, 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(self, 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(self, 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(self, 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(self)¶
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(self, graph)¶
- __str__(self)¶
Return str(self).
- is_top_level(self)¶
- __getattribute__(self, name)¶
Return getattr(self, name).
- _is_transparent_attribute(self, name)¶
- _set_transparent_attribute(self, name, value)¶
- __setattr__(self, name, value)¶
Implement setattr(self, name, value).
- _added_to_document(self, doc)¶
Classes can override this method to do extra work when being added to a document.