sbol2.config

Module Contents

Classes

FileFormats

Generic enumeration.

ConfigOptions

Generic enumeration.

Config

A class which contains global configuration variables

Functions

setHomespace(ns)

getHomespace()

hasHomespace()

setFileFormat(file_format)

getFileFormat()

parseClassName(uri)

parseNamespace(uri)

parseURLDomain(url)

parsePropertyName(uri)

string_equal(str1: Any, str2: Any) → bool

Converts the two arguments to str and compares them, returning

Attributes

options

valid_options

extension_namespaces

home

SBOLCompliantTypes

catch_exceptions

file_format

class sbol2.config.FileFormats

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

JSON = json
NTRIPLES = ntriples
RDFXML = rdfxml
class sbol2.config.ConfigOptions

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

HOMESPACE = homespace
SBOL_COMPLIANT_URIS = sbol_compliant_uris
SBOL_TYPED_URIS = sbol_typed_uris
SERIALIZATION_FORMAT = serialization_format
VALIDATE = validate
VALIDATE_ONLINE = validate_online
VALIDATOR_URL = validator_url
JAVA_LOCATION = java_location
LANGUAGE = language
TEST_EQUALITY = test_equality
CHECK_URI_COMPLIANCE = check_uri_compliance
CHECK_COMPLETENESS = check_completeness
CHECK_BEST_PRACTICES = check_best_practices
FAIL_ON_FIRST_ERROR = fail_on_first_error
PROVIDE_DETAILED_STACK_TRACE = provide_detailed_stack_trace
URI_PREFIX = uri_prefix
SUBSET_URI = subset_uri
VERSION = version
INSERT_TYPE = insert_type
MAIN_FILE_NAME = main_file_name
DIFF_FILE_NAME = diff_file_name
RETURN_FILE = return_file
VERBOSE = verbose
sbol2.config.options
sbol2.config.valid_options
sbol2.config.extension_namespaces
sbol2.config.home
sbol2.config.SBOLCompliantTypes = 1
sbol2.config.catch_exceptions = 0
sbol2.config.file_format = rdfxml
class sbol2.config.Config

A class which contains global configuration variables for the libSBOL environment.

Configuration variables are accessed through the setOption and getOption methods.

SBOL_DATA_MODEL_REGISTER
static register_extension_class(builder, type_uri)

Register an extension class and its namespace, so custom data can be embedded into and read from SBOL files.

Parameters
  • builder – A no-argument constructor

  • type_uri – An RDF type URI for the extension class

static setHomespace(ns)

Setting the Homespace has several advantages. It simplifies object creation and retrieval from Documents. In addition, it serves as a way for a user to claim ownership of new objects. Generally users will want to specify a Homespace that corresponds to their organization’s web domain. :param ns: The namespace to use as the Homespace :return: None

static getHomespace()
Returns

The Homespace (a string representing the default namespace).

static hasHomespace()
Returns

True if Homespace is set, False otherwise.

static setFileFormat(_file_format)
Parameters

_file_format – The file format to use.

Returns

None

static getFileFormat()
Returns

The file format.

static setOption(option, val)

Configure options for libSBOL. Access online validation and conversion.

Option | Description | Values | # noqa
:————————— | :———————————————————————– | :————– |
homespace | Enable validation and conversion requests through the online validator | http://examples.org |
sbol_compliant_uris | Enables autoconstruction of SBOL-compliant URIs from displayIds | True or False |
sbol_typed_uris | Include the SBOL type in SBOL-compliant URIs | True or False |
output_format | File format for serialization | True or False |
validate | Automatic validation | True or False |
validate_online | Use online (not local) validator for validation and conversion requests | True or False, defaults to True |
validator_url | The http request endpoint for online validation and conversion | A valid URL, set to<br>https://validator.sbolstandard.org/validate/ by default |
java_location | Path to Java executable for offline validation and conversion | A valid URL, set to<br>/usr/bin/java by default |
language | File format for conversion | SBOL2, SBOL1, FASTA, GenBank |
test_equality | Report differences between two files | True or False |
check_uri_compliance | If set to false, URIs in the file will not be checked for compliance<br>with the SBOL specification | True or False |
check_completeness | If set to false, not all referenced objects must be described within<br>the given main_file | True or False |
check_best_practices | If set to true, the file is checked for the best practice rules set<br>in the SBOL specification | True or False |
fail_on_first_error | If set to true, the validator will fail at the first error | True or False |
provide_detailed_stack_trace | If set to true (and failOnFirstError is true) the validator will<br>provide a stack trace for the first validation error | True or False |
uri_prefix | Required for conversion from FASTA and GenBank to SBOL1 or SBOL2,<br>used to generate URIs | True or False |
version | Adds the version to all URIs and to the document | A valid Maven version string |
return_file | Whether or not to return the file contents as a string | True or False |
Parameters
  • option – The option key

  • val – The option value (str or bool expected)

Returns

None

static getOption(option)

Get current option value for online validation and conversion

Parameters

option – The option key

Returns

The option value

sbol2.config.setHomespace(ns)
sbol2.config.getHomespace()
sbol2.config.hasHomespace()
sbol2.config.setFileFormat(file_format)
sbol2.config.getFileFormat()
sbol2.config.parseClassName(uri)
sbol2.config.parseNamespace(uri)
sbol2.config.parseURLDomain(url)
sbol2.config.parsePropertyName(uri)
sbol2.config.string_equal(str1: Any, str2: Any) bool

Converts the two arguments to str and compares them, returning the result. This helps when comparing a str with a rdflib.URIRef or a rdflib.Literal.