diff --git a/.travis.yml b/.travis.yml index cebec597..fa273d27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ before_install: - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # cache refresh required to install packages - - sudo apt-get update -qq + - sudo apt-get update -q=2 # install dependencies - sudo apt-get -y install build-essential libxml2-dev gcc-multilib g++-multilib libraptor2-dev libjsoncpp-dev swig3.0 python-dev @@ -34,7 +34,7 @@ before_install: install: - cd ~/build/libSBOL - - sudo apt-get install -qq g++-4.8 + - sudo apt-get install -q=2 g++-4.8 - export CXX="g++-5" CC="gcc-5" - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/install_x64 -DSBOL_BUILD_64=ON -DSBOL_BUILD_SHARED=ON -DCURL_LIBRARY=/usr/lib/x86_64-linux-gnu/libcurl.so -DJsonCpp_LIBRARY=/usr/lib/x86_64-linux-gnu/libjsoncpp.so -DLIBXSLT_LIBRARIES=/usr/lib/x86_64-linux-gnu/libxslt.so -DRAPTOR_LIBRARY=/usr/lib/x86_64-linux-gnu/libraptor2.so -DSBOL_BUILD_PYTHON2=ON -DPYTHON_EXECUTABLE=/usr/bin/python -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so python2.7 -DSWIG_EXECUTABLE=/usr/bin/swig3.0 "$TRAVIS_BUILD_DIR" - make @@ -47,8 +47,12 @@ script: - make -j2 && make install #- cd ~/install_x64/test #- ./sbol_test - - cd ~/install_x64/wrapper/sbol - - python unit_tests.py + - ls ~ + - ls ~/build + - ls ~/build/libSBOL + - ls ~/build/SynBioDex + - cd ~/build/SynBioDex/libSBOL/release/wrapper/Linux_64_2 + - python -c "from sbol import *; testSBOL()" addons: apt: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aaf5c50..0feae882 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,11 @@ ELSE() ENDIF() # set build options -#OPTION( SBOL_BUILD_STATIC "Build statically linked library" TRUE ) -OPTION( SBOL_BUILD_SHARED "Build dynamically linked library" FALSE ) +IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + OPTION( SBOL_BUILD_SHARED "Build dynamically linked library" TRUE ) +ELSE() + OPTION( SBOL_BUILD_SHARED "Build dynamically linked library" FALSE ) +ENDIF() #OPTION( SBOL_BUILD_COMBINED "Build libSBOL and Raptor RDF archives combined" FALSE ) #OPTION( SBOL_DEBUG_STATEMENTS "Add some print statements for debugging" FALSE ) #OPTION( SBOL_BUILD_EXAMPLES "Build the example programs" FALSE ) @@ -36,6 +39,7 @@ endif() OPTION( SBOL_BUILD_PYTHON2 "Generate Python version 2 wrapper using SWIG" FALSE ) OPTION( SBOL_BUILD_PYTHON3 "Generate Python version 3 wrapper using SWIG" FALSE ) OPTION( SBOL_BUILD_MANUAL "Generate SBOL documentation using Doxygen" FALSE ) +OPTION( SBOL_BUILD_RASQAL "Use use Rasqal library if it is found" FALSE ) OPTION( SBOL_BUILD_JSON "Build JsonCpp library (for Linux users primarily)" FALSE ) OPTION( SBOL_BUILD_OSX_DIST "For pySBOL distributions on Mac, target frameworks back to OSX 10.9" FALSE ) OPTION( SBOL_BUILD_TESTS "Build the unit tests and example tests" FALSE ) diff --git a/manual/Doxyfile b/manual/Doxyfile index d4d044e1..9186aad1 100644 --- a/manual/Doxyfile +++ b/manual/Doxyfile @@ -581,7 +581,7 @@ SORT_BRIEF_DOCS = NO # detailed member documentation. # The default value is: NO. -SORT_MEMBERS_CTORS_1ST = NO +SORT_MEMBERS_CTORS_1ST = YES # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will diff --git a/manual/doxy2swig.py b/manual/doxy2swig.py old mode 100644 new mode 100755 index 3e08303c..ce68f3c8 --- a/manual/doxy2swig.py +++ b/manual/doxy2swig.py @@ -1,47 +1,100 @@ #!/usr/bin/env python -"""Doxygen XML to SWIG docstring converter. +"""doxy2swig.py [options] index.xml output.i -Converts Doxygen generated XML files into a file containing docstrings -that can be used by SWIG-1.3.x. Note that you need to get SWIG -version > 1.3.23 or use Robin Dunn's docstring patch to be able to use -the resulting output. - -Usage: +Doxygen XML to SWIG docstring converter (improved version). - doxy2swig.py input.xml output.i +Converts Doxygen generated XML files into a file containing docstrings +for use by SWIG. -input.xml is your doxygen generated XML file and output.i is where the +index.xml is your doxygen generated XML file and output.i is where the output will be written (the file will be clobbered). - """ - +# +# The current version of this code is hosted on a github repository: +# https://github.com/m7thon/doxy2swig +# # This code is implemented using Mark Pilgrim's code as a guideline: # http://www.faqs.org/docs/diveintopython/kgp_divein.html # -# Author: Prabhu Ramachandran +# Original Author: Prabhu Ramachandran +# Modified by: Michael Thon (June 2015) # License: BSD style - +# +# Thanks: +# Johan Hake: the include_function_definition feature +# Bill Spotz: bug reports and testing. +# Sebastian Henschel: Misc. enhancements. +# +# Changes: +# June 2015 (Michael Thon): +# - class documentation: +# -c: add constructor call signatures and a "Constructors" section +# collecting the respective docs (e.g. for python) +# -a: add "Attributes" section collecting the documentation for member +# variables (e.g. for python) +# - overloaded functions: +# -o: collect all documentation into one "Overloaded function" section +# - option to include function definition / signature renamed to -f +# - formatting: +# + included function signatures slightly reformatted +# + option (-t) to turn off/on type information for funciton signatures +# + lists (incl. nested and ordered) +# + attempt to produce docstrings that render nicely as markdown +# + translate code, emphasis, bold, linebreak, hruler, blockquote, +# verbatim, heading tags to markdown +# + new text-wrapping and option -w to specify the text width +# from xml.dom import minidom import re import textwrap import sys -import types import os.path +import optparse def my_open_read(source): if hasattr(source, "read"): return source else: - return open(source) + try: + return open(source, encoding='utf-8') + except TypeError: + return open(source) -def my_open_write(dest, mode='w'): +def my_open_write(dest): if hasattr(dest, "write"): return dest else: - return open(dest, mode) - + try: + return open(dest, 'w', encoding='utf-8') + except TypeError: + return open(dest, 'w') + +# MARK: Text handling: +def shift(txt, indent = ' ', prepend = ''): + """Return a list corresponding to the lines of text in the `txt` list + indented by `indent`. Prepend instead the string given in `prepend` to the + beginning of the first line. Note that if len(prepend) > len(indent), then + `prepend` will be truncated (doing better is tricky!). This preserves a + special '' entry at the end of `txt` (see `do_para` for the meaning). + """ + if type(indent) is int: + indent = indent * ' ' + special_end = txt[-1:] == [''] + lines = ''.join(txt).splitlines(True) + for i in range(1,len(lines)): + if lines[i].strip() or indent.strip(): + lines[i] = indent + lines[i] + if not lines: + return prepend + prepend = prepend[:len(indent)] + indent = indent[len(prepend):] + lines[0] = prepend + indent + lines[0] + ret = [''.join(lines)] + if special_end: + ret.append('') + return ret class Doxy2SWIG: """Converts Doxygen generated XML files into a file containing @@ -51,30 +104,55 @@ class Doxy2SWIG: """ - def __init__(self, src): - """Initialize the instance given a source object (file or - filename). + def __init__(self, src, + with_function_signature = False, + with_type_info = False, + with_constructor_list = False, + with_attribute_list = False, + with_overloaded_functions = False, + textwidth = 80, + quiet = False): + """Initialize the instance given a source object. `src` can + be a file or filename. If you do not want to include function + definitions from doxygen then set + `include_function_definition` to `False`. This is handy since + this allows you to use the swig generated function definition + using %feature("autodoc", [0,1]). """ + # options: + self.with_function_signature = with_function_signature + self.with_type_info = with_type_info + self.with_constructor_list = with_constructor_list + self.with_attribute_list = with_attribute_list + self.with_overloaded_functions = with_overloaded_functions + self.textwidth = textwidth + self.quiet = quiet + + # state: + self.indent = 0 + self.listitem = '' + self.pieces = [] + f = my_open_read(src) self.my_dir = os.path.dirname(f.name) self.xmldoc = minidom.parse(f).documentElement f.close() - self.pieces = [] - self.pieces.append('\n// File: %s\n'%\ + self.pieces.append('\n// File: %s\n' % os.path.basename(f.name)) self.space_re = re.compile(r'\s+') self.lead_spc = re.compile(r'^(%feature\S+\s+\S+\s*?)"\s+(\S)') self.multi = 0 - self.ignores = ('inheritancegraph', 'param', 'listofallmembers', + self.ignores = ['inheritancegraph', 'param', 'listofallmembers', 'innerclass', 'name', 'declname', 'incdepgraph', 'invincdepgraph', 'programlisting', 'type', 'references', 'referencedby', 'location', 'collaborationgraph', 'reimplements', 'reimplementedby', 'derivedcompoundref', - 'basecompoundref') + 'basecompoundref', + 'argsstring', 'definition', 'exceptions'] #self.generics = [] def generate(self): @@ -84,13 +162,19 @@ def generate(self): """ self.parse(self.xmldoc) + def write(self, fname): + o = my_open_write(fname) + o.write(''.join(self.pieces).encode('ascii', 'ignore')) + o.write('\n') + o.close() + def parse(self, node): """Parse a given node. This function in turn calls the `parse_` functions which handle the respective nodes. """ - pm = getattr(self, "parse_%s"%node.__class__.__name__) + pm = getattr(self, "parse_%s" % node.__class__.__name__) pm(node) def parse_Document(self, node): @@ -98,19 +182,27 @@ def parse_Document(self, node): def parse_Text(self, node): txt = node.data - txt = txt.replace('\\', r'\\\\') + if txt == ' ': + # this can happen when two tags follow in a text, e.g., + # " ... $..." etc. + # here we want to keep the space. + self.add_text(txt) + return + txt = txt.replace('\\', r'\\') txt = txt.replace('"', r'\"') # ignore pure whitespace m = self.space_re.match(txt) - if m and len(m.group()) == len(txt): - pass - else: - self.add_text(textwrap.fill(txt)) + if not (m and len(m.group()) == len(txt)): + self.add_text(txt) + + def parse_Comment(self, node): + """Parse a `COMMENT_NODE`. This does nothing for now.""" + return def parse_Element(self, node): """Parse an `ELEMENT_NODE`. This calls specific `do_` handers for different elements. If no handler - is available the `generic_parse` method is called. All + is available the `subnode_parse` method is called. All tagNames specified in `self.ignores` are simply ignored. """ @@ -123,15 +215,62 @@ def parse_Element(self, node): handlerMethod = getattr(self, attr) handlerMethod(node) else: - self.generic_parse(node) + self.subnode_parse(node) #if name not in self.generics: self.generics.append(name) - def add_text(self, value): - """Adds text corresponding to `value` into `self.pieces`.""" - if type(value) in (types.ListType, types.TupleType): - self.pieces.extend(value) +# MARK: Special format parsing + def subnode_parse(self, node, pieces=None, indent=0, ignore=[], restrict=None): + """Parse the subnodes of a given node. Subnodes with tags in the + `ignore` list are ignored. If pieces is given, use this as target for + the parse results instead of self.pieces. Indent all lines by the amount + given in `indent`. Note that the initial content in `pieces` is not + indented. The final result is in any case added to self.pieces.""" + if pieces is not None: + old_pieces, self.pieces = self.pieces, pieces else: - self.pieces.append(value) + old_pieces = [] + if type(indent) is int: + indent = indent * ' ' + if len(indent) > 0: + pieces = ''.join(self.pieces) + i_piece = pieces[:len(indent)] + if self.pieces[-1:] == ['']: + self.pieces = [pieces[len(indent):]] + [''] + elif self.pieces != []: + self.pieces = [pieces[len(indent):]] + self.indent += len(indent) + for n in node.childNodes: + if restrict is not None: + if n.nodeType == n.ELEMENT_NODE and n.tagName in restrict: + self.parse(n) + elif n.nodeType != n.ELEMENT_NODE or n.tagName not in ignore: + self.parse(n) + if len(indent) > 0: + self.pieces = shift(self.pieces, indent, i_piece) + self.indent -= len(indent) + old_pieces.extend(self.pieces) + self.pieces = old_pieces + + def surround_parse(self, node, pre_char, post_char): + """Parse the subnodes of a given node. Subnodes with tags in the + `ignore` list are ignored. Prepend `pre_char` and append `post_char` to + the output in self.pieces.""" + self.add_text(pre_char) + self.subnode_parse(node) + self.add_text(post_char) + +# MARK: Helper functions + def get_specific_subnodes(self, node, name, recursive=0): + """Given a node and a name, return a list of child `ELEMENT_NODEs`, that + have a `tagName` matching the `name`. Search recursively for `recursive` + levels. + """ + children = [x for x in node.childNodes if x.nodeType == x.ELEMENT_NODE] + ret = [x for x in children if x.tagName == name] + if recursive > 0: + for x in children: + ret.extend(self.get_specific_subnodes(x, name, recursive-1)) + return ret def get_specific_nodes(self, node, names): """Given a node and a sequence of strings in `names`, return a @@ -139,167 +278,485 @@ def get_specific_nodes(self, node, names): `ELEMENT_NODEs`, that have a `tagName` equal to the name. """ - nodes = [(x.tagName, x) for x in node.childNodes \ - if x.nodeType == x.ELEMENT_NODE and \ + nodes = [(x.tagName, x) for x in node.childNodes + if x.nodeType == x.ELEMENT_NODE and x.tagName in names] return dict(nodes) - def generic_parse(self, node, pad=0): - """A Generic parser for arbitrary tags in a node. - - Parameters: + def add_text(self, value): + """Adds text corresponding to `value` into `self.pieces`.""" + if isinstance(value, (list, tuple)): + self.pieces.extend(value) + else: + self.pieces.append(value) - - node: A node in the DOM. - - pad: `int` (default: 0) + def start_new_paragraph(self): + """Make sure to create an empty line. This is overridden, if the previous + text ends with the special marker ''. In that case, nothing is done. + """ + if self.pieces[-1:] == ['']: # respect special marker + return + elif self.pieces == []: # first paragraph, add '\n', override with '' + self.pieces = ['\n'] + elif self.pieces[-1][-1:] != '\n': # previous line not ended + self.pieces.extend([' \n' ,'\n']) + else: #default + self.pieces.append('\n') + + def add_line_with_subsequent_indent(self, line, indent=4): + """Add line of text and wrap such that subsequent lines are indented + by `indent` spaces. + """ + if isinstance(line, (list, tuple)): + line = ''.join(line) + line = line.strip() + width = self.textwidth-self.indent-indent + wrapped_lines = textwrap.wrap(line[indent:], width=width) + for i in range(len(wrapped_lines)): + if wrapped_lines[i] != '': + wrapped_lines[i] = indent * ' ' + wrapped_lines[i] + self.pieces.append(line[:indent] + '\n'.join(wrapped_lines)[indent:] + ' \n') + + def extract_text(self, node): + """Return the string representation of the node or list of nodes by parsing the + subnodes, but returning the result as a string instead of adding it to `self.pieces`. + Note that this allows extracting text even if the node is in the ignore list. + """ + if not isinstance(node, (list, tuple)): + node = [node] + pieces, self.pieces = self.pieces, [''] + for n in node: + for sn in n.childNodes: + self.parse(sn) + ret = ''.join(self.pieces) + self.pieces = pieces + return ret - If 0 the node data is not padded with newlines. If 1 it - appends a newline after parsing the childNodes. If 2 it - pads before and after the nodes are processed. Defaults to - 0. + def get_function_signature(self, node): + """Returns the function signature string for memberdef nodes.""" + name = self.extract_text(self.get_specific_subnodes(node, 'name')) + if self.with_type_info: + argsstring = self.extract_text(self.get_specific_subnodes(node, 'argsstring')) + else: + argsstring = [] + param_id = 1 + for n_param in self.get_specific_subnodes(node, 'param'): + declname = self.extract_text(self.get_specific_subnodes(n_param, 'declname')) + if not declname: + declname = 'arg' + str(param_id) + defval = self.extract_text(self.get_specific_subnodes(n_param, 'defval')) + if defval: + defval = '=' + defval + argsstring.append(declname + defval) + param_id = param_id + 1 + argsstring = '(' + ', '.join(argsstring) + ')' + type = self.extract_text(self.get_specific_subnodes(node, 'type')) + function_definition = name + argsstring + if type != '' and type != 'void': + function_definition = function_definition + ' -> ' + type + return '`' + function_definition + '` ' + +# MARK: Special parsing tasks (need to be called manually) + def make_constructor_list(self, constructor_nodes, classname): + """Produces the "Constructors" section and the constructor signatures + (since swig does not do so for classes) for class docstrings.""" + if constructor_nodes == []: + return + self.add_text(['\n', 'Constructors', + '\n', '------------']) + for n in constructor_nodes: + self.add_text('\n') + self.add_line_with_subsequent_indent('* ' + self.get_function_signature(n)) + self.subnode_parse(n, pieces = [], indent=4, ignore=['definition', 'name']) + def make_attribute_list(self, node): + """Produces the "Attributes" section in class docstrings for public + member variables (attributes). """ - npiece = 0 - if pad: - npiece = len(self.pieces) - if pad == 2: - self.add_text('\n') - for n in node.childNodes: - self.parse(n) - if pad: - if len(self.pieces) > npiece: - self.add_text('\n') - - def space_parse(self, node): - self.add_text(' ') - self.generic_parse(node) - - do_ref = space_parse - do_emphasis = space_parse - do_bold = space_parse - do_computeroutput = space_parse - do_formula = space_parse - - def do_compoundname(self, node): - self.add_text('\n\n') - data = node.firstChild.data - self.add_text('%%feature("docstring") %s "\n'%data) + atr_nodes = [] + for n in self.get_specific_subnodes(node, 'memberdef', recursive=2): + if n.attributes['kind'].value == 'variable' and n.attributes['prot'].value == 'public': + atr_nodes.append(n) + if not atr_nodes: + return + self.add_text(['\n', 'Attributes', + '\n', '----------']) + for n in atr_nodes: + name = self.extract_text(self.get_specific_subnodes(n, 'name')) + self.add_text(['\n* ', '`', name, '`', ' : ']) + self.add_text(['`', self.extract_text(self.get_specific_subnodes(n, 'type')), '`']) + self.add_text(' \n') + restrict = ['briefdescription', 'detaileddescription'] + self.subnode_parse(n, pieces=[''], indent=4, restrict=restrict) + + def get_memberdef_nodes_and_signatures(self, node, kind): + """Collects the memberdef nodes and corresponding signatures that + correspond to public function entries that are at most depth 2 deeper + than the current (compounddef) node. Returns a dictionary with + function signatures (what swig expects after the %feature directive) + as keys, and a list of corresponding memberdef nodes as values.""" + sig_dict = {} + sig_prefix = '' + if kind in ('file', 'namespace'): + ns_node = node.getElementsByTagName('innernamespace') + if not ns_node and kind == 'namespace': + ns_node = node.getElementsByTagName('compoundname') + if ns_node: + sig_prefix = self.extract_text(ns_node[0]) + '::' + elif kind in ('class', 'struct'): + # Get the full function name. + cn_node = node.getElementsByTagName('compoundname') + sig_prefix = self.extract_text(cn_node[0]) + '::' + + md_nodes = self.get_specific_subnodes(node, 'memberdef', recursive=2) + for n in md_nodes: + if n.attributes['prot'].value != 'public': + continue + if n.attributes['kind'].value in ['variable', 'typedef']: + continue + if not self.get_specific_subnodes(n, 'definition'): + continue + name = self.extract_text(self.get_specific_subnodes(n, 'name')) + if name[:8] == 'operator': + continue + sig = sig_prefix + name + if sig in sig_dict: + sig_dict[sig].append(n) + else: + sig_dict[sig] = [n] + return sig_dict + + def handle_typical_memberdefs_no_overload(self, signature, memberdef_nodes): + """Produce standard documentation for memberdef_nodes.""" + for n in memberdef_nodes: + self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n']) + if self.with_function_signature: + self.add_line_with_subsequent_indent(self.get_function_signature(n)) + self.subnode_parse(n, pieces=[], ignore=['definition', 'name']) + self.add_text(['";', '\n']) - def do_compounddef(self, node): - kind = node.attributes['kind'].value - if kind in ('class', 'struct'): - prot = node.attributes['prot'].value - if prot <> 'public': - return - names = ('compoundname', 'briefdescription', - 'detaileddescription', 'includes') - first = self.get_specific_nodes(node, names) - for n in names: - if first.has_key(n): - self.parse(first[n]) - self.add_text(['";','\n']) - for n in node.childNodes: - if n not in first.values(): - self.parse(n) - elif kind in ('file', 'namespace'): - nodes = node.getElementsByTagName('sectiondef') - for n in nodes: - self.parse(n) + def handle_typical_memberdefs(self, signature, memberdef_nodes): + """Produces docstring entries containing an "Overloaded function" + section with the documentation for each overload, if the function is + overloaded and self.with_overloaded_functions is set. Else, produce + normal documentation. + """ + if len(memberdef_nodes) == 1 or not self.with_overloaded_functions: + self.handle_typical_memberdefs_no_overload(signature, memberdef_nodes) + return + self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n']) + if self.with_function_signature: + for n in memberdef_nodes: + self.add_line_with_subsequent_indent(self.get_function_signature(n)) + self.add_text('\n') + self.add_text(['Overloaded function', '\n', + '-------------------']) + for n in memberdef_nodes: + self.add_text('\n') + self.add_line_with_subsequent_indent('* ' + self.get_function_signature(n)) + self.subnode_parse(n, pieces=[], indent=4, ignore=['definition', 'name']) + self.add_text(['";', '\n']) + + +# MARK: Tag handlers + def do_linebreak(self, node): + self.add_text(' ') + + def do_ndash(self, node): + self.add_text('--') + + def do_mdash(self, node): + self.add_text('---') + + def do_emphasis(self, node): + self.surround_parse(node, '*', '*') + + def do_bold(self, node): + self.surround_parse(node, '**', '**') + + def do_computeroutput(self, node): + self.surround_parse(node, '`', '`') + + def do_heading(self, node): + self.start_new_paragraph() + pieces, self.pieces = self.pieces, [''] + level = int(node.attributes['level'].value) + self.subnode_parse(node) + if level == 1: + self.pieces.insert(0, '\n') + self.add_text(['\n', len(''.join(self.pieces).strip()) * '=']) + elif level == 2: + self.add_text(['\n', len(''.join(self.pieces).strip()) * '-']) + elif level >= 3: + self.pieces.insert(0, level * '#' + ' ') + # make following text have no gap to the heading: + pieces.extend([''.join(self.pieces) + ' \n', '']) + self.pieces = pieces + + def do_verbatim(self, node): + self.start_new_paragraph() + self.subnode_parse(node, pieces=[''], indent=4) + + def do_blockquote(self, node): + self.start_new_paragraph() + self.subnode_parse(node, pieces=[''], indent='> ') + + def do_hruler(self, node): + self.start_new_paragraph() + self.add_text('* * * * * \n') + def do_includes(self, node): - self.add_text('C++ includes: ') - self.generic_parse(node, pad=1) + self.add_text('\nC++ includes: ') + self.subnode_parse(node) + self.add_text('\n') +# MARK: Para tag handler + def do_para(self, node): + """This is the only place where text wrapping is automatically performed. + Generally, this function parses the node (locally), wraps the text, and + then adds the result to self.pieces. However, it may be convenient to + allow the previous content of self.pieces to be included in the text + wrapping. For this, use the following *convention*: + If self.pieces ends with '', treat the _previous_ entry as part of the + current paragraph. Else, insert new-line and start a new paragraph + and "wrapping context". + Paragraphs always end with ' \n', but if the parsed content ends with + the special symbol '', this is passed on. + """ + if self.pieces[-1:] == ['']: + pieces, self.pieces = self.pieces[:-2], self.pieces[-2:-1] + else: + self.add_text('\n') + pieces, self.pieces = self.pieces, [''] + self.subnode_parse(node) + dont_end_paragraph = self.pieces[-1:] == [''] + # Now do the text wrapping: + width = self.textwidth - self.indent + wrapped_para = [] + for line in ''.join(self.pieces).splitlines(): + keep_markdown_newline = line[-2:] == ' ' + w_line = textwrap.wrap(line, width=width, break_long_words=False) + if w_line == []: + w_line = [''] + if keep_markdown_newline: + w_line[-1] = w_line[-1] + ' ' + for wl in w_line: + wrapped_para.append(wl + '\n') + if wrapped_para: + if wrapped_para[-1][-3:] != ' \n': + wrapped_para[-1] = wrapped_para[-1][:-1] + ' \n' + if dont_end_paragraph: + wrapped_para.append('') + pieces.extend(wrapped_para) + self.pieces = pieces + +# MARK: List tag handlers + def do_itemizedlist(self, node): + if self.listitem == '': + self.start_new_paragraph() + elif self.pieces != [] and self.pieces[-1:] != ['']: + self.add_text('\n') + listitem = self.listitem + if self.listitem in ['*', '-']: + self.listitem = '-' + else: + self.listitem = '*' + self.subnode_parse(node) + self.listitem = listitem + + def do_orderedlist(self, node): + if self.listitem == '': + self.start_new_paragraph() + elif self.pieces != [] and self.pieces[-1:] != ['']: + self.add_text('\n') + listitem = self.listitem + self.listitem = 0 + self.subnode_parse(node) + self.listitem = listitem + + def do_listitem(self, node): + try: + self.listitem = int(self.listitem) + 1 + item = str(self.listitem) + '. ' + except: + item = str(self.listitem) + ' ' + self.subnode_parse(node, item, indent=4) + +# MARK: Parameter list tag handlers def do_parameterlist(self, node): - self.add_text(['\n', '\n', 'Parameters:', '\n']) - self.generic_parse(node, pad=1) + self.start_new_paragraph() + text = 'unknown' + for key, val in node.attributes.items(): + if key == 'kind': + if val == 'param': + text = 'Parameters' + elif val == 'exception': + text = 'Exceptions' + elif val == 'retval': + text = 'Returns' + else: + text = val + break + if self.indent == 0: + self.add_text([text, '\n', len(text) * '-', '\n']) + else: + self.add_text([text, ': \n']) + self.subnode_parse(node) - def do_para(self, node): - self.add_text('\n') - self.generic_parse(node, pad=1) + def do_parameteritem(self, node): + self.subnode_parse(node, pieces=['* ', '']) + def do_parameternamelist(self, node): + self.subnode_parse(node) + self.add_text([' :', ' \n']) + def do_parametername(self, node): - self.add_text('\n') - self.add_text("%s: "%node.firstChild.data) + if self.pieces != [] and self.pieces != ['* ', '']: + self.add_text(', ') + data = self.extract_text(node) + self.add_text(['`', data, '`']) - def do_parameterdefinition(self, node): - self.generic_parse(node, pad=1) + def do_parameterdescription(self, node): + self.subnode_parse(node, pieces=[''], indent=4) - def do_detaileddescription(self, node): - self.generic_parse(node, pad=1) +# MARK: Section tag handler + def do_simplesect(self, node): + kind = node.attributes['kind'].value + if kind in ('date', 'rcs', 'version'): + return + self.start_new_paragraph() + if kind == 'warning': + self.subnode_parse(node, pieces=['**Warning**: ',''], indent=4) + elif kind == 'see': + self.subnode_parse(node, pieces=['See also: ',''], indent=4) + elif kind == 'return': + if self.indent == 0: + pieces = ['Returns', '\n', len('Returns') * '-', '\n', ''] + else: + pieces = ['Returns:', '\n', ''] + self.subnode_parse(node, pieces=pieces) + else: + self.subnode_parse(node, pieces=[kind + ': ',''], indent=4) - def do_briefdescription(self, node): - self.generic_parse(node, pad=1) +# MARK: %feature("docstring") producing tag handlers + def do_compounddef(self, node): + """This produces %feature("docstring") entries for classes, and handles + class, namespace and file memberdef entries specially to allow for + overloaded functions. For other cases, passes parsing on to standard + handlers (which may produce unexpected results). + """ + kind = node.attributes['kind'].value + if kind in ('class', 'struct'): + prot = node.attributes['prot'].value + if prot != 'public': + return + self.add_text('\n\n') + classdefn = self.extract_text(self.get_specific_subnodes(node, 'compoundname')) + classname = classdefn.split('::')[-1] + self.add_text('%%feature("docstring") %s "\n' % classdefn) + + if self.with_constructor_list: + constructor_nodes = [] + for n in self.get_specific_subnodes(node, 'memberdef', recursive=2): + if n.attributes['prot'].value == 'public': + if self.extract_text(self.get_specific_subnodes(n, 'definition')) == classdefn + '::' + classname: + constructor_nodes.append(n) + for n in constructor_nodes: + self.add_line_with_subsequent_indent(self.get_function_signature(n)) + + names = ('briefdescription','detaileddescription') + sub_dict = self.get_specific_nodes(node, names) + for n in ('briefdescription','detaileddescription'): + if n in sub_dict: + self.parse(sub_dict[n]) + if self.with_constructor_list: + self.make_constructor_list(constructor_nodes, classname) + if self.with_attribute_list: + self.make_attribute_list(node) + + sub_list = self.get_specific_subnodes(node, 'includes') + if sub_list: + self.parse(sub_list[0]) + self.add_text(['";', '\n']) + + names = ['compoundname', 'briefdescription','detaileddescription', 'includes'] + self.subnode_parse(node, ignore = names) + elif kind in ('file', 'namespace'): + nodes = node.getElementsByTagName('sectiondef') + for n in nodes: + self.parse(n) + + # now explicitely handle possibly overloaded member functions. + if kind in ['class', 'struct','file', 'namespace']: + md_nodes = self.get_memberdef_nodes_and_signatures(node, kind) + for sig in md_nodes: + self.handle_typical_memberdefs(sig, md_nodes[sig]) + def do_memberdef(self, node): + """Handle cases outside of class, struct, file or namespace. These are + now dealt with by `handle_overloaded_memberfunction`. + Do these even exist??? + """ prot = node.attributes['prot'].value id = node.attributes['id'].value kind = node.attributes['kind'].value tmp = node.parentNode.parentNode.parentNode compdef = tmp.getElementsByTagName('compounddef')[0] cdef_kind = compdef.attributes['kind'].value + if cdef_kind in ('file', 'namespace', 'class', 'struct'): + # These cases are now handled by `handle_typical_memberdefs` + return + if prot != 'public': + return + first = self.get_specific_nodes(node, ('definition', 'name')) + name = self.extract_text(first['name']) + if name[:8] == 'operator': # Don't handle operators yet. + return + if not 'definition' in first or kind in ['variable', 'typedef']: + return - if prot == 'public': - first = self.get_specific_nodes(node, ('definition', 'name')) - name = first['name'].firstChild.data - if name[:8] == 'operator': # Don't handle operators yet. - return - - defn = first['definition'].firstChild.data - self.add_text('\n') - self.add_text('%feature("docstring") ') - - anc = node.parentNode.parentNode - if cdef_kind in ('file', 'namespace'): - ns_node = anc.getElementsByTagName('innernamespace') - if not ns_node and cdef_kind == 'namespace': - ns_node = anc.getElementsByTagName('compoundname') - if ns_node: - ns = ns_node[0].firstChild.data - self.add_text(' %s::%s "\n%s'%(ns, name, defn)) - else: - self.add_text(' %s "\n%s'%(name, defn)) - elif cdef_kind in ('class', 'struct'): - # Get the full function name. - anc_node = anc.getElementsByTagName('compoundname') - cname = anc_node[0].firstChild.data - self.add_text(' %s::%s "\n%s'%(cname, name, defn)) - - for n in node.childNodes: - if n not in first.values(): - self.parse(n) - self.add_text(['";', '\n']) - - def do_definition(self, node): - data = node.firstChild.data - self.add_text('%s "\n%s'%(data, data)) + data = self.extract_text(first['definition']) + self.add_text('\n') + self.add_text(['/* where did this entry come from??? */', '\n']) + self.add_text('%feature("docstring") %s "\n%s' % (data, data)) + for n in node.childNodes: + if n not in first.values(): + self.parse(n) + self.add_text(['";', '\n']) + +# MARK: Entry tag handlers (dont print anything meaningful) def do_sectiondef(self, node): kind = node.attributes['kind'].value - if kind in ('public-func', 'func'): - self.generic_parse(node) - - def do_simplesect(self, node): - kind = node.attributes['kind'].value - if kind in ('date', 'rcs', 'version'): - pass - elif kind == 'warning': - self.add_text(['\n', 'WARNING: ']) - self.generic_parse(node) - elif kind == 'see': - self.add_text('\n') - self.add_text('See: ') - self.generic_parse(node) - else: - self.generic_parse(node) - - def do_argsstring(self, node): - self.generic_parse(node, pad=1) + if kind in ('public-func', 'func', 'user-defined', ''): + self.subnode_parse(node) + + def do_header(self, node): + """For a user defined section def a header field is present + which should not be printed as such, so we comment it in the + output.""" + data = self.extract_text(node) + self.add_text('\n/*\n %s \n*/\n' % data) + # If our immediate sibling is a 'description' node then we + # should comment that out also and remove it from the parent + # node's children. + parent = node.parentNode + idx = parent.childNodes.index(node) + if len(parent.childNodes) >= idx + 2: + nd = parent.childNodes[idx + 2] + if nd.nodeName == 'description': + nd = parent.removeChild(nd) + self.add_text('\n/*') + self.subnode_parse(nd) + self.add_text('\n*/\n') def do_member(self, node): kind = node.attributes['kind'].value refid = node.attributes['refid'].value if kind == 'function' and refid[:9] == 'namespace': - self.generic_parse(node) + self.subnode_parse(node) def do_doxygenindex(self, node): self.multi = 1 @@ -309,63 +766,73 @@ def do_doxygenindex(self, node): fname = refid + '.xml' if not os.path.exists(fname): fname = os.path.join(self.my_dir, fname) - print "parsing file: %s"%fname - p = Doxy2SWIG(fname) + if not self.quiet: + print("parsing file: %s" % fname) + p = Doxy2SWIG(fname, + with_function_signature = self.with_function_signature, + with_type_info = self.with_type_info, + with_constructor_list = self.with_constructor_list, + with_attribute_list = self.with_attribute_list, + with_overloaded_functions = self.with_overloaded_functions, + textwidth = self.textwidth, + quiet = self.quiet) p.generate() - self.pieces.extend(self.clean_pieces(p.pieces)) - - def write(self, fname, mode='w'): - o = my_open_write(fname, mode) - if self.multi: - o.write("".join(self.pieces)) - else: - o.write("".join(self.clean_pieces(self.pieces))) - o.close() - - def clean_pieces(self, pieces): - """Cleans the list of strings given as `pieces`. It replaces - multiple newlines by a maximum of 2 and returns a new list. - It also wraps the paragraphs nicely. - - """ - ret = [] - count = 0 - for i in pieces: - if i == '\n': - count = count + 1 - else: - if i == '";': - if count: - ret.append('\n') - elif count > 2: - ret.append('\n\n') - elif count: - ret.append('\n'*count) - count = 0 - ret.append(i) - - _data = "".join(ret) - ret = [] - for i in _data.split('\n\n'): - if i == 'Parameters:': - ret.extend(['Parameters:\n-----------', '\n\n']) - elif i.find('// File:') > -1: # leave comments alone. - ret.extend([i, '\n']) - else: - _tmp = textwrap.fill(i.strip()) - _tmp = self.lead_spc.sub(r'\1"\2', _tmp) - ret.extend([_tmp, '\n\n']) - return ret - - -def main(input, output): - p = Doxy2SWIG(input) + self.pieces.extend(p.pieces) + +# MARK: main +def main(): + usage = __doc__ + parser = optparse.OptionParser(usage) + parser.add_option("-f", '--function-signature', + action='store_true', + default=False, + dest='f', + help='include function signature in the documentation. This is handy when not using swig auto-generated function definitions %feature("autodoc", [0,1])') + parser.add_option("-t", '--type-info', + action='store_true', + default=False, + dest='t', + help='include type information for arguments in function signatures. This is similar to swig autodoc level 1') + parser.add_option("-c", '--constructor-list', + action='store_true', + default=False, + dest='c', + help='generate a constructor list for class documentation. Useful for target languages where the object construction should be documented in the class documentation.') + parser.add_option("-a", '--attribute-list', + action='store_true', + default=False, + dest='a', + help='generate an attributes list for class documentation. Useful for target languages where class attributes should be documented in the class documentation.') + parser.add_option("-o", '--overloaded-functions', + action='store_true', + default=False, + dest='o', + help='collect all documentation for overloaded functions. Useful for target languages that have no concept of overloaded functions, but also to avoid having to attach the correct docstring to each function overload manually') + parser.add_option("-w", '--width', type="int", + action='store', + dest='w', + default=80, + help='textwidth for wrapping (default: 80). Note that the generated lines may include 2 additional spaces (for markdown).') + parser.add_option("-q", '--quiet', + action='store_true', + default=False, + dest='q', + help='be quiet and minimize output') + + options, args = parser.parse_args() + if len(args) != 2: + parser.error("no input and output specified") + + p = Doxy2SWIG(args[0], + with_function_signature = options.f, + with_type_info = options.t, + with_constructor_list = options.c, + with_attribute_list = options.a, + with_overloaded_functions = options.o, + textwidth = options.w, + quiet = options.q) p.generate() - p.write(output) - + p.write(args[1]) if __name__ == '__main__': - if len(sys.argv) != 3: - print __doc__ - sys.exit(1) - main(sys.argv[1], sys.argv[2]) + main() diff --git a/manual/mainpage.dox b/manual/mainpage.dox index 154ff8a1..c4418790 100644 --- a/manual/mainpage.dox +++ b/manual/mainpage.dox @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////// /// @mainpage -/// libSBOL 2.2.0 +/// libSBOL 2.3.0 /// ====================================== /// /// [libSBOL](https://github.com/SynBioDex/libSBOL) is a C++ library for reading, writing, and constructing genetic designs according to the standardized specification of the [Synthetic Biology Open Language (SBOL)](http://www.sbolstandard.org/). diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index a8c96cee..3e6e3d4d 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -2,12 +2,21 @@ add_subdirectory( raptor ) # gather headers +if( RASQAL_LIBRARY AND SBOL_BUILD_RASQAL ) + include_directories( ${RASQAL_INCLUDE_DIR}) + ADD_DEFINITIONS(-DHAVE_LIBRASQAL) + SET(RASQAL_HEADERS RasqalDataGraph.hh RasqalQueryResults.hh + PtrWrapper.hh SharedPtrWrapper.hh) + SET(RASQAL_SOURCES RasqalDataGraph.cc RasqalQueryResults.cc) +endif() + include_directories( ${RAPTOR_INCLUDE_DIR}) include_directories( ${JsonCpp_INCLUDE_DIR}) include_directories( ${CURL_INCLUDE_DIR}) +include_directories( ${OPENSSL_INCLUDE_DIR}) if( SBOL_BUILD_PYTHON2 ) find_package( SWIG REQUIRED ) - find_package( PythonLibs 2 EXACT) + find_package( PythonLibs 2) include_directories( ${PYTHON_INCLUDE_DIR} ) ADD_DEFINITIONS(-DSBOL_BUILD_PYTHON2) endif() @@ -17,6 +26,9 @@ if( SBOL_BUILD_PYTHON3 ) include_directories( ${PYTHON_INCLUDE_DIR} ) ADD_DEFINITIONS(-DSBOL_BUILD_PYTHON3) endif() +if( SBOL_BUILD_MANYLINUX ) + add_definitions(-DSBOL_BUILD_MANYLINUX) +endif() # gather source files FILE(GLOB SBOL_HEADER_FILES @@ -50,7 +62,11 @@ FILE(GLOB SBOL_HEADER_FILES dbtl.h attachment.h implementation.h - sbol.h) + experiment.h + sbol.h + ${RASQAL_HEADERS} + ) + FILE(GLOB SBOL_SOURCE_FILES sbolerror.cpp config.cpp @@ -62,7 +78,9 @@ FILE(GLOB SBOL_SOURCE_FILES document.cpp assembly.cpp partshop.cpp - dbtl.cpp) + dbtl.cpp + ${RASQAL_SOURCES}) + FILE(COPY ${SBOL_HEADER_FILES} DESTINATION ${HEADER_OUTPUT_PATH} ) @@ -225,6 +243,8 @@ else () # If Mac OSX or Linux target_link_libraries(sbol32 ${RAPTOR_LIBRARY} ${CURL_LIBRARY} + ${OPENSSL_LIBRARY} # linux only + ${CRYPTO_LIBRARY} # linux only ${LIBXSLT_LIBRARIES} ${JsonCpp_LIBRARY}) set_target_properties(sbol32 PROPERTIES @@ -269,6 +289,8 @@ else () # If Mac OSX or Linux target_link_libraries(sbol64 ${RAPTOR_LIBRARY} ${CURL_LIBRARY} + ${OPENSSL_LIBRARY} # linux only + ${CRYPTO_LIBRARY} # linux only ${LIBXSLT_LIBRARIES} ${JsonCpp_LIBRARY}) set_target_properties(sbol64 PROPERTIES diff --git a/source/PtrWrapper.hh b/source/PtrWrapper.hh new file mode 100644 index 00000000..e9850633 --- /dev/null +++ b/source/PtrWrapper.hh @@ -0,0 +1,61 @@ +#ifndef PTRWRAPPER_HH +#define PTRWRAPPER_HH + +#include + +// This class wraps a "C" pointer and a free() function for the +// pointer. If the free() function (deleter) is set, it is called on +// the wrapped pointer when this class is destroyed +template +class PtrWrapper +{ + T *m_ptr; + std::function m_deleter; + +public: + template + PtrWrapper(T *ptr, D &deleter) : m_ptr(ptr), m_deleter(deleter) { + } + + PtrWrapper(T *ptr) : m_ptr(ptr), m_deleter(NULL) { + } + + PtrWrapper() : m_ptr(NULL), m_deleter(NULL) { + } + + template + void setDeleter(D &deleter) { + m_deleter = deleter; + } + + PtrWrapper &operator=(const PtrWrapper &rhs) { + if(m_ptr != NULL) { + if(m_deleter != NULL) { + m_deleter(m_ptr); + } + } + + m_ptr = rhs.m_ptr; + m_deleter = rhs.m_deleter; + + return *this; + } + + PtrWrapper(const PtrWrapper ©) : m_ptr(copy.m_ptr), + m_deleter(copy.m_deleter) { + } + + ~PtrWrapper() { + if(m_ptr != NULL) { + if(m_deleter != NULL) { + m_deleter(m_ptr); + } + } + } + + operator T*() { + return m_ptr; + } +}; + +#endif diff --git a/source/RasqalDataGraph.cc b/source/RasqalDataGraph.cc new file mode 100644 index 00000000..841da905 --- /dev/null +++ b/source/RasqalDataGraph.cc @@ -0,0 +1,89 @@ +#include +#include + +#include "RasqalDataGraph.hh" + +RasqalDataGraph::RasqalDataGraph(const std::string &fName, raptor_uri *nameURI) +{ + m_rasqalWorld = rasqal_new_world(); + m_rasqalWorld.setDeleter(rasqal_free_world); + if(m_rasqalWorld == NULL) + { + // Note this will cause rasqal_free_world() to be called + m_rasqalWorld = NULL; + throw std::runtime_error("rasqal_new_world() failed"); + } + + int res = rasqal_world_open(m_rasqalWorld); + if(res != 0) + { + // Note this will cause rasqal_free_world() to be called + m_rasqalWorld = NULL; + throw std::runtime_error("Failed to open rasqal world"); + } + + const unsigned char *uri = NULL; + uri = raptor_uri_filename_to_uri_string(fName.c_str()); + + raptor_world *raptorWorld = rasqal_world_get_raptor(m_rasqalWorld); + m_baseURI = raptor_new_uri(raptorWorld, uri); + m_baseURI.setDeleter(raptor_free_uri); + raptor_free_memory((void *)uri); + + m_dataGraph = rasqal_new_data_graph_from_uri(m_rasqalWorld, + /* source URI */ m_baseURI, + /* name URI */ NULL, + RASQAL_DATA_GRAPH_NAMED, + NULL, NULL, NULL); + + m_dataGraph.setDeleter(rasqal_free_data_graph); + if(m_dataGraph == NULL) + { + // Note this will cause rasqal_free_world() to be called + m_rasqalWorld = NULL; + // Note this will cause rasqal_free_uri() to be called + m_baseURI = NULL; + throw std::runtime_error("Failed to create data graph"); + } +} + +RasqalQueryResults RasqalDataGraph::query(const std::string &queryString) const +{ + rasqal_query *rasqalQuery = + rasqal_new_query(m_rasqalWorld, "sparql", NULL); + + if(rasqalQuery == NULL) + { + throw std::runtime_error("rasqual_new_query() failed"); + } + + int res = rasqal_query_prepare(rasqalQuery, + (const unsigned char *)queryString.c_str(), + m_baseURI); + if(res != 0) + { + rasqal_free_query(rasqalQuery); + throw std::runtime_error("Failed to prepare query"); + } + + rasqal_data_graph *dg = rasqal_new_data_graph_from_data_graph(m_dataGraph); + + res = rasqal_query_add_data_graph(rasqalQuery, dg); + if(res != 0) + { + rasqal_free_data_graph(dg); + rasqal_free_query(rasqalQuery); + throw std::runtime_error("Failed to add data graph to the query"); + } + + rasqal_query_results *results = rasqal_query_execute(rasqalQuery); + + if(results == NULL) + { + rasqal_free_data_graph(dg); + rasqal_free_query(rasqalQuery); + throw std::runtime_error("Query failed!"); + } + + return RasqalQueryResults(m_rasqalWorld, rasqalQuery, results); +} diff --git a/source/RasqalDataGraph.hh b/source/RasqalDataGraph.hh new file mode 100644 index 00000000..5dfa9cba --- /dev/null +++ b/source/RasqalDataGraph.hh @@ -0,0 +1,53 @@ +#ifndef RASQALDATAGRAPH_CC +#define RASQALDATAGRAPH_CC + +#include + +#include +#include + +#include "SharedPtrWrapper.hh" +#include "RasqalQueryResults.hh" + +class RasqalDataGraph +{ + // Note the order is important here. The objects will be deleted + // in the opposite order they are listed. + SharedPtrWrapper m_rasqalWorld; + SharedPtrWrapper m_baseURI; + SharedPtrWrapper m_dataGraph; + +public: + RasqalDataGraph(const std::string &fName, raptor_uri *nameURI = NULL); + RasqalDataGraph() {}; + + RasqalDataGraph(const RasqalDataGraph &src) : m_rasqalWorld(src.m_rasqalWorld) { + m_dataGraph = rasqal_new_data_graph_from_data_graph(src.m_dataGraph); + m_baseURI = raptor_uri_copy(src.m_baseURI); + } + + RasqalDataGraph &operator=(const RasqalDataGraph &rhs) { + // m_dataGraph and m_baseURI are copied, and m_rasqalWorld is shared + m_dataGraph = rasqal_new_data_graph_from_data_graph(rhs.m_dataGraph); + m_baseURI = raptor_uri_copy(rhs.m_baseURI); + m_rasqalWorld = rhs.m_rasqalWorld; + + return *this; + } + + rasqal_world *rasqalWorld() const { + return m_rasqalWorld; + } + + raptor_world *raptorWorld() const { + return rasqal_world_get_raptor(m_rasqalWorld); + } + + rasqal_data_graph *dataGraph() const { + return m_dataGraph; + } + + RasqalQueryResults query(const std::string &queryString) const; +}; + +#endif diff --git a/source/RasqalQueryResults.cc b/source/RasqalQueryResults.cc new file mode 100644 index 00000000..b24196bd --- /dev/null +++ b/source/RasqalQueryResults.cc @@ -0,0 +1,45 @@ +#include + +#include "RasqalQueryResults.hh" + +void RasqalQueryResults::loadBindingResults() +{ + if(m_results == NULL) + { + return; + } + + while(!rasqal_query_results_finished(m_results)) + { + int i; + std::map bindingResults; + + for(i = 0; i < rasqal_query_results_get_bindings_count(m_results); i++) + { + const unsigned char *name = rasqal_query_results_get_binding_name(m_results, i); + rasqal_literal *value = rasqal_query_results_get_binding_value(m_results, i); + bindingResults[(const char *)name] = value; + } + + m_bindingResults.push_back(bindingResults); + rasqal_query_results_next(m_results); + } + +} + +void RasqalQueryResults::printBindings() +{ + int count = 0; + for(auto &bindingResult : m_bindingResults) + { + for(auto result: bindingResult) + { + printf("result %d: variable %s=", count+1, + result.first.c_str()); + rasqal_literal_print(result.second, stdout); + putchar('\n'); + } + printf("\n"); + count++; + } +} diff --git a/source/RasqalQueryResults.hh b/source/RasqalQueryResults.hh new file mode 100644 index 00000000..29f2e80b --- /dev/null +++ b/source/RasqalQueryResults.hh @@ -0,0 +1,77 @@ +#ifndef RASQALQUERY_HH +#define RASQALQUERY_HH + +#include +#include +#include +#include +#include + +#include +#include "SharedPtrWrapper.hh" + +class RasqalQueryResults +{ +public: + typedef std::vector> BindingResults; + +private: + // Note the order is important here. The objects will be deleted + // in the opposite order they are listed. + SharedPtrWrapper m_rasqalWorld; + SharedPtrWrapper m_query; + SharedPtrWrapper m_results; + + BindingResults m_bindingResults; + + void loadBindingResults(); + +public: + + RasqalQueryResults() { + } + + RasqalQueryResults(SharedPtrWrapper rasqalWorld, + rasqal_query *query, + rasqal_query_results *results) : m_rasqalWorld(rasqalWorld), + m_query(query), + m_results(results) { + m_rasqalWorld.setDeleter(rasqal_free_world); + m_results.setDeleter(rasqal_free_query_results); + m_query.setDeleter(rasqal_free_query); + loadBindingResults(); + } + + RasqalQueryResults &operator=(const RasqalQueryResults &rhs) { + m_bindingResults = rhs.m_bindingResults; + + // Note the order is important here. The query can not be deleted + // after the query results + m_results = rhs.m_results; + m_query = rhs.m_query; + m_rasqalWorld = rhs.m_rasqalWorld; + + return *this; + } + + rasqal_query_results *results() const { + return m_results; + } + + const BindingResults & bindingResults() const { + return m_bindingResults; + } + + + rasqal_query_results_type type() const { + if(m_results == NULL) { + return RASQAL_QUERY_RESULTS_UNKNOWN; + } + + return rasqal_query_results_get_type(m_results); + } + + void printBindings(); +}; + +#endif diff --git a/source/SharedPtrWrapper.hh b/source/SharedPtrWrapper.hh new file mode 100644 index 00000000..dd8072b1 --- /dev/null +++ b/source/SharedPtrWrapper.hh @@ -0,0 +1,40 @@ +#ifndef SHAREDPTRWAPPER_HH +#define SHAREDPTRWAPPER_HH + +#include +#include "PtrWrapper.hh" + +// This class, along with PtrWrapper, manage an opaque "C" pointer. +// Refernce counting is used to automatically free the "C" pointer +// when it is no longer referenced. +template +class SharedPtrWrapper +{ + typedef std::shared_ptr> WrapT; + + WrapT m_wrapped; + +public: + SharedPtrWrapper() { + m_wrapped = WrapT(new PtrWrapper(NULL)); + } + + SharedPtrWrapper(T *ptr) { + m_wrapped = WrapT(new PtrWrapper(ptr)); + } + + template + void setDeleter(D &deleter) { + m_wrapped->setDeleter(deleter); + } + + operator T*() const { + return *m_wrapped.get(); + } + + T* operator->() const { + return *m_wrapped.get(); + } +}; + +#endif diff --git a/source/a.txt b/source/a.txt new file mode 100644 index 00000000..1abad310 --- /dev/null +++ b/source/a.txt @@ -0,0 +1,2 @@ +test3 +test diff --git a/source/assembly.cpp b/source/assembly.cpp index 7d4a3cf9..e083d359 100644 --- a/source/assembly.cpp +++ b/source/assembly.cpp @@ -228,7 +228,7 @@ std::string ComponentDefinition::updateSequence(std::string composite_sequence) // assemble(list_of_components, doc); //} -void ComponentDefinition::assemble(vector list_of_uris) +void ComponentDefinition::assemble(vector& list_of_uris, string assembly_standard) { if (Config::getOption("sbol_compliant_uris").compare("False") == 0) throw SBOLError(SBOL_ERROR_COMPLIANCE, "Assemble methods require SBOL-compliance enabled"); @@ -246,27 +246,38 @@ void ComponentDefinition::assemble(vector list_of_uris) assemble(list_of_components); } -void ComponentDefinition::assemblePrimaryStructure(vector primary_structure) +void ComponentDefinition::assemblePrimaryStructure(vector& primary_structure, string assembly_standard) { - assemble(primary_structure); - linearize(primary_structure); + if (Config::getOption("sbol_compliant_uris").compare("False") == 0) + throw SBOLError(SBOL_ERROR_COMPLIANCE, "Assemble methods require SBOL-compliance enabled"); + if (doc == NULL) + { + throw SBOLError(SBOL_ERROR_MISSING_DOCUMENT, "Cannot perform assembly operation on ComponentDefinition because it does not belong to a Document. You may pass a Document as an optional second argument to this method. Otherwise add this ComponentDefinition to a Document"); + } + ComponentDefinition& parent_component = *this; + std::vector list_of_components; + for (auto & uri : primary_structure) + { + ComponentDefinition& cdef = doc->componentDefinitions.get(uri); + list_of_components.push_back(&cdef); + } + assemblePrimaryStructure(list_of_components, assembly_standard); }; -void ComponentDefinition::assemblePrimaryStructure(vector primary_structure) +void ComponentDefinition::assemblePrimaryStructure(vector& primary_structure, string assembly_standard) { - assemble(primary_structure); + assemble(primary_structure, assembly_standard); linearize(primary_structure); }; -void ComponentDefinition::assemblePrimaryStructure(vector primary_structure, Document& doc) +void ComponentDefinition::assemblePrimaryStructure(vector& primary_structure, Document& doc, string assembly_standard) { - assemble(primary_structure, doc); + assemble(primary_structure, doc, assembly_standard); linearize(primary_structure); }; - /// @TODO update SequenceAnnotation starts and ends -void ComponentDefinition::assemble(vector list_of_components, Document& doc) +void ComponentDefinition::assemble(vector& list_of_components, Document& doc, string assembly_standard) { if (Config::getOption("sbol_compliant_uris").compare("False") == 0) throw SBOLError(SBOL_ERROR_COMPLIANCE, "Assemble methods require SBOL-compliance enabled"); @@ -274,7 +285,50 @@ void ComponentDefinition::assemble(vector list_of_componen ComponentDefinition& parent_component = *this; if (parent_component.doc == NULL) doc.add(parent_component); - + + if (assembly_standard == IGEM_STANDARD_ASSEMBLY) + { + ComponentDefinition* scar; + ComponentDefinition* alternate_scar; + ComponentDefinition* scar_instance; + try + { + scar = &doc.componentDefinitions.create("scar"); + Sequence* scar_seq = &doc.sequences.create("scar_seq"); + scar_seq->elements.set("tactagag"); + scar->sequences.set(scar_seq->identity.get()); + } + catch(SBOLError& e) + { + scar = &doc.componentDefinitions["scar"]; + } + try + { + alternate_scar = &doc.componentDefinitions.create("alternate_scar"); + Sequence* alternate_scar_seq = &doc.sequences.create("alternate_scar_seq"); + alternate_scar_seq->elements.set("tactag"); + alternate_scar->sequences.set(alternate_scar_seq->identity.get()); + } + catch(SBOLError& e) + { + alternate_scar = &doc.componentDefinitions["alternate_scar"]; + } + vector temp_list_of_components = list_of_components; + list_of_components.clear(); + for (int i = 0; i < (temp_list_of_components.size() - 1); ++i) + { + ComponentDefinition& cd_upstream = *temp_list_of_components[i]; + ComponentDefinition& cd_downstream = *temp_list_of_components[i+1]; + if (cd_upstream.roles.size() && cd_downstream.roles.size() && cd_upstream.roles.get() == SO_RBS && cd_downstream.roles.get() == SO_CDS) + scar_instance = alternate_scar; + else + scar_instance = scar; + list_of_components.push_back(&cd_upstream); + list_of_components.push_back(scar_instance); + } + list_of_components.push_back(temp_list_of_components[temp_list_of_components.size() - 1]); + } + vector list_of_instances = {}; for (auto i_com = 0; i_com != list_of_components.size(); i_com++) { @@ -308,14 +362,14 @@ void ComponentDefinition::assemble(vector list_of_componen } -void ComponentDefinition::assemble(vector list_of_components) +void ComponentDefinition::assemble(vector& list_of_components, string assembly_standard) { // Throw an error if this ComponentDefinition is not attached to a Document if (doc == NULL) { - throw SBOLError(SBOL_ERROR_MISSING_DOCUMENT, "Cannot perform assembly operation on ComponentDefinition because it does not belong to a Document. You may pass a Document as an optional second argument to this method. Otherwise add this ComponentDefinition to a Document"); + throw SBOLError(SBOL_ERROR_MISSING_DOCUMENT, "Cannot perform assembly operation on ComponentDefinition because it does not belong to a Document."); } - assemble(list_of_components, *doc); + assemble(list_of_components, *doc, assembly_standard); } std::string Sequence::compile() @@ -324,6 +378,36 @@ std::string Sequence::compile() return elements.get(); } +std::string ComponentDefinition::compile() +{ + if (doc == NULL) + { + throw SBOLError(SBOL_ERROR_MISSING_DOCUMENT, "Cannot perform compile operation on ComponentDefinition because it does not belong to a Document."); + } + Sequence* seq; + if (sequences.size() == 0) + { + if (Config::getOption("sbol_compliant_uris") == "True") + { + seq = &doc->sequences.create(displayId.get()); + sequence.set(*seq); + sequences.set(seq->identity.get()); + + } else + { + seq = &doc->sequences.create(identity.get() + "_seq"); + sequence.set(*seq); + sequences.set(seq->identity.get()); + } + } + else + { + seq = &doc->get(sequences.get()); + } + return seq->compile(); +} + + ComponentDefinition& Sequence::synthesize(std::string clone_id) { // Throw an error if this Sequence is not attached to a Document @@ -431,11 +515,26 @@ string Sequence::assemble(string composite_sequence) else if (parent_component.components.size() > 1) { // Recurse into subcomponents and assemble their sequence + size_t composite_sequence_initial_size = composite_sequence.size(); vector subcomponents = parent_component.getInSequentialOrder(); for (auto i_c = subcomponents.begin(); i_c != subcomponents.end(); i_c++) { Component& c = **i_c; ComponentDefinition& cdef = doc->get < ComponentDefinition > (c.definition.get()); + if (cdef.sequences.size() == 0) + { + if (Config::getOption("sbol_compliant_uris") == "True") + { + Sequence& seq = doc->sequences.create(cdef.displayId.get()); + cdef.sequence.set(seq); + cdef.sequences.set(seq.identity.get()); + } else + { + Sequence& seq = doc->sequences.create(cdef.identity.get() + "_seq"); + cdef.sequence.set(seq); + cdef.sequences.set(seq.identity.get()); + } + } Sequence& seq = doc->get < Sequence > (cdef.sequences.get()); // Check for regularity -- only one SequenceAnnotation per Component is allowed @@ -447,13 +546,28 @@ string Sequence::assemble(string composite_sequence) if (sequence_annotations.size() == 0) { string sa_id; + int sa_instance = 0; if (Config::getOption("sbol_compliant_uris") == "True") sa_id = cdef.displayId.get(); else sa_id = cdef.identity.get(); - SequenceAnnotation& sa = parent_component.sequenceAnnotations.create(sa_id + "_annotation"); - sa.component.set(c); - sequence_annotations.push_back((SBOLObject*)&sa); + SequenceAnnotation* sa = NULL; + while (sa == NULL) + { + try + { + sa = &parent_component.sequenceAnnotations.create(sa_id + "_annotation_" + to_string(sa_instance)); + } + catch(SBOLError& e) + { + if (e.error_code() == SBOL_ERROR_URI_NOT_UNIQUE) + ++sa_instance; + else + throw SBOLError(e.error_code(), e.what()); + } + } + sa->component.set(c); + sequence_annotations.push_back((SBOLObject*)sa); } SequenceAnnotation& sa = *(SequenceAnnotation*)sequence_annotations[0]; @@ -485,18 +599,22 @@ string Sequence::assemble(string composite_sequence) r.start.set((int)composite_sequence.size() + 1); composite_sequence = composite_sequence + seq.assemble(composite_sequence); // Recursive call + //composite_sequence = composite_sequence + seq.assemble(); // Recursive call r.end.set((int)composite_sequence.size()); } - - elements.set(composite_sequence); - return composite_sequence; + string subsequence = composite_sequence.substr(composite_sequence_initial_size, composite_sequence.size()); + elements.set(subsequence); + return subsequence; } else { std::string parent_component_seq = parent_component.sequences.get(); Sequence& seq = doc->get < Sequence >(parent_component.sequences.get()); - return seq.elements.get(); + if (seq.elements.size() == 0) + return ""; + else + return seq.elements.get(); } }; @@ -1037,6 +1155,51 @@ vector ComponentDefinition::applyToComponentHierarchy(void return component_nodes; }; +vector ModuleDefinition::applyToModuleHierarchy(void (*callback_fn)(ModuleDefinition *, void *), void* user_data) +{ + /* Assumes parent_component is an SBOL data structure of the general form ComponentDefinition(->Component->ComponentDefinition)n where n+1 is an integer describing how many hierarchical levels are in the SBOL structure */ + /* Look at each of the ComponentDef's SequenceAnnotations, is the target base there? */ + if (!doc) + throw SBOLError(SBOL_ERROR_MISSING_DOCUMENT, "Cannot traverse Component hierarchy without a Document"); + + bool GET_ALL = true; + vector module_nodes; + if (modules.size() == 0) + { + // cout << "Adding subcomponent : " << identity.get() << endl; + module_nodes.push_back(this); // Add leaf components + if (callback_fn) + callback_fn(this, user_data); + } + else + { + if (GET_ALL) + { + // cout << "Adding subcomponent : " << identity.get() << endl; + module_nodes.push_back(this); // Add components with children + if (callback_fn) + callback_fn(this, user_data); + } + for (auto& subm : modules) + { + if (!doc->find(subm.definition.get())) + { + // std::cout << "Not found" << std::endl; + throw SBOLError(SBOL_ERROR_NOT_FOUND, subm.definition.get() + "not found"); + } + ModuleDefinition& submdef = doc->get(subm.definition.get()); + // std::cout << subcdef.identity.get() << std::endl; + // cout << "Descending one level : " << subcdef.identity.get() << endl; + vector < sbol::ModuleDefinition* > submodules = submdef.applyToModuleHierarchy(callback_fn, user_data); + // cout << "Found " << subcomponents.size() << " components" << std::endl; + module_nodes.reserve(module_nodes.size() + distance(submodules.begin(), submodules.end())); + module_nodes.insert(module_nodes.end(), submodules.begin(),submodules.end()); + } + } + return module_nodes; +}; + + bool SequenceAnnotation::precedes(SequenceAnnotation& comparand) { if (locations.size() > 0 && comparand.locations.size() > 0) @@ -2266,7 +2429,7 @@ void ComponentDefinition::linearize(std::vector primary_st } if (components.size() != primary_structure.size()) { - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Invalid primary structure provided. This ComponentDefinition must contain a number of Components corresponding to the length of the primary structure"); + // throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Invalid primary structure provided. This ComponentDefinition must contain a number of Components corresponding to the length of the primary structure"); } if (sequenceConstraints.size()) { diff --git a/source/attachment.h b/source/attachment.h index 585f225b..a13d27a8 100644 --- a/source/attachment.h +++ b/source/attachment.h @@ -38,7 +38,7 @@ namespace sbol /// Construct an Attachment /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param source A file URI - Attachment(std::string uri = "example", std::string source = "", std::string version = "1.0.0") : Attachment(SBOL_ATTACHMENT, uri, source, version) {}; + Attachment(std::string uri = "example", std::string source = "", std::string version = VERSION_STRING) : Attachment(SBOL_ATTACHMENT, uri, source, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one diff --git a/source/collection.h b/source/collection.h index 2aab1a5b..03d8e654 100644 --- a/source/collection.h +++ b/source/collection.h @@ -41,7 +41,7 @@ namespace sbol /// Construct a Collection /// @param uri If operating in open-world mode, this should be a full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. - Collection(std::string uri = "example", std::string version = "1.0.0") : Collection(SBOL_COLLECTION, uri, version) {}; + Collection(std::string uri = "example", std::string version = VERSION_STRING) : Collection(SBOL_COLLECTION, uri, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one diff --git a/source/combinatorialderivation.h b/source/combinatorialderivation.h index 8ef83a24..f14e23b5 100644 --- a/source/combinatorialderivation.h +++ b/source/combinatorialderivation.h @@ -10,7 +10,7 @@ namespace sbol /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param repeat A URI indicating how many `Component` objects can be derived from the template `Component` - VariableComponent(std::string uri = "example", std::string repeat = "http://sbols.org/v2#one", std::string version = "1.0.0") : VariableComponent(SBOL_VARIABLE_COMPONENT, uri, repeat, version) {}; + VariableComponent(std::string uri = "example", std::string repeat = "http://sbols.org/v2#one", std::string version = VERSION_STRING) : VariableComponent(SBOL_VARIABLE_COMPONENT, uri, repeat, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one @@ -18,9 +18,9 @@ namespace sbol Identified(type, uri, version), variable(this, SBOL_VARIABLE, SBOL_COMPONENT, '0', '1', ValidationRules({})), repeat(this, SBOL_OPERATOR, '1', '1', ValidationRules({}), repeat), - variants(this, SBOL_VARIANTS, SBOL_COMPONENT_DEFINITION, '0', '1', ValidationRules({})), - variantCollections(this, SBOL_VARIANT_COLLECTIONS, SBOL_COLLECTION, '0', '1', ValidationRules({})), - variantDerivations(this, SBOL_VARIANT_DERIVATIONS, SBOL_COMBINATORIAL_DERIVATION, '0', '1', ValidationRules({})) + variants(this, SBOL_VARIANTS, SBOL_COMPONENT_DEFINITION, '0', '*', ValidationRules({})), + variantCollections(this, SBOL_VARIANT_COLLECTIONS, SBOL_COLLECTION, '0', '*', ValidationRules({})), + variantDerivations(this, SBOL_VARIANT_DERIVATIONS, SBOL_COMBINATORIAL_DERIVATION, '0', '*', ValidationRules({})) { }; @@ -53,7 +53,7 @@ namespace sbol /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param strategy A URI indicating SBOL_ENUMERATE or SBOL_SAMPLE - CombinatorialDerivation(std::string uri = "example", std::string strategy = "http://sbols.org/v2#enumerate", std::string version = "1.0.0") : CombinatorialDerivation(SBOL_COMBINATORIAL_DERIVATION, uri, strategy, version) {}; + CombinatorialDerivation(std::string uri = "example", std::string strategy = "http://sbols.org/v2#enumerate", std::string version = VERSION_STRING) : CombinatorialDerivation(SBOL_COMBINATORIAL_DERIVATION, uri, strategy, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one diff --git a/source/component.h b/source/component.h index d8b9f819..30e19823 100644 --- a/source/component.h +++ b/source/component.h @@ -93,7 +93,7 @@ namespace sbol /// @param definition A URI referring to the ComponentDefinition that defines this instance /// @param access Flag indicating whether the Component can be referred to remotely by a MapsTo /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string of the form "major.minor.patch". - Component(std::string uri = "example", std::string definition = "", std::string access = SBOL_ACCESS_PUBLIC, std::string version = "1.0.0") : + Component(std::string uri = "example", std::string definition = "", std::string access = SBOL_ACCESS_PUBLIC, std::string version = VERSION_STRING) : Component(SBOL_COMPONENT, uri, definition, access, version) {}; // Component(std::string uri_prefix, std::string display_id, std::string version, std::string definition,std::string access) : Component(SBOL_COMPONENT, uri_prefix, display_id, version, definition, access) {}; @@ -129,7 +129,7 @@ namespace sbol /// @param access Flag indicating whether the FunctionalComponent can be referred to remotely by a MapsTo /// @param direction The direction property specifies whether a FunctionalComponent serves as an input, output, both, or neither for its parent ModuleDefinition object /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string of the form "major.minor.patch". - FunctionalComponent(std::string uri = "example", std::string definition = "", std::string access = SBOL_ACCESS_PUBLIC, std::string direction = SBOL_DIRECTION_NONE, std::string version = "1.0.0") : FunctionalComponent(SBOL_FUNCTIONAL_COMPONENT, uri, definition, access, direction, version) {}; + FunctionalComponent(std::string uri = "example", std::string definition = "", std::string access = SBOL_ACCESS_PUBLIC, std::string direction = SBOL_DIRECTION_NONE, std::string version = VERSION_STRING) : FunctionalComponent(SBOL_FUNCTIONAL_COMPONENT, uri, definition, access, direction, version) {}; // FunctionalComponent(std::string uri_prefix, std::string display_id, std::string version, std::string definition, std::string access, std::string direction) : FunctionalComponent(SBOL_FUNCTIONAL_COMPONENT, uri_prefix, display_id, version, definition, access, direction) {}; diff --git a/source/componentdefinition.h b/source/componentdefinition.h index a683419a..13432903 100644 --- a/source/componentdefinition.h +++ b/source/componentdefinition.h @@ -50,7 +50,7 @@ namespace sbol /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param type A BioPAX ontology term that indicates whether the ComponentDefinition is DNA, RNA, protein, or some other molecule type. /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string of the form "major.minor.patch". - ComponentDefinition(std::string uri = "example", std::string type = BIOPAX_DNA, std::string version = "1.0.0") : ComponentDefinition(SBOL_COMPONENT_DEFINITION, uri, type, version) {}; + ComponentDefinition(std::string uri = "example", std::string type = BIOPAX_DNA, std::string version = VERSION_STRING) : ComponentDefinition(SBOL_COMPONENT_DEFINITION, uri, type, version) {}; /// Constructor used for defining extension classes /// @param type The RDF type for an extension class derived from this one @@ -58,12 +58,14 @@ namespace sbol TopLevel(type, uri, version), types(this, SBOL_TYPES, '1', '*', ValidationRules({}), component_type), roles(this, SBOL_ROLES, '0', '*', ValidationRules({})), - sequence(this, SBOL_SEQUENCE_PROPERTY, SBOL_SEQUENCE, '0', '1', ValidationRules({})), - sequences(this, SBOL_SEQUENCE_PROPERTY, SBOL_SEQUENCE, '0', '*', ValidationRules({})), + // sequence(this, SBOL_SEQUENCE_PROPERTY, SBOL_SEQUENCE, '0', '1', ValidationRules({})), + sequence(this, SBOL_SEQUENCE, '0', '1', ValidationRules({ libsbol_rule_20 })), + sequences(this, SBOL_SEQUENCE_PROPERTY, SBOL_SEQUENCE, '0', '*', ValidationRules({ libsbol_rule_21 })), sequenceAnnotations(this, SBOL_SEQUENCE_ANNOTATIONS, '0', '*', ValidationRules({})), components(this, SBOL_COMPONENTS, '0', '*', ValidationRules({})), sequenceConstraints(this, SBOL_SEQUENCE_CONSTRAINTS, '0', '*', ValidationRules({})) { + hidden_properties.push_back(SBOL_SEQUENCE); }; /// The types property is a REQUIRED set of URIs that specifies the category of biochemical or physical entity (for example DNA, protein, or small molecule) that a ComponentDefinition object abstracts for the purpose of engineering design. The types property of every ComponentDefinition MUST contain one or more URIs that MUST identify terms from appropriate ontologies, such as the BioPAX ontology or the ontology of Chemical Entities of Biological Interest. See the table below for examples. @@ -97,7 +99,7 @@ namespace sbol /// The sequences property is OPTIONAL and MAY include a URI that refer to a Sequence object. The referenced object defines the primary structure of the ComponentDefinition. ReferencedObject sequences; - ReferencedObject sequence; + OwnedObject sequence; /// The sequenceAnnotations property is OPTIONAL and MAY contain a set of SequenceAnnotation objects. Each SequenceAnnotation specifies and describes a potentially discontiguous region on the Sequence objects referred to by the ComponentDefinition. OwnedObject sequenceAnnotations; @@ -107,29 +109,38 @@ namespace sbol /// Assembles ComponentDefinitions into an abstraction hierarchy. The resulting data structure is a partial design, still lacking a primary structure or explicit sequence. To form a primary structure out of the ComponentDefinitions, call linearize after calling assemble. To fully realize the target sequence, use Sequence::assemble(). /// @param list_of_components A list of subcomponents that will compose this ComponentDefinition - void assemble(std::vector list_of_components); + /// @param assembly_standard An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence + void assemble(std::vector& list_of_components, std::string assembly_standard = ""); /// Assembles ComponentDefinitions into an abstraction hierarchy. The resulting data structure is a partial design, still lacking a primary structure or explicit sequence. To form a primary structure out of the ComponentDefinitions, call linearize after calling assemble. To fully realize the target sequence, use Sequence::assemble(). /// @param list_of_components A list of subcomponents that will compose this ComponentDefinition /// @param doc The Document to which the assembled ComponentDefinitions will be added - void assemble(std::vector list_of_components, Document& doc); + /// @param assembly_standard An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence + void assemble(std::vector& list_of_components, Document& doc, std::string assembly_standard = ""); /// Assembles ComponentDefinition into a linear primary structure. The resulting data structure is a partial design, still lacking an explicit sequence. To fully realize the target sequence, use Sequence::assemble(). /// @param primary_structure A list of URIs for the constituent ComponentDefinitions, or displayIds if using SBOL-compliant URIs - void assemblePrimaryStructure(std::vector primary_structure); + /// @param assembly_standard An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence + void assemblePrimaryStructure(std::vector& primary_structure, std::string assembly_standard = ""); /// Assembles ComponentDefinition into a linear primary structure. The resulting data structure is a partial design, still lacking an explicit sequence. To fully realize the target sequence, use Sequence::assemble(). /// @param list_of_components A list of subcomponents that will compose this ComponentDefinition - void assemblePrimaryStructure(std::vector primary_structure); + /// @param assembly_standard An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence + void assemblePrimaryStructure(std::vector& primary_structure, std::string assembly_standard = ""); /// Assembles ComponentDefinition into a linear primary structure. The resulting data structure is a partial design, still lacking an explicit sequence. To fully realize the target sequence, use Sequence::assemble(). /// @param list_of_components A list of subcomponents that will compose this ComponentDefinition /// @param doc The Document to which the assembled ComponentDefinitions will be added - void assemblePrimaryStructure(std::vector primary_structure, Document& doc); + /// @param assembly_standard An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence + void assemblePrimaryStructure(std::vector& primary_structure, Document& doc, std::string assembly_standard = ""); /// Assembles ComponentDefinitions into an abstraction hierarchy. The resulting data structure is a partial design, still lacking a primary structure or explicit sequence. To form a primary structure out of the ComponentDefinitions, call linearize after calling assemble. To fully realize the target sequence, use Sequence::assemble(). /// @param list_of_uris A list of URIs for the constituent ComponentDefinitions, or displayIds if using SBOL-compliant URIs - void assemble(std::vector list_of_uris); + /// @param assembly_standard An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence + void assemble(std::vector& list_of_uris, std::string assembly_standard = ""); + + /// Compiles an abstraction hierarchy of ComponentDefinitions into a nucleotide sequence. If no Sequence object is associated with this ComponentDefinition, one will be automatically instantiated + std::string compile(); /// Assemble a parent ComponentDefinition's Sequence from its subcomponent Sequences /// @param composite_sequence A recursive parameter, use default value diff --git a/source/config.cpp b/source/config.cpp index 08104976..c4413b68 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -49,7 +49,7 @@ std::map sbol::Config::options { {"homespace", "http://examples.org"}, {"sbol_compliant_uris", "True"}, {"sbol_typed_uris", "True"}, - {"output_format", "rdfxml"}, + {"serialization_format", "sbol"}, {"validate", "True"}, {"validator_url", "http://www.async.ece.utah.edu/validate/"}, {"language", "SBOL2"}, @@ -72,7 +72,7 @@ std::map sbol::Config::options { std::map> sbol::Config::valid_options { {"sbol_compliant_uris", {"True", "False"}}, {"sbol_typed_uris", { "True", "False" }}, - {"output_format", {"rdfxml", "json"}}, + {"serialization_format", {"sbol", "rdfxml", "json", "ntriples"}}, {"validate", { "True", "False" }}, {"language", { "SBOL2", "FASTA", "GenBank" }}, {"test_equality", { "True", "False" }}, @@ -86,8 +86,55 @@ std::map> sbol::Config::valid_options { {"verbose", { "True", "False" }} }; +std::map sbol::Config::extension_namespaces {}; + #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) std::map sbol::Config::PYTHON_DATA_MODEL_REGISTER {}; + +void sbol::Config::register_extension_class(PyObject* python_class, std::string extension_name) +{ + // Construct a dummy object and parse its RDF type + string rdf_type; + try + { + PyObject* py_obj = PyObject_CallFunction(python_class, NULL); + PyObject* py_string = PyObject_GetAttr(py_obj, PyUnicode_FromString("type")); + if (PyUnicode_Check(py_string)) + { + PyObject * temp_bytes = PyUnicode_AsEncodedString(py_string, "UTF-8", "strict"); // Owned reference + if (temp_bytes != NULL) + { + char* result = PyBytes_AS_STRING(temp_bytes); // Borrowed pointer + rdf_type = string(strdup(result)); + Py_DECREF(temp_bytes); + } + } + else if (PyBytes_Check(py_string)) + { + char* result = PyBytes_AS_STRING(py_string); // Borrowed pointer + rdf_type = string(strdup(result)); + } + Py_DECREF(py_string); + Py_DECREF(py_obj); + } + catch(...) + { + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Registration of extension class failed. Extension classes must have a valid RDF type and default constructor"); + } + + // Register the extension's prefix and namespace + if (Config::extension_namespaces.find(extension_name) == Config::extension_namespaces.end()) + { + Config::extension_namespaces[extension_name] = parseNamespace(rdf_type); + } + else if (Config::extension_namespaces[extension_name] != parseNamespace(rdf_type)) + { + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Registration of extension class failed. This extension is already registered to a different namespace"); + } + + // Register the class constructor + Config::PYTHON_DATA_MODEL_REGISTER[rdf_type] = python_class; +}; #endif void sbol::Config::setOption(std::string option, char const* value) @@ -95,7 +142,6 @@ void sbol::Config::setOption(std::string option, char const* value) Config::setOption(option, std::string(value)); } - void sbol::Config::setOption(std::string option, std::string value) { if (options.find(option) != options.end()) @@ -346,6 +392,48 @@ std::string sbol::getFileFormat() return config.getFileFormat(); }; +int sbol::getTime() +{ + time_t curtime; + struct tm * GMT; + string stamp; + + time(&curtime); + GMT = gmtime(&curtime); + curtime = mktime(GMT); + stamp = string(ctime(&curtime)); + stamp.erase(stamp.length()-1, 1); + + // // Split date string at delimiter (adapted from C++ cookbook) + // char delimiter = ' '; + // vector tokens; + // string::size_type i = 0; + // string::size_type j = stamp.find(delimiter); + + // while (j != string::npos) + // { + // string token = stamp.substr(i, j - i); + // if (token != " ") + // tokens.push_back(token); + // i = ++j; + // j = stamp.find(delimiter, j); + // if (j == string::npos) + // tokens.push_back(stamp.substr(i, stamp.length())); + // } + + + // Split date string at delimiter (adapted from C++ cookbook) + char delimiter = ':'; + string::size_type i = stamp.find(delimiter); + string hours = stamp.substr(i-2, 2); + string minutes = stamp.substr(i+1, 2); + i = stamp.find(delimiter, i+1); + string seconds = stamp.substr(i+1, 2); + + int total_seconds = stoi(hours)*3600 + stoi(minutes)*60 + stoi(seconds); + return total_seconds; +}; + void Config::setHomespace(std::string ns) { options["homespace"] = ns; @@ -368,6 +456,8 @@ void Config::setFileFormat(std::string file_format) { if (file_format.compare("json") == 0) this->format = "json"; + else if (file_format == "ntriples") + this->format = "ntriples"; else this->format = "rdfxml"; }; @@ -399,17 +489,20 @@ size_t sbol::CurlWrite_CallbackFunc_StdString(void *contents, size_t size, size_ size_t sbol::CurlResponseHeader_CallbackFunc(char *buffer, size_t size, size_t nitems, void *userdata) { - std::unordered_map& headers = *(std::unordered_map*)userdata; - size_t header_length = size * nitems; - std::string header = std::string(buffer); - std::size_t delimiter_pos = header.find(':'); - if (delimiter_pos != std::string::npos) + if (userdata) { - std::string key = header.substr(0, delimiter_pos); - std::string val = header.substr(delimiter_pos + 1, header_length - 2 - delimiter_pos); - headers[key] = val; + std::unordered_map& headers = *(std::unordered_map*)userdata; + size_t header_length = size * nitems; + std::string header = std::string(buffer); + std::size_t delimiter_pos = header.find(':'); + if (delimiter_pos != std::string::npos) + { + std::string key = header.substr(0, delimiter_pos); + std::string val = header.substr(delimiter_pos + 1, header_length - 2 - delimiter_pos); + headers[key] = val; + } + //userdata = &headers; } - userdata = &headers; return size * nitems; }; diff --git a/source/config.h b/source/config.h index cfd997a0..555a0011 100644 --- a/source/config.h +++ b/source/config.h @@ -60,10 +60,13 @@ namespace sbol private: static std::map options; static std::map> valid_options; + static std::map extension_namespaces; + std::string home; ///< The authoritative namespace for the Document. Setting the home namespace is like signing a piece of paper. int SBOLCompliantTypes; ///< Flag indicating whether an object's type is included in SBOL-compliant URIs int catch_exceptions = 0; std::string format = "rdfxml"; + #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) // This is the global SBOL register for Python extension classes. It maps an SBOL RDF type (eg, "http://sbolstandard.org/v2#Sequence" to a Python constructor // static PyObject* PYTHON_DATA_MODEL_REGISTER = PyDict_New(); @@ -113,6 +116,13 @@ namespace sbol /// Get current option value for online validation and conversion /// @param option The option key static std::string getOption(std::string option); + +#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) + + static void register_extension_class(PyObject* python_class, std::string extension_name); + +#endif + }; /// Global methods @@ -134,12 +144,12 @@ namespace sbol std::string SBOL_DECLSPEC parsePropertyName(std::string uri); std::string SBOL_DECLSPEC parseNamespace(std::string uri); std::string SBOL_DECLSPEC parseURLDomain(std::string url); + int SBOL_DECLSPEC getTime(); size_t CurlWrite_CallbackFunc_StdString(void *contents, size_t size, size_t nmemb, std::string *s); size_t CurlResponseHeader_CallbackFunc(char *buffer, size_t size, size_t nitems, void *userdata); /// @endcond - } #endif /* CONFIG_INCLUDED */ diff --git a/source/constants.h b/source/constants.h index a88b4bbe..c0ca7dbf 100644 --- a/source/constants.h +++ b/source/constants.h @@ -42,7 +42,7 @@ #define NODENAME_ABOUT "rdf:about" #define NODENAME_RESOURCE "rdf:resource" -#define VERSION_STRING "1.0.0" +#define VERSION_STRING "1" /* URIs for SBOL objects */ #define SBOL_DOCUMENT SBOL_URI "#Document" @@ -72,6 +72,9 @@ #define SBOL_COMBINATORIAL_DERIVATION SBOL_URI "#CombinatorialDerivation" #define SBOL_ATTACHMENT SBOL_URI "#Attachment" #define SBOL_IMPLEMENTATION SBOL_URI "#Implementation" +#define SBOL_EXPERIMENT SBOL_URI "#Experiment" +#define SBOL_EXPERIMENTAL_DATA SBOL_URI "#ExperimentalData" + #define UNDEFINED SBOL_URI "#Undefined" /* URIs for SBOL Properties */ @@ -118,7 +121,7 @@ #define SBOL_MEMBERS SBOL_URI "#member" #define SBOL_AT SBOL_URI "#at" #define SBOL_OPERATOR SBOL_URI "#operator" -#define SBOL_VARIABLE_COMPONENTS SBOL_URI "#variableComponents" +#define SBOL_VARIABLE_COMPONENTS SBOL_URI "#variableComponent" #define SBOL_VARIABLE SBOL_URI "#variable" #define SBOL_VARIANTS SBOL_URI "#variants" #define SBOL_VARIANT_COLLECTIONS SBOL_URI "#variantCollections" @@ -242,4 +245,6 @@ #define SYSBIO_ANALYSIS SYSBIO_URI "#Analysis" #define SYSBIO_SAMPLE_ROSTER SYSBIO_URI "#SampleRoster" -#endif \ No newline at end of file +#define IGEM_URI "http://wiki.synbiohub.org/wiki/Terms/igem" +#define IGEM_STANDARD_ASSEMBLY IGEM_URI "#assembly/RFC10" +#endif diff --git a/source/dbtl.cpp b/source/dbtl.cpp index 899e1b44..dcb76138 100644 --- a/source/dbtl.cpp +++ b/source/dbtl.cpp @@ -34,26 +34,26 @@ using namespace sbol; namespace sbol { - Design::~Design() - { - // Remove these properties to prevent double deletion of child objects by the base destructor - owned_objects.erase(SBOL_COMPONENT_DEFINITION); - owned_objects.erase(SBOL_MODULE_DEFINITION); - } + // Design::~Design() + // { + // // Remove these properties to prevent double deletion of child objects by the base destructor + // // owned_objects.erase(SBOL_COMPONENT_DEFINITION); + // // owned_objects.erase(SBOL_MODULE_DEFINITION); + // } - Build::~Build() - { - // Remove these properties to prevent double deletion of child objects by the base destructor - owned_objects.erase(SBOL_COMPONENT_DEFINITION); - owned_objects.erase(SBOL_MODULE_DEFINITION); - } + // Build::~Build() + // { + // // Remove these properties to prevent double deletion of child objects by the base destructor + // // owned_objects.erase(SBOL_COMPONENT_DEFINITION); + // // owned_objects.erase(SBOL_MODULE_DEFINITION); + // } - Analysis::~Analysis() - { - // Remove these properties to prevent double deletion of child objects by the base destructor - owned_objects.erase(SYSBIO_URI "#consensusSequence"); - owned_objects.erase(SYSBIO_URI "#model"); - } + // Analysis::~Analysis() + // { + // // Remove these properties to prevent double deletion of child objects by the base destructor + // // owned_objects.erase(SYSBIO_URI "#consensusSequence"); + // // owned_objects.erase(SYSBIO_URI "#model"); + // } /* Specialized templates for Design, Build, Test, Analysis workflows */ @@ -133,7 +133,7 @@ namespace sbol // Auto-construct Association Association& asc = a.associations.create(id + "_generation_association"); asc.roles.set(SBOL_URI "#design"); - asc.agent.set(plan); + asc.agent.set(agent); asc.plan.set(plan); for (auto & usage : usages) @@ -152,6 +152,7 @@ namespace sbol else u.roles.set(SBOL_DESIGN); } + return design; }; @@ -338,8 +339,9 @@ namespace sbol else id = test.identity.get(); Association& asc = a.associations.create(id + "_generation_association"); - asc.plan.set(plan); asc.roles.set(SBOL_URI "#test"); + asc.agent.set(agent); + asc.plan.set(plan); // Check if the progenitor object is a SampleRoster (collection of Builds) if (properties.find(SYSBIO_URI "#type") != properties.end()) @@ -455,65 +457,79 @@ namespace sbol }; - template<> - Design& OwnedObject::get(std::string uri) - { - Design& design = (Design&)get(uri); - Document* doc = this->sbol_owner->doc; - if (doc) - { - if (!design.structure.size() && design._structure.size()) - if (doc->find(design._structure.get())) - design.structure.set(doc->get(design._structure.get())); - if (!design.function.size() && design._function.size()) - if (doc->find(design._function.get())) - design.function.set(doc->get(design._function.get())); - } - return design; - } + // template<> + // Design& OwnedObject::get(std::string uri) + // { - template<> - Build& OwnedObject::get(std::string uri) - { - Build& build = (Build&)get(uri); - Document* doc = this->sbol_owner->doc; - if (doc) - { - if (!build.structure.size() && build._structure.size()) - if (doc->find(build._structure.get())) - build.structure.set(doc->get(build._structure.get())); - if (!build.behavior.size() && build._behavior.size()) - if (doc->find(build._behavior.get())) - build.behavior.set(doc->get(build._behavior.get())); - } - return build; - } + // }; + + // template<> + // Design& OwnedObject::operator[] (std::string uri) + // { + // }; + + // template<> + // Design& OwnedObject::operator[] (const int nIndex) + // { + // }; + + // template<> + // Build& OwnedObject::get(std::string uri) + // { + + // }; + + // template<> + // Build& OwnedObject::operator[] (std::string uri) + // { + // }; + + // template<> + // Build& OwnedObject::operator[] (const int nIndex) + // { + // }; - template<> - Design& Document::get(std::string uri) - { - Design& design = (Design&)get(uri); - if (!design.structure.size() && design._structure.size()) - if (this->find(design._structure.get())) - design.structure.set(doc->get(design._structure.get())); - if (!design.function.size() && design._function.size()) - if (this->find(design._function.get())) - design.function.set(doc->get(design._function.get())); - return design; - } + // template<> + // Design& Document::get(std::string uri) + // { + // Design& design = (Design&)get(uri); + // if (!design.structure.size() && design._structure.size()) + // if (this->find(design._structure.get())) + // { + // ComponentDefinition& structure = doc->get(design._structure.get()); + // design.owned_objects[SBOL_COMPONENT_DEFINITION].push_back(&structure); + // // design.structure.set(doc->get(design._structure.get())); + // } + // if (!design.function.size() && design._function.size()) + // if (this->find(design._function.get())) + // { + // ModuleDefinition& function = doc->get(design._function.get()); + // design.owned_objects[SBOL_MODULE_DEFINITION].push_back(&function); + // // design.function.set(doc->get(design._function.get())); + // } + // return design; + // } - template<> - Build& Document::get(std::string uri) - { - Build& build = (Build&)get(uri); - if (!build.structure.size() && build._structure.size()) - if (this->find(build._structure.get())) - build.structure.set(doc->get(build._structure.get())); - if (!build.behavior.size() && build._behavior.size()) - if (this->find(build._behavior.get())) - build.behavior.set(doc->get(build._behavior.get())); - return build; - } + // template<> + // Build& Document::get(std::string uri) + // { + // Build& build = (Build&)get(uri); + // if (!build.structure.size() && build._structure.size()) + // if (doc->find(build._structure.get())) + // { + // ComponentDefinition& structure = doc->get(build._structure.get()); + // build.owned_objects[SBOL_COMPONENT_DEFINITION].push_back(&structure); + // //build.structure.set(doc->get(build._structure.get())); + // } + // if (!build.behavior.size() && build._behavior.size()) + // if (doc->find(build._behavior.get())) + // { + // ModuleDefinition& behavior = doc->get(build._behavior.get()); + // build.owned_objects[SBOL_URI "#built"].push_back(&behavior); + // // build.behavior.set(doc->get(build._behavior.get())); + // } + // return build; + // } // The Build class requires a specialized adder at the Document level. Since its rdf:type is identical to Implementation, it will get added to the Implementation store by default. It must be moved to the Build store. template<> @@ -736,8 +752,8 @@ namespace sbol void addQCAnnotations(ComponentDefinition& target, ComponentDefinition& construct) { - Sequence& target_s = target.doc->get(target.sequence.get()); - Sequence& construct_s = construct.doc->get(construct.sequence.get()); + Sequence& target_s = target.doc->get(target.sequences.get()); + Sequence& construct_s = construct.doc->get(construct.sequences.get()); string target_sequence = target_s.elements.get(); string verified_sequence = construct_s.elements.get(); @@ -892,10 +908,10 @@ namespace sbol throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot verify target, because the Design does not specify a target Sequence or the Sequence is not in the Document."); ComponentDefinition& design_structure = design.structure.get(); - if (!design_structure.sequence.size() || !doc->sequences.find(design_structure.sequence.get())) + if (!design_structure.sequence.size() || !doc->sequences.find(design_structure.sequences.get())) throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot verify target because the Design does not specify a target Sequence or the Sequence is not in the Document."); - Sequence& target = doc->get(design_structure.sequence.get()); + Sequence& target = doc->get(design_structure.sequences.get()); string target_sequence = target.elements.get(); string verified_sequence = consensus.elements.get(); if (target_sequence.size() != verified_sequence.size()) @@ -1103,7 +1119,7 @@ namespace sbol } // Calculate cumulative statistics at the highest level of the component hierarchy. - Sequence& target_seq = target.doc->get(target.sequence.get()); + Sequence& target_seq = target.doc->get(target.sequences.get()); SequenceAnnotation target_sa = SequenceAnnotation("temporary"); Range& r = target_sa.locations.create("r"); r.start.set(1); diff --git a/source/dbtl.h b/source/dbtl.h index cb938d39..8acb0004 100644 --- a/source/dbtl.h +++ b/source/dbtl.h @@ -85,7 +85,7 @@ namespace sbol ReferencedObject characterization; // The destructor is over-ridden here thus preventing objects in the structure and function containers from being freed - ~Design() override; + virtual ~Design() {}; private: ReferencedObject _structure; @@ -99,8 +99,15 @@ namespace sbol template<> Design& TopLevel::generate(std::string uri, Agent& agent, Plan& plan, std::vector < Identified* > usages); - template<> - Design& OwnedObject::get(std::string uri); + // template<> + // Design& OwnedObject::get(std::string uri); + + // template<> + // Design& OwnedObject::operator[] (std::string uri); + + // template<> + // Design& OwnedObject::operator[] (const int nIndex); + /// A Build is a realization of a Design. For practical purposes, a Build can represent a biological clone, a plasmid, or other laboratory sample. For a given Design, there may be multiple Builds realized in the lab. A Build represents the second step in libSBOL's formalized Design-Build-Test-Analyze workflow. class Build : public Implementation @@ -173,9 +180,9 @@ namespace sbol OwnedObject < ModuleDefinition > behavior; // The destructor is over-ridden here thus preventing objects in the structure and function containers from being freed - ~Build() override; + virtual ~Build() {}; - private: + // private: URIProperty sysbio_type; ReferencedObject _structure; ReferencedObject _behavior; @@ -187,8 +194,14 @@ namespace sbol template<> Build& TopLevel::generate(std::string uri, Agent& agent, Plan& plan, std::vector < Identified* > usages); - template<> - Build& OwnedObject::get(std::string uri); + // template<> + // Build& OwnedObject::get(std::string uri); + + // template<> + // Build& OwnedObject::operator[] (std::string uri); + + // template<> + // Build& OwnedObject::operator[] (const int nIndex); /// A Test is a container for experimental data. A Test is the product of the third step of libSBOL's formalized Design-Build-Test-Analyze workflow class Test : public Collection @@ -225,6 +238,8 @@ namespace sbol /// References to file Attachments which contain experimental data sets ReferencedObject dataFiles; + + virtual ~Test() {}; }; template<> @@ -282,7 +297,7 @@ namespace sbol std::unordered_map < std::string, std::tuple < int, int, float > > reportAmbiguity(); - ~Analysis() override; + virtual ~Analysis() {}; private: ReferencedObject _consensusSequence; ReferencedObject _fittedModel; @@ -476,6 +491,11 @@ namespace sbol std::size_t size = this->sbol_owner->owned_objects[this->alias].size(); return (int)size; } + + int __len__() + { + return this->size(); + } }; // class RepressorModule : public ModuleDefinition @@ -677,7 +697,9 @@ namespace sbol class EnzymeCatalysisInteraction : public Interaction { public: - EnzymeCatalysisInteraction(std::string uri, ComponentDefinition& enzyme, std::vector substrates, std::vector products, std::vector cofactors = {}, std::vector sideproducts = {}) : + EnzymeCatalysisInteraction(std::string uri, ComponentDefinition& enzyme, std::vector substrates, std::vector products) : EnzymeCatalysisInteraction(uri, enzyme, substrates, products, {}, {}) {}; + + EnzymeCatalysisInteraction(std::string uri, ComponentDefinition& enzyme, std::vector substrates, std::vector products, std::vector cofactors, std::vector sideproducts) : Interaction(SBOL_INTERACTION, uri, SBO_CONVERSION), enzyme(this, SBOL_FUNCTIONAL_COMPONENTS, SYSBIO_URI "#enzyme", '0', '1', ValidationRules({})), substrates(this, SBOL_FUNCTIONAL_COMPONENTS, SYSBIO_URI "#substrates", '0', '*', ValidationRules({})), diff --git a/source/document.cpp b/source/document.cpp index de9f0d2a..ebd46453 100644 --- a/source/document.cpp +++ b/source/document.cpp @@ -27,16 +27,23 @@ #include "document.h" #include + +#ifdef HAVE_LIBRASQAL +#include "RasqalDataGraph.hh" +#include "RasqalQueryResults.hh" +#endif + #include #include +#include #include #include #include #include #include #include -#include + #include #include #include @@ -45,49 +52,133 @@ #include "Python.h" #endif + using namespace sbol; using namespace std; -void Document::parse_extension_objects() +void Document::dress_document() { + // Infer resource namespaces in order to enable retrieval of SBOL-compliant OwnedObjects by displayId + for (auto & o : SBOLObjects) + { + Identified* obj = dynamic_cast(o.second); + // Check if compliant URI + if (obj != NULL && obj->persistentIdentity.size() && obj->displayId.size() && obj->version.size()) + { + string uri = obj->identity.get(); + string sbol_compliant_pattern = "/" + obj->displayId.get() + "/" + obj->version.get(); + string sbol_typed_pattern = "/" + parseClassName(obj->type) + sbol_compliant_pattern; + size_t found = uri.find(sbol_typed_pattern); + if (found != std::string::npos) + { + string ns = uri.substr(0, found); + resource_namespaces.insert(ns); + continue; + } + found = uri.find(sbol_compliant_pattern); + if (found != std::string::npos) + { + string ns = uri.substr(0, found); + resource_namespaces.insert(ns); + } + } + } + // Look in Implementation store for objects with sys-bio:type and move them to Build store - vector& implementation_store = owned_objects[SBOL_IMPLEMENTATION]; - vector& build_store = owned_objects[SYSBIO_BUILD]; - implementation_store.erase( std::remove_if(implementation_store.begin(), implementation_store.end(), [&](SBOLObject* i) - { - if (i->properties.find(SYSBIO_URI "#type") != i->properties.end() && i->properties[SYSBIO_URI "#type"].front() == "<" SYSBIO_BUILD ">") - { - build_store.push_back(i); - return true; - } - return false; - }), implementation_store.end()); + vector build_ids; + for (auto & i : owned_objects[SBOL_IMPLEMENTATION]) + if (i->properties.find(SYSBIO_URI "#type") != i->properties.end() && i->properties[SYSBIO_URI "#type"].front() == "<" SYSBIO_BUILD ">") + build_ids.push_back(i->identity.get()); + for (auto & id : build_ids) + { + Implementation& i = this->implementations.remove(id); + Build& b = i. template cast(); + this->add(b); + i.close(); + } // Look in Collection store for objects with sys-bio:type and move them to Test store - vector& collection_store = owned_objects[SBOL_COLLECTION]; - vector& test_store = owned_objects[SYSBIO_TEST]; - collection_store.erase( std::remove_if(collection_store.begin(), collection_store.end(), [&](SBOLObject* c) - { - if (c->properties.find(SYSBIO_URI "#type") != c->properties.end() && c->properties[SYSBIO_URI "#type"].front() == "<" SYSBIO_TEST ">") - { - test_store.push_back(c); - return true; - } - return false; - }), collection_store.end()); + vector test_ids; + for (auto & c : owned_objects[SBOL_COLLECTION]) + if (c->properties.find(SYSBIO_URI "#type") != c->properties.end() && c->properties[SYSBIO_URI "#type"].front() == "<" SYSBIO_TEST ">") + test_ids.push_back(c->identity.get()); + for (auto & id : test_ids) + { + Collection& c = this->collections.remove(id); + Test& t = c. template cast(); + this->add(t); + c.close(); + } // Look in Collection store for objects with sys-bio:type and move them to SampleRoster store - vector& roster_store = owned_objects[SYSBIO_URI "#SampleRoster"]; - collection_store.erase( std::remove_if(collection_store.begin(), collection_store.end(), [&](SBOLObject* c) + vector roster_ids; + for (auto & c : owned_objects[SBOL_COLLECTION]) + if (c->properties.find(SYSBIO_URI "#type") != c->properties.end() && c->properties[SYSBIO_URI "#type"].front() == "<" SYSBIO_TEST ">") + roster_ids.push_back(c->identity.get()); + for (auto & id : roster_ids) + { + Collection& c = this->collections.remove(id); + SampleRoster& sr = c. template cast(); + this->add(sr); + c.close(); + } + + auto &mySequences = owned_objects[sequences.getTypeURI()]; + + std::map sequenceCacheMap; + for(auto &sbolObj : mySequences) { + sequenceCacheMap[sbolObj->identity.get()] = (Sequence *)sbolObj; + } + + // Populate hidden properties. This is hardcoded for now, but in the future it should be generalized for all hidden properties. + for (auto & cd : this->componentDefinitions) + { + if (cd.sequence.size() == 0 && cd.sequences.size() == 1) { - if (c->properties.find(SYSBIO_URI "#type") != c->properties.end() && c->properties[SYSBIO_URI "#type"].front() == "<" SYSBIO_SAMPLE_ROSTER ">") + auto uri = cd.sequences.get(); + + auto findResult = sequenceCacheMap.find(uri); + if(findResult != sequenceCacheMap.end()) { - roster_store.push_back(c); - return true; + cd.sequence.set_notoplevelcheck(*findResult->second); } - return false; - }), collection_store.end()); + } + } + + for (auto & a : this->activities) + { + if (a.associations.size() == 1) + { + Association& asc = a.associations.get(); + if (a.agent.size() == 0 && asc.agent.size() && this->agents.find(asc.agent.get())) + a.agent.set(this->agents.get(asc.agent.get())); + if (a.plan.size() == 0 && asc.plan.size() && this->plans.find(asc.plan.get())) + a.plan.set(this->plans.get(asc.plan.get())); + } + } + for (auto & d : this->designs) + { + if (d.structure.size() == 0 && d._structure.size() && this->componentDefinitions.find(d._structure.get())) + d.structure.set(this->componentDefinitions.get(d._structure.get())); + if (d.function.size() == 0 && d._function.size() && this->moduleDefinitions.find(d._function.get())) + d.function.set(this->moduleDefinitions.get(d._function.get())); + } + for (auto & b : this->builds) + { + if (b.structure.size() == 0 && b._structure.size() && this->componentDefinitions.find(b._structure.get())) + b.structure.set(this->componentDefinitions.get(b._structure.get())); + if (b.behavior.size() == 0 && b._behavior.size() && this->moduleDefinitions.find(b._behavior.get())) + b.behavior.set(this->moduleDefinitions.get(b._behavior.get())); + } + for (auto & a : this->analyses) + { + if (a.consensusSequence.size() == 0 && a._consensusSequence.size() && this->sequences.find(a._consensusSequence.get())) + a.consensusSequence.set(this->sequences.get(a._consensusSequence.get())); + if (a.fittedModel.size() == 0 && a._fittedModel.size() && this->models.find(a._fittedModel.get())) + a.fittedModel.set(this->models.get(a._fittedModel.get())); + } + }; Document::~Document() @@ -104,6 +195,7 @@ unordered_map sbol::SBOL_DATA_MODEL_REGISTER = // Typecast proxy constructors to a constructor for SBOL // This makes some ugly syntax, but library users should never see it. make_pair(UNDEFINED, &create), + make_pair(SBOL_IDENTIFIED, (SBOLObject&(*)()) &create), make_pair(SBOL_COMPONENT_DEFINITION, (SBOLObject&(*)()) &create), make_pair(SBOL_SEQUENCE_ANNOTATION, (SBOLObject&(*)()) &create), make_pair(SBOL_SEQUENCE, (SBOLObject&(*)()) &create), @@ -124,12 +216,16 @@ unordered_map sbol::SBOL_DATA_MODEL_REGISTER = make_pair(PROVO_ACTIVITY, (SBOLObject&(*)()) &create), make_pair(PROVO_AGENT, (SBOLObject&(*)()) &create ), make_pair(PROVO_USAGE, (SBOLObject&(*)()) &create ), + make_pair(PROVO_ASSOCIATION, (SBOLObject&(*)()) &create ), make_pair(SBOL_ATTACHMENT, (SBOLObject&(*)()) &create), make_pair(SBOL_COMBINATORIAL_DERIVATION, (SBOLObject&(*)()) &create ), make_pair(SBOL_IMPLEMENTATION, (SBOLObject&(*)()) &create ), make_pair(SYSBIO_DESIGN, (SBOLObject&(*)()) &create ), make_pair(SYSBIO_ANALYSIS, (SBOLObject&(*)()) &create ), - make_pair(SYSBIO_SAMPLE_ROSTER, (SBOLObject&(*)()) &create ) + make_pair(SYSBIO_SAMPLE_ROSTER, (SBOLObject&(*)()) &create ), + make_pair(SBOL_EXPERIMENT, (SBOLObject&(*)()) &create ), + make_pair(SBOL_EXPERIMENTAL_DATA, (SBOLObject&(*)()) &create ) + }; @@ -141,7 +237,7 @@ void sbol::seek_element(std::istringstream& xml_buffer, std::string uri) while (xml_buffer) { int START_OF_ELEMENT = xml_buffer.tellg(); - // Parse element into qname and tag + // Parse element into qname and tag // This assumes xml elements have a certain form which is not generally true, // so sometimes the parsed qname and about_id will not make sense vector subtokens = parse_element(xml_buffer); @@ -220,13 +316,13 @@ void sbol::seek_end_of_node(std::istringstream& xml_buffer, std::string uri) // The qname for open element is the search term for close element vector subtokens = parse_element(xml_buffer); std::string qname = subtokens.front(); - std::string SEARCH_TOKEN = qname; - + std::string SEARCH_TOKEN = qname; + seek_next_element(xml_buffer); while (xml_buffer) { - - // Parse element into qname and tag + + // Parse element into qname and tag // This assumes xml elements have a certain form which is not generally true, // so sometimes the parsed qname and about_id will not make sense vector subtokens = parse_element(xml_buffer); @@ -274,7 +370,7 @@ void sbol::seek_resource(std::istringstream& xml_buffer, std::string qname, std: while (xml_buffer) { int START_OF_ELEMENT = xml_buffer.tellg(); - // Parse element into qname and tag + // Parse element into qname and tag // This assumes xml elements have a certain form which is not generally true, // so sometimes the parsed qname and resource_id will not make sense vector subtokens = parse_element(xml_buffer); @@ -343,7 +439,7 @@ bool sbol::is_open_node(std::istringstream& xml_buffer) /* As the first step in turning the flat RDF/XML serialization produced by Raptor into structured SBOL, -this procedure cuts the node corresponding to the specified resource. +this procedure cuts the node corresponding to the specified resource. */ std::string sbol::cut_sbol_resource(std::string& xml_string, const std::string resource_id) { @@ -381,7 +477,7 @@ void sbol::seek_property_element(istringstream& xml_buffer, string property_name // // so sometimes the parsed qname and resource_id will not make sense // vector subtokens = parse_element(xml_buffer); // std::string resource_id = subtokens.back(); -// +// // if (resource_id.compare(SEARCH_TOKEN) == 0 && is_open_node(xml_buffer)) // { // xml_buffer.seekg(START_OF_ELEMENT); @@ -393,9 +489,9 @@ void sbol::seek_property_element(istringstream& xml_buffer, string property_name }; -/* +/* Replace a reference node in flat RDF/XML with a nested node. The resource text is modified before inserting -it +it */ void sbol::replace_reference_to_resource(std::string& xml_string, const std::string property_name, const std::string resource_id, std::string& replacement_text) { @@ -419,7 +515,7 @@ void sbol::replace_reference_to_resource(std::string& xml_string, const std::str seek_end_of_line(xml_buffer); repl_end = xml_buffer.tellg(); repl_length = repl_end - repl_start; - + // Before inserting the new nested SBOL node, a few modifications have to be made first. // New open and close elements for the nested node are created. // Then the original node text is indented. @@ -447,10 +543,23 @@ void sbol::indent(std::string& text, int indentation) string sbol::convert_ntriples_encoding_to_ascii(string s) { - s = regex_replace(s, regex("\\\\\""), "\""); - s = regex_replace(s, regex("\\\\\\\\"), "\\"); -// s = regex_replace(s, regex("\\\""), "x"); -// s = regex_replace(s, regex("\\\\"), "\\"); + // string original = s; + string::size_type n = 0; + string replace_token = "\\\""; + string replacement = "\""; + while ( ( n = s.find( replace_token, n ) ) != std::string::npos ) + { + s.replace( n, replace_token.size(), replacement ); + n += replacement.size(); + } + n = 0; + replace_token = "\\\\"; + replacement = "\\"; + while ( ( n = s.find( replace_token, n ) ) != std::string::npos ) + { + s.replace( n, replace_token.size(), replacement ); + n += replacement.size(); + } return s; }; @@ -477,7 +586,7 @@ std::string SBOLObject::nest(std::string& rdfxml_string) // Recurse through each object in the object store that belongs to this property std::string property_name = i->first; vector object_store = i->second; - + if (std::find(hidden_properties.begin(), hidden_properties.end(), property_name) != hidden_properties.end()) continue; @@ -486,16 +595,16 @@ std::string SBOLObject::nest(std::string& rdfxml_string) for (auto o = object_store.begin(); o != object_store.end(); ++o) { SBOLObject* obj = *o; - if (Config::getOption("verbose") == "True") - std::cout << rdfxml_string << std::endl; + // if (Config::getOption("verbose") == "True") + // std::cout << rdfxml_string << std::endl; rdfxml_string = obj->nest(rdfxml_string); // Recurse, start nesting with leaf objects string id = obj->identity.get(); string cut_text = cut_sbol_resource(rdfxml_string, id); - if (Config::getOption("verbose") == "True") - { - std::cout << rdfxml_string << std::endl; - getchar(); - } + // if (Config::getOption("verbose") == "True") + // { + // std::cout << rdfxml_string << std::endl; + // getchar(); + // } try { replace_reference_to_resource(rdfxml_string, doc->makeQName(property_name), id, cut_text); @@ -510,133 +619,198 @@ std::string SBOLObject::nest(std::string& rdfxml_string) return rdfxml_string; }; +void Document::count_triples(void* user_data, raptor_statement* triple) +{ + int& c = *(int *)user_data; + c = c + 1; +}; + +std::string Document::string_from_raptor_term(raptor_term *term, bool addWrapper) { + std::string result; + + switch(term->type) { + case RAPTOR_TERM_TYPE_URI: + result = std::string((const char *)raptor_uri_as_string(term->value.uri)); + + if(addWrapper) + { + result = std::string("<") + result + std::string(">"); + } + break; + + case RAPTOR_TERM_TYPE_LITERAL: + result = std::string((const char *)term->value.literal.string); + + if(addWrapper) + { + result = std::string("\"") + result + std::string("\""); + } + break; + + default: + break; + } + + return result; +} + void Document::parse_objects(void* user_data, raptor_statement* triple) { - Document *doc = (Document *)user_data; - - string subject = reinterpret_cast(raptor_term_to_string(triple->subject)); - string predicate = reinterpret_cast(raptor_term_to_string(triple->predicate)); - string object = reinterpret_cast(raptor_term_to_string(triple->object)); - - subject = subject.substr(1, subject.length() - 2); // Removes flanking < and > from uri - predicate = predicate.substr(1, predicate.length() - 2); // Removes flanking < and > from uri - object = object.substr(1, object.length() - 2); // Removes flanking < and > from uri - - // Triples that have a predicate matching the following uri signal to the parser that a new SBOL object should be constructred - if (predicate.compare("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") == 0) - { + Document *doc = (Document *)user_data; + + string predicate = string_from_raptor_term(triple->predicate); + + // Triples that have a predicate matching the following uri signal + // to the parser that a new SBOL object should be constructred + if (predicate.compare("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") == 0) + { + string subject = string_from_raptor_term(triple->subject); + string object = string_from_raptor_term(triple->object); + + doc->parse_objects_inner(subject, object); + } +} + +void Document::parse_objects_inner(const std::string &subject, + const std::string &object) +{ #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) - - typedef struct { - PyObject_HEAD - void *ptr; // This is the pointer to the actual C++ instance - void *ty; // swig_type_info originally, but shouldn't matter - int own; - PyObject *next; - } SwigPyObject; -// if (!doc->find(subject)) -// { -// std::cout << "Skipping object: " << subject << "\t" << predicate << "\t" << object << std::endl; -// } - // Instantiate Python extension objects - if ((!doc->find(subject)) && (doc->PythonObjects.count(subject) == 0) && (Config::PYTHON_DATA_MODEL_REGISTER.count(object) == 1)) + + typedef struct { + PyObject_HEAD + void *ptr; // This is the pointer to the actual C++ instance + void *ty; // swig_type_info originally, but shouldn't matter + int own; + PyObject *next; + } SwigPyObject; + + bool foundSubject = (objectCache.find(subject) != objectCache.end()); + // Instantiate Python extension objects + + if ( !foundSubject && (PythonObjects.count(subject) == 0) && (Config::PYTHON_DATA_MODEL_REGISTER.count(object) == 1)) + { + PyObject* constructor = Config::PYTHON_DATA_MODEL_REGISTER[object]; + + PyObject* py_obj = PyObject_CallFunction(constructor, NULL); + SwigPyObject* swig_py_object = (SwigPyObject*)PyObject_GetAttr(py_obj, PyUnicode_FromString("this")); + SBOLObject* new_obj = (SBOLObject *)swig_py_object->ptr; + + // Wipe default property values passed from default + // constructor. New property values will be added as properties + // are parsed from the input file + for (auto it = new_obj->properties.begin(); it != new_obj->properties.end(); it++) { - PyObject* constructor = Config::PYTHON_DATA_MODEL_REGISTER[object]; - -// PyObject* py_obj = PyObject_CallFunction(constructor, (char *)"s", subject.c_str()); - PyObject* py_obj = PyObject_CallFunction(constructor, NULL); - SwigPyObject* swig_py_object = (SwigPyObject*)PyObject_GetAttr(py_obj, PyUnicode_FromString("this")); - SBOLObject* new_obj = (SBOLObject *)swig_py_object->ptr; - - // Wipe default property values passed from default constructor. New property values will be added as properties are parsed from the input file - for (auto it = new_obj->properties.begin(); it != new_obj->properties.end(); it++) + std::string token = it->second.front(); + if (token[0] == '<') // clear defaults and re-initialize this property as a URI { - std::string token = it->second.front(); - if (token[0] == '<') // clear defaults and re-initialize this property as a URI - { - new_obj->properties[it->first].clear(); - new_obj->properties[it->first].push_back("<>"); - } - else if (token[0] == '"') // clear defaults and re-initialize as a literal - { - new_obj->properties[it->first].clear(); - new_obj->properties[it->first].push_back("\"\""); - } + new_obj->properties[it->first].clear(); + new_obj->properties[it->first].push_back("<>"); + } + else if (token[0] == '"') // clear defaults and re-initialize as a literal + { + new_obj->properties[it->first].clear(); + new_obj->properties[it->first].push_back("\"\""); } - - // Set identity - new_obj->identity.set(subject); - - // All created objects are placed in the document's object store. However, only toplevel objects will be left permanently. - // Owned objects are kept in the object store as a temporary convenience and will be removed later by the parse_properties handler. - doc->SBOLObjects[new_obj->identity.get()] = new_obj; - new_obj->doc = doc; // Set's the objects back-pointer to the parent Document - - doc->PythonObjects[subject] = py_obj; - //Py_DECREF(py_obj); // Clean up } - else + + // Set identity + new_obj->identity.set(subject); + + // All created objects are placed in the document's object store. However, only toplevel objects will be left permanently. + // Owned objects are kept in the object store as a temporary convenience and will be removed later by the parse_properties handler. + SBOLObjects[new_obj->identity.get()] = new_obj; + new_obj->doc = this; // Set's the objects back-pointer to the parent Document + + PythonObjects[subject] = py_obj; + //Py_DECREF(py_obj); // Clean up + } #endif - // Checks if the object has already been created and whether a constructor for this type of object exists - if ((!doc->find(subject)) && (doc->SBOLObjects.count(subject) == 0) && (SBOL_DATA_MODEL_REGISTER.count(object) == 1)) - { - SBOLObject& new_obj = SBOL_DATA_MODEL_REGISTER[ object ](); // Call constructor for the appropriate SBOLObject + // Checks if the object has already been created and whether a + // constructor for this type of object exists + if ( !foundSubject && (SBOLObjects.count(subject) == 0) && + (SBOL_DATA_MODEL_REGISTER.count(object) == 1)) + { + SBOLObject& new_obj = SBOL_DATA_MODEL_REGISTER[ object ](); // Call constructor for the appropriate SBOLObject - // Wipe default property values passed from default constructor. New property values will be added as properties are parsed from the input file - for (auto it = new_obj.properties.begin(); it != new_obj.properties.end(); it++) - { - std::string token = it->second.front(); - if (token[0] == '<') // clear defaults and re-initialize this property as a URI - { - new_obj.properties[it->first].clear(); - new_obj.properties[it->first].push_back("<>"); - } - else if (token[0] == '"') // clear defaults and re-initialize as a literal - { - new_obj.properties[it->first].clear(); - new_obj.properties[it->first].push_back("\"\""); - } - } - new_obj.identity.set(subject); - - // All created objects are placed in the document's object store. However, only toplevel objects will be left permanently. - // Owned objects are kept in the object store as a temporary convenience and will be removed later by the parse_properties handler. - //doc->add(new_obj); - doc->SBOLObjects[new_obj.identity.get()] = &new_obj; - new_obj.doc = doc; // Set's the objects back-pointer to the parent Document - - // If the new object is TopLevel, add to the Document's property store - TopLevel* check_top_level = dynamic_cast(&new_obj); - if (check_top_level) - doc->owned_objects[new_obj.type].push_back(&new_obj); // Adds objects to the Document's property store, eg, componentDefinitions, moduleDefinitions, etc - } - // Generic TopLevels - else if ((!doc->find(subject)) && (doc->SBOLObjects.count(subject) == 0) && (SBOL_DATA_MODEL_REGISTER.count(object) == 0)) + // Wipe default property values passed from default + // constructor. New property values will be added as properties + // are parsed from the input file + for (auto it = new_obj.properties.begin(); it != new_obj.properties.end(); it++) { - SBOLObject& new_obj = *new SBOLObject(); // Call constructor for the appropriate SBOLObject - new_obj.identity.set(subject); - new_obj.type = object; - // All created objects are placed in the document's object store. However, only toplevel objects will be left permanently. - // Owned objects are kept in the object store as a temporary convenience and will be removed later by the parse_properties handler. - doc->SBOLObjects[new_obj.identity.get()] = &new_obj; - new_obj.doc = doc; // Set's the objects back-pointer to the parent Document + std::string token = it->second.front(); + if (token[0] == '<') // clear defaults and re-initialize this property as a URI + { + new_obj.properties[it->first].clear(); + new_obj.properties[it->first].push_back("<>"); + } + else if (token[0] == '"') // clear defaults and re-initialize as a literal + { + new_obj.properties[it->first].clear(); + new_obj.properties[it->first].push_back("\"\""); + } } - } - + new_obj.identity.set(subject); + + // All created objects are placed in the document's object + // store. However, only toplevel objects will be left + // permanently. Owned objects are kept in the object store as a + // temporary convenience and will be removed later by the + // parse_properties handler. + SBOLObjects[new_obj.identity.get()] = &new_obj; + objectCache[subject] = &new_obj; + new_obj.doc = doc; // Set the object's back-pointer to the parent Document + new_obj.parent = doc; // For now, set the parent point to the Document. This may get overwritten later for child objects + + // If the new object is TopLevel, add to the Document's property store + TopLevel* check_top_level = dynamic_cast(&new_obj); + if (check_top_level) + { + // Adds objects to the Document's property store, eg, + // componentDefinitions, moduleDefinitions, etc + owned_objects[new_obj.type].push_back(&new_obj); + } + } + // Generic TopLevels + else if ( !foundSubject && (doc->SBOLObjects.count(subject) == 0) && + (SBOL_DATA_MODEL_REGISTER.count(object) == 0)) + { + SBOLObject& new_obj = *new SBOLObject(); // Call constructor for the appropriate SBOLObject + new_obj.identity.set(subject); + new_obj.type = object; + // All created objects are placed in the document's object + // store. However, only toplevel objects will be left + // permanently. Owned objects are kept in the object + // store as a temporary convenience and will be removed + // later by the parse_properties handler. + SBOLObjects[new_obj.identity.get()] = &new_obj; + new_obj.doc = doc; // Set's the objects back-pointer to the parent Document + objectCache[subject] = &new_obj; + } } void Document::parse_properties(void* user_data, raptor_statement* triple) { - Document *doc = (Document *)user_data; + Document *doc = (Document *)user_data; + + string property_uri = string_from_raptor_term(triple->predicate); - string subject = reinterpret_cast(raptor_term_to_string(triple->subject)); - string predicate = reinterpret_cast(raptor_term_to_string(triple->predicate)); - string object = reinterpret_cast(raptor_term_to_string(triple->object)); + if (property_uri.compare("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") != 0) + { + string subject = string_from_raptor_term(triple->subject); + string object = string_from_raptor_term(triple->object, true); + + doc->parse_properties_inner(subject, property_uri, object); + } +}; - string id = subject.substr(1, subject.length() - 2); // Removes flanking < and > from the uri - string property_uri = predicate.substr(1, predicate.length() - 2); // Removes flanking < and > from uri - //string property_value = object.substr(1, object.length() - 2); // Removes flanking " from literal +void Document::parse_properties_inner(const std::string &subject, + const std::string &predicate, + const std::string &object) +{ + string id = subject; + string property_uri = predicate; string property_value = convert_ntriples_encoding_to_ascii(object); + std::size_t found = property_uri.find_last_of('#'); if (found == std::string::npos) { @@ -645,67 +819,65 @@ void Document::parse_properties(void* user_data, raptor_statement* triple) if (found != std::string::npos) { string property_ns = property_uri.substr(0, found); - string property_name = property_uri.substr(found + 1, subject.length() - 1); + string property_name = property_uri.substr(found + 1); - // If property name is something other than "type" than the triple matches the pattern for defining properties - if (property_uri.compare("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") != 0) - { -// if (!doc->find(owned_obj_id)) -// { -// std::cout << "Skipping property: " << subject << "\t" << predicate << "\t" << object << std::endl; -// } - // Checks if the object to which this property belongs already exists - if (doc->SBOLObjects.find(id) != doc->SBOLObjects.end()) - { - SBOLObject *sbol_obj = doc->SBOLObjects[id]; - - // Decide if this triple corresponds to a simple property, a list property, an owned property or a referenced property - if (sbol_obj->properties.find(property_uri) != sbol_obj->properties.end()) - { - // TODO: double-check this, is there a memory-leak here?` - - if (sbol_obj->properties[property_uri][0].compare("<>") == 0 || sbol_obj->properties[property_uri][0].compare("\"\"") == 0 ) - sbol_obj->properties[property_uri].clear(); // Clear an empty property - sbol_obj->properties[property_uri].push_back(property_value); - } - else if (sbol_obj->owned_objects.find(property_uri) != sbol_obj->owned_objects.end()) - { - // Strip off the angle brackets from the URI value. Note that a Document's object_store - // and correspondingly, an SBOLObject's property_store uses stripped URIs as keys, - // while libSBOL uses as a convention angle brackets or quotes for Literal values - string owned_obj_id = property_value.substr(1, property_value.length() - 2); - - // Form a composite SBOL data structure. The owned object is added to its parent - // TopLevel object. The owned object is then removed from its temporary location in the Document's object store - // and is now associated only with it's parent TopLevel object. - if (doc->SBOLObjects.find(owned_obj_id) != doc->SBOLObjects.end()) - { - SBOLObject *owned_obj = doc->SBOLObjects[owned_obj_id]; - sbol_obj->owned_objects[property_uri].push_back(owned_obj); - owned_obj->parent = sbol_obj; - doc->SBOLObjects.erase(owned_obj_id); - // doc->owned_objects.erase(owned_object->type); // Remove temporary, non-toplevel objects from the Document's property store - } -#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) - if (doc->PythonObjects.find(owned_obj_id) != doc->PythonObjects.end()) - { - PyObject *owned_obj = doc->PythonObjects[owned_obj_id]; - sbol_obj->PythonObjects[owned_obj_id] = owned_obj; - doc->PythonObjects.erase(owned_obj_id); - } -#endif + // Checks if the object to which this property belongs already exists + if (SBOLObjects.find(id) != SBOLObjects.end()) + { + SBOLObject *sbol_obj = SBOLObjects[id]; + + // Decide if this triple corresponds to a simple property, + // a list property, an owned property or a referenced + // property + if (sbol_obj->properties.find(property_uri) != sbol_obj->properties.end()) + { + // TODO: double-check this, is there a memory-leak here?` + + if (sbol_obj->properties[property_uri][0].compare("<>") == 0 || + sbol_obj->properties[property_uri][0].compare("\"\"") == 0 ) + sbol_obj->properties[property_uri].clear(); // Clear an empty property + sbol_obj->properties[property_uri].push_back(property_value); + } + else if (sbol_obj->owned_objects.find(property_uri) != sbol_obj->owned_objects.end()) + { + // Strip off the angle brackets from the URI value. + // Note that a Document's object_store and + // correspondingly, an SBOLObject's property_store + // uses stripped URIs as keys, while libSBOL uses as a + // convention angle brackets or quotes for Literal + // values + string owned_obj_id = property_value.substr(1, property_value.length() - 2); + + // Form a composite SBOL data structure. The owned + // object is added to its parent TopLevel object. The + // owned object is then removed from its temporary + // location in the Document's object store and is now + // associated only with it's parent TopLevel object. + auto owned_obj_lookup = SBOLObjects.find(owned_obj_id); + if(owned_obj_lookup != SBOLObjects.end()) + { + SBOLObject *owned_obj = owned_obj_lookup->second; + sbol_obj->owned_objects[property_uri].push_back(owned_obj); + owned_obj->parent = sbol_obj; + SBOLObjects.erase(owned_obj_id); } - // Extension data - else +#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) + if (PythonObjects.find(owned_obj_id) != PythonObjects.end()) { -// cout << "Setting " << property_uri << " of " << id << " to " << property_value << endl; - sbol_obj->properties[property_uri].push_back(property_value); + PyObject *owned_obj = PythonObjects[owned_obj_id]; + sbol_obj->PythonObjects[owned_obj_id] = owned_obj; + PythonObjects.erase(owned_obj_id); } - } - } - } -}; - +#endif + } + // Extension data + else + { + sbol_obj->properties[property_uri].push_back(property_value); + } + } + } +} void Document::parse_annotation_objects() { // Check if there are any SBOLObjects remaining in the Document's object store which are not recognized as part of the core data model or an explicitly declared extension class @@ -742,10 +914,10 @@ void Document::parse_annotation_objects() // Find all parent objects containing a reference to the annotation object vector matches = find_reference(obj->identity.get()); - + // Does this reference belong to the appropriate member property? matches.erase( std::remove_if (matches.begin(), matches.end(), [property_uri] (SBOLObject* o) { - if (o->properties.find(property_uri) != o->properties.end()) + if (o->properties.find(property_uri) == o->properties.end()) return true; else return false; @@ -759,8 +931,30 @@ void Document::parse_annotation_objects() SBOLObject* match = matches.front(); match->owned_objects[property_uri].push_back(obj); obj->parent = match; - match->properties.erase(property_uri); - SBOLObjects.erase(obj->identity.get()); // Remove nested object from TopLevel store + + // Remove obj from match's property list + auto identity = obj->identity.get(); + auto &propList = match->properties[property_uri]; + + // Loop through properties with type property_uri + for(auto it=propList.begin(); it != propList.end(); ++it) + { + if(it->compare(1, it->size()-2, identity) == 0) + { + // Erase reference to obj + propList.erase(it); + + if(propList.size() == 0) + { + // If there are no more properties of type + // property_uri, remove the property + // reference vector + match->properties.erase(property_uri); + } + break; + } + } + SBOLObjects.erase(identity); // Remove nested object from TopLevel store } } } @@ -777,7 +971,7 @@ void sbol::raptor_error_handler(void *user_data, raptor_log_message* message) if (message->level == RAPTOR_LOG_LEVEL_ERROR) cout << "RAPTOR_LOG_LEVEL_ERROR" << endl; if (message->level == RAPTOR_LOG_LEVEL_FATAL) cout << "RAPTOR_LOG_LEVEL_FATAL" << endl; if (message->level == RAPTOR_LOG_LEVEL_LAST) cout << "RAPTOR_LOG_LEVEL_LAST" << endl; - + if (message->locator != NULL) { cout << message->locator->line << ", " << message->locator->column << endl; @@ -794,10 +988,10 @@ std::string Document::validate() { raptor_world* world = getWorld(); raptor_serializer* sbol_serializer; - if (getFileFormat().compare("rdfxml") == 0) + if (Config::getOption("serialization_format") == "sbol" || Config::getOption("serialization_format") == "rdfxml") sbol_serializer = raptor_new_serializer(world, "rdfxml-abbrev"); else - sbol_serializer = raptor_new_serializer(world, getFileFormat().c_str()); + sbol_serializer = raptor_new_serializer(world, Config::getOption("serialization_format").c_str()); char* sbol_buffer; size_t sbol_buffer_len; @@ -857,6 +1051,83 @@ SBOLObject* Document::find(std::string uri) return NULL; }; +void Document::cacheObjects() { + objectCache.clear(); + + for (auto i_obj = SBOLObjects.begin(); i_obj != SBOLObjects.end(); ++i_obj) + { + SBOLObject &obj = *i_obj->second; + obj.cacheObjects(objectCache); + } +} + +void Document::serialize_rdfxml(std::ostream &os) { + // RDF/XML Header + os << "" << std::endl; + + bool firstNS = true; + os << " 0) + { + os << "xmlns=\"" << default_namespace << "\""; + firstNS = false; + } + + // Add namespaces + for(auto nsPair : namespaces) { + if(firstNS) { + firstNS = false; + } else { + os << " "; + } + + os << "xmlns:" << nsPair.first << "=\"" + << nsPair.second << "\""; + } + os << ">" << std::endl; + + // Add top level SBOL objects + for(auto objPair : SBOLObjects) + { + SBOLObject &obj = *objPair.second; + bool topLevel = false; + SBOLObject *parent = obj.parent; + auto typeURI = obj.getTypeURI(); + + // If an object has a parent and is not a hidden property it is + // not a top-level object + // if((parent != NULL) && + // (std::find(parent->hidden_properties.begin(), + // parent->hidden_properties.end(), + // typeURI) == hidden_properties.end())) + // { + // continue; + // } + + if(dynamic_cast(&obj) == NULL) + { + continue; + } + + + std::string identity = obj.identity.get(); + std::string rdfType = referenceNamespace(typeURI); + + os << " <" << rdfType << " rdf:about=\"" + << identity << "\">" << std::endl; + + // Add object properties + obj.serialize_rdfxml(os, 2); + + os << " " << std::endl; + } + + os << "" << std::endl; +} + + SBOLObject* Document::find_property(std::string uri) { for (auto i_obj = SBOLObjects.begin(); i_obj != SBOLObjects.end(); ++i_obj) @@ -887,14 +1158,19 @@ void Document::namespaceHandler(void *user_data, raptor_namespace *nspace) //vector* namespaces = (vector*)user_data; Document* doc = (Document *)user_data; string ns = string((const char *)raptor_uri_as_string(raptor_namespace_get_uri(nspace))); + if (raptor_namespace_get_prefix(nspace)) { string prefix = string((const char *)raptor_namespace_get_prefix(nspace)); doc->namespaces[prefix] = ns; } + else + { + doc->default_namespace = ns; + } } -void Document::read(std::string filename) +void Document::clear() { // Wipe existing contents of this Document first. This should raptor_free_world(this->rdf_graph); // Probably need to free other objects as well... @@ -923,17 +1199,28 @@ void Document::read(std::string filename) o.second.clear(); } namespaces.clear(); - + // Create new RDF graph this->rdf_graph = raptor_new_world(); +} + +void Document::read(std::string filename) +{ + clear(); this->append(filename); }; void Document::append(std::string filename) { + int t_start; // For timing + int t_end; + if (Config::getOption("verbose") == "True") + t_start = getTime(); + + cacheObjects(); raptor_world_set_log_handler(this->rdf_graph, NULL, raptor_error_handler); // Intercept raptor errors - + if (filename != "" && filename[0] == '~') { if (filename[1] != '/'){ throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Malformed input path. Potentially missing slash."); @@ -947,15 +1234,101 @@ void Document::append(std::string filename) if (!fh) throw SBOLError(SBOL_ERROR_FILE_NOT_FOUND, "File " + filename + " not found"); //raptor_parser* rdf_parser = raptor_new_parser(this->rdf_graph, "rdfxml"); - raptor_parser* rdf_parser = raptor_new_parser(this->rdf_graph, getFileFormat().c_str()); + raptor_parser* rdf_parser; + if (Config::getOption("serialization_format") == "sbol") + rdf_parser = raptor_new_parser(this->rdf_graph, "rdfxml"); + else + rdf_parser = raptor_new_parser(this->rdf_graph, Config::getOption("serialization_format").c_str()); raptor_parser_set_namespace_handler(rdf_parser, this, this->namespaceHandler); raptor_iostream* ios = raptor_new_iostream_from_file_handle(this->rdf_graph, fh); unsigned char *uri_string; raptor_uri *uri, *base_uri; - base_uri = raptor_new_uri(this->rdf_graph, (const unsigned char *)SBOL_URI "#"); + base_uri = raptor_new_uri(this->rdf_graph, (const unsigned char *)" "); void *user_data = this; - + +#ifdef HAVE_LIBRASQAL + RasqalDataGraph graph(filename, base_uri); + + // Find all the SBOL objects + std::string topQuery = + "PREFIX : " + "PREFIX rdf: " + "PREFIX sbol: " + "SELECT ?s ?o " + "{ ?s a ?o }"; + + RasqalQueryResults topLevelResults = graph.query(topQuery); + + for(auto &amap: topLevelResults.bindingResults()) { + std::string subject((const char *)rasqal_literal_as_string(amap.at("s"))); + std::string object((const char *)rasqal_literal_as_string(amap.at("o"))); + + parse_objects_inner(subject, object); + } + + // Find everything in the triple store + std::string allQuery = + "PREFIX : " + "PREFIX rdf: " + "PREFIX sbol: " + "SELECT ?s ?p ?o " + "{ ?s ?p ?o }"; + + RasqalQueryResults allResults = graph.query(allQuery); + + // Find the graph base uri. This is the location of the sbol + // file, and begins with the "file://" scheme. Any URI in the + // file without a scheme will appear relative to this URI, after + // the file is parsed. Therefore, if the any URI property value + // begins with the graph base uri, the base part of the URI is + // removed. + auto graphBaseURI = graph.dataGraph()->uri; + std::string graphBaseURIStr = + reinterpret_cast(raptor_uri_as_string(graphBaseURI)); + + // Remove the file name from the path + std::string::size_type pos = graphBaseURIStr.rfind("/"); + if(pos != std::string::npos) + { + ++pos; + } + + std::string rdf_type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; + for(auto &amap: allResults.bindingResults()) { + std::string predicate((const char *)rasqal_literal_as_string(amap.at("p"))); + + // Look for properties + if(predicate != rdf_type) + { + std::string subject((const char *)rasqal_literal_as_string(amap.at("s"))); + auto objectLiteral = amap.at("o"); + auto lval = rasqal_literal_as_string(objectLiteral); + auto ltype = rasqal_literal_get_rdf_term_type(objectLiteral); + + if((ltype == RASQAL_LITERAL_URI) && (pos != std::string::npos)) + { + if(strncmp((const char *)lval, graphBaseURIStr.c_str(), pos) == 0) + { + // This was a URI without a scheme. Remove URI base + lval += pos; + } + } + + // If the literal value is a URI, wrap it in < and >, + // otherwise wrap it in quotes + std::string padStart = (ltype == RASQAL_LITERAL_URI) ? "<" : "\""; + std::string padEnd = (ltype == RASQAL_LITERAL_URI) ? ">" : "\""; + std::string object = padStart + (const char *)lval + padEnd; + + parse_properties_inner(subject, predicate, object); + } + } + + // Use raptor to parse the namespaces. The callback is set to NULL. + raptor_parser_set_statement_handler(rdf_parser, user_data, NULL); + +#else // Read the triple store. On the first pass through the triple store, new SBOLObjects are constructed by the parse_objects handler raptor_parser_set_statement_handler(rdf_parser, user_data, this->parse_objects); //base_uri = raptor_new_uri(this->rdf_graph, (const unsigned char *)(getHomespace() + "#").c_str()); //This can be used to import URIs into a namespace @@ -965,9 +1338,11 @@ void Document::append(std::string filename) rewind(fh); ios = raptor_new_iostream_from_file_handle(this->rdf_graph, fh); raptor_parser_set_statement_handler(rdf_parser, user_data, this->parse_properties); + +#endif raptor_parser_parse_iostream(rdf_parser, ios, base_uri); raptor_free_iostream(ios); - + raptor_free_uri(base_uri); raptor_free_parser(rdf_parser); @@ -975,16 +1350,26 @@ void Document::append(std::string filename) parse_annotation_objects(); // Process libSBOL objects not part of the SBOL core standard - parse_extension_objects(); + dress_document(); fclose(fh); + + if (Config::getOption("verbose") == "True") + { + t_end = getTime(); + cout << "Parsing took " << t_end - t_start << " seconds" << endl; + } } void Document::readString(std::string& sbol) { raptor_world_set_log_handler(this->rdf_graph, NULL, raptor_error_handler); // Intercept raptor errors - - raptor_parser* rdf_parser = raptor_new_parser(this->rdf_graph, getFileFormat().c_str()); - + + raptor_parser* rdf_parser; + if (Config::getOption("serialization_format") == "sbol") + rdf_parser = raptor_new_parser(this->rdf_graph, "rdfxml"); + else + rdf_parser = raptor_new_parser(this->rdf_graph, Config::getOption("serialization_format").c_str()); + raptor_parser_set_namespace_handler(rdf_parser, this, this->namespaceHandler); raptor_iostream* ios = raptor_new_iostream_from_string(this->rdf_graph, (void *)sbol.c_str(), sbol.size()); @@ -992,30 +1377,70 @@ void Document::readString(std::string& sbol) raptor_uri *uri, *base_uri; base_uri = raptor_new_uri(this->rdf_graph, (const unsigned char *)SBOL_URI "#"); void *user_data = this; - + // Read the triple store. On the first pass through the triple store, new SBOLObjects are constructed by the parse_objects handler raptor_parser_set_statement_handler(rdf_parser, user_data, this->parse_objects); //base_uri = raptor_new_uri(this->rdf_graph, (const unsigned char *)(getHomespace() + "#").c_str()); //This can be used to import URIs into a namespace raptor_parser_parse_iostream(rdf_parser, ios, base_uri); raptor_free_iostream(ios); - + // Read the triple store again. On the second pass through the triple store, property values are assigned to each SBOLObject's member properties by the parse_properties handler ios = raptor_new_iostream_from_string(this->rdf_graph, (void *)sbol.c_str(), sbol.size()); raptor_parser_set_statement_handler(rdf_parser, user_data, this->parse_properties); raptor_parser_parse_iostream(rdf_parser, ios, base_uri); raptor_free_iostream(ios); - + raptor_free_uri(base_uri); raptor_free_parser(rdf_parser); - + // On the final pass, nested annotations not in the SBOL namespace are identified parse_annotation_objects(); // Process libSBOL objects not part of the SBOL core standard - parse_extension_objects(); + dress_document(); } +int Document::countTriples() +{ + raptor_world_set_log_handler(this->rdf_graph, NULL, raptor_error_handler); // Intercept raptor errors + + char *sbol_buffer; + size_t sbol_buffer_len; + raptor_serializer* sbol_serializer; + if (Config::getOption("serialization_format") == "rdfxml" || Config::getOption("serialization_format") == "sbol" ) + sbol_serializer = raptor_new_serializer(rdf_graph, "rdfxml-abbrev"); + else + sbol_serializer = raptor_new_serializer(rdf_graph, Config::getOption("serialization_format").c_str()); + raptor_iostream* ios = raptor_new_iostream_to_string(this->rdf_graph, (void **)&sbol_buffer, &sbol_buffer_len, NULL); + raptor_uri *base_uri = NULL; + generate(&rdf_graph, &sbol_serializer, &sbol_buffer, &sbol_buffer_len, &ios, &base_uri); + + raptor_parser* rdf_parser; + if (Config::getOption("serialization_format") == "rdfxml" || Config::getOption("serialization_format") == "sbol" ) + raptor_new_parser(this->rdf_graph, "rdfxml"); + else + raptor_new_parser(this->rdf_graph, Config::getOption("serialization_format").c_str()); + raptor_parser_set_namespace_handler(rdf_parser, this, this->namespaceHandler); + ios = raptor_new_iostream_from_string(this->rdf_graph, (void *)sbol_buffer, sbol_buffer_len); + + base_uri = raptor_new_uri(this->rdf_graph, (const unsigned char *)SBOL_URI "#"); + + int c = 0; + void *user_data = &c; + + // Read the triple store. On the first pass through the triple store, new SBOLObjects are constructed by the parse_objects handler + raptor_parser_set_statement_handler(rdf_parser, user_data, this->count_triples); + //base_uri = raptor_new_uri(this->rdf_graph, (const unsigned char *)(getHomespace() + "#").c_str()); //This can be used to import URIs into a namespace + + raptor_parser_parse_iostream(rdf_parser, ios, base_uri); + raptor_free_iostream(ios); + + + raptor_free_uri(base_uri); + raptor_free_parser(rdf_parser); + return c; +} void SBOLObject::serialize(raptor_serializer* sbol_serializer, raptor_world *sbol_world) { @@ -1054,11 +1479,11 @@ void SBOLObject::serialize(raptor_serializer* sbol_serializer, raptor_world *sbo std::string new_predicate = it->first; // The triple's predicate identifies an SBOL property if (std::find(hidden_properties.begin(), hidden_properties.end(), new_predicate) != hidden_properties.end()) continue; - + // This RDF triple makes the following statement: // "This SBOL object has a property called X and its value is Y" raptor_statement *triple2 = raptor_new_statement(sbol_world); - + // Serialize each of the values in a List property as an RDF triple vector property_values = it->second; for (auto i_val = property_values.begin(); i_val != property_values.end(); ++i_val) @@ -1066,7 +1491,7 @@ void SBOLObject::serialize(raptor_serializer* sbol_serializer, raptor_world *sbo std::string new_object = *i_val; triple2->subject = raptor_new_term_from_uri_string(sbol_world, (const unsigned char *)subject.c_str()); triple2->predicate = raptor_new_term_from_uri_string(sbol_world, (const unsigned char *)new_predicate.c_str()); - + // TODO: the condition below, new_object.length() > 2, should be replaced with a function is_empty() if (new_object.length() > 2 && new_object.front() == '<' && new_object.back() == '>') // Angle brackets indicate a uri { @@ -1087,7 +1512,7 @@ void SBOLObject::serialize(raptor_serializer* sbol_serializer, raptor_world *sbo } } - // Delete the triple + // Delete the triple raptor_free_statement(triple2); } @@ -1101,13 +1526,13 @@ void SBOLObject::serialize(raptor_serializer* sbol_serializer, raptor_world *sbo if (std::find(hidden_properties.begin(), hidden_properties.end(), property_name) != hidden_properties.end()) continue; - + if (object_store.size() > 0) { - // TODO: this triple appears to be unneccessary and creates an extra + // TODO: this triple appears to be unneccessary and creates an extra // xml node in serialization // Double check this conclusion and remove code as necessary - + // This RDF triple makes the following statement: // "This instance of an SBOL object has property called X" raptor_statement *triple2 = raptor_new_statement(sbol_world); @@ -1122,7 +1547,7 @@ void SBOLObject::serialize(raptor_serializer* sbol_serializer, raptor_world *sbo // Write the triples //raptor_serializer_serialize_statement(sbol_serializer, triple2); - // Delete the triple + // Delete the triple raptor_free_statement(triple2); int i_o = 0; @@ -1150,7 +1575,7 @@ void SBOLObject::serialize(raptor_serializer* sbol_serializer, raptor_world *sbo // Write the triples raptor_serializer_serialize_statement(sbol_serializer, triple); - // Delete the triple + // Delete the triple raptor_free_statement(triple); // Recursive call to serialize child objects @@ -1201,6 +1626,11 @@ void Document::addNamespace(std::string ns, std::string prefix, raptor_serialize std::string Document::write(std::string filename) { + int t_start; // For timing + int t_end; + if (Config::getOption("verbose") == "True") + t_start = getTime(); + // Initialize raptor serializer if (filename != "" && filename[0] == '~') { if (filename[1] != '/'){ @@ -1212,56 +1642,88 @@ std::string Document::write(std::string filename) } } - FILE* fh = fopen(filename.c_str(), "wb"); + std::string response = ""; + if (Config::getOption("serialization_format") == "sbol") + { + try { + std::ofstream outFile(filename); + serialize_rdfxml(outFile); + } catch(std::exception &e) { + throw SBOLError(SBOL_ERROR_SERIALIZATION, e.what()); + } + } + else + { + raptor_world* world = getWorld(); + raptor_serializer* sbol_serializer; - raptor_world* world = getWorld(); - raptor_serializer* sbol_serializer; - if (getFileFormat().compare("rdfxml") == 0) - sbol_serializer = raptor_new_serializer(world, "rdfxml-abbrev"); - else - sbol_serializer = raptor_new_serializer(world, getFileFormat().c_str()); + if((Config::getOption("serialization_format") == "rdfxml") || + (Config::getOption("serialization_format") == "sbol_raptor")) + { + sbol_serializer = raptor_new_serializer(world, "rdfxml-abbrev"); + } + else + { + sbol_serializer = raptor_new_serializer(world, Config::getOption("serialization_format").c_str()); + } - char *sbol_buffer; - size_t sbol_buffer_len; + FILE* fh = fopen(filename.c_str(), "wb"); - raptor_iostream* ios = raptor_new_iostream_to_string(world, (void **)&sbol_buffer, &sbol_buffer_len, NULL); - raptor_uri *base_uri = NULL; - - generate(&world, &sbol_serializer, &sbol_buffer, &sbol_buffer_len, &ios, &base_uri); + char *sbol_buffer; + size_t sbol_buffer_len; - // Convert flat RDF/XML into nested SBOL - std::string sbol_buffer_string = std::string((char*)sbol_buffer); - const int size = (const int)sbol_buffer_len; - if (getFileFormat().compare("json") == 0) - fputs(sbol_buffer_string.c_str(), fh); - else - { - if (sbol_buffer) + raptor_iostream* ios = raptor_new_iostream_to_string(world, (void **)&sbol_buffer, &sbol_buffer_len, NULL); + raptor_uri *base_uri = NULL; + + generate(&world, &sbol_serializer, &sbol_buffer, &sbol_buffer_len, &ios, &base_uri); + + // Convert flat RDF/XML into nested SBOL + response = "Validation of " + Config::getOption("serialization_format") + " serialization cannot be performed."; + std::string sbol_buffer_string = std::string((char*)sbol_buffer); + if (Config::getOption("serialization_format") == "sbol_raptor") { - // Iterate through objects in document and nest them - for (auto obj_i = SBOLObjects.begin(); obj_i != SBOLObjects.end(); ++obj_i) + const int size = (const int)sbol_buffer_len; + if (sbol_buffer) { - sbol_buffer_string = obj_i->second->nest(sbol_buffer_string); + // Iterate through objects in document and nest them + for (auto obj_i = SBOLObjects.begin(); obj_i != SBOLObjects.end(); ++obj_i) + { + sbol_buffer_string = obj_i->second->nest(sbol_buffer_string); + } + fputs(sbol_buffer_string.c_str(), fh); + } + else + { + throw SBOLError(SBOL_ERROR_SERIALIZATION, "Serialization failed"); } - fputs(sbol_buffer_string.c_str(), fh); } else { - throw SBOLError(SBOL_ERROR_SERIALIZATION, "Serialization failed"); + fputs(sbol_buffer_string.c_str(), fh); + } + if (Config::getOption("verbose") == "True") + { + t_end = getTime(); + cout << "Serialization took " << t_end - t_start << " seconds" << endl; + t_start = t_end; } - } - raptor_free_iostream(ios); - raptor_free_uri(base_uri); + raptor_free_iostream(ios); + raptor_free_uri(base_uri); + fclose(fh); + } // Validate SBOL using online validator - std::string response; - if (Config::getOption("validate") == "True") - response = validate(); - else - response = "Validation disabled. To enable use of the online validation tool, use Config::setOption(\"validate\", true)"; + if (Config::getOption("validate") == "True" && (Config::getOption("serialization_format") == "sbol" || Config::getOption("serialization_format") == "rdfxml")) + response = validate(); + else + response = "Validation disabled. To enable use of the online validation tool, use Config::setOption(\"validate\", true)"; - fclose(fh); + if (Config::getOption("verbose") == "True") + { + t_end = getTime(); + cout << "Validation request took " << t_end - t_start << " seconds" << endl; + } return response; }; @@ -1270,36 +1732,37 @@ std::string Document::writeString() { raptor_world* world = getWorld(); raptor_serializer* sbol_serializer; - if (getFileFormat().compare("rdfxml") == 0) + if (Config::getOption("serialization_format") == "rdfxml" || Config::getOption("serialization_format") == "sbol") sbol_serializer = raptor_new_serializer(world, "rdfxml-abbrev"); else - sbol_serializer = raptor_new_serializer(world, getFileFormat().c_str()); - + sbol_serializer = raptor_new_serializer(world, Config::getOption("serialization_format").c_str()); + char *sbol_buffer; size_t sbol_buffer_len; - + raptor_iostream* ios = raptor_new_iostream_to_string(world, (void **)&sbol_buffer, &sbol_buffer_len, NULL); raptor_uri *base_uri = NULL; - + generate(&world, &sbol_serializer, &sbol_buffer, &sbol_buffer_len, &ios, &base_uri); - + // Convert flat RDF/XML into nested SBOL std::string sbol_buffer_string = std::string((char*)sbol_buffer); const int size = (const int)sbol_buffer_len; if (sbol_buffer) { - // Iterate through objects in document and nest them - for (auto obj_i = SBOLObjects.begin(); obj_i != SBOLObjects.end(); ++obj_i) - { - sbol_buffer_string = obj_i->second->nest(sbol_buffer_string); - } + if (Config::getOption("serialization_format") == "sbol") + // Iterate through objects in document and nest them + for (auto obj_i = SBOLObjects.begin(); obj_i != SBOLObjects.end(); ++obj_i) + { + sbol_buffer_string = obj_i->second->nest(sbol_buffer_string); + } } else { throw SBOLError(SBOL_ERROR_SERIALIZATION, "Serialization failed"); } - + raptor_free_iostream(ios); raptor_free_uri(base_uri); @@ -1333,15 +1796,15 @@ void Document::generate(raptor_world** world, raptor_serializer** sbol_serialize // raptor_uri *sbol_uri = raptor_new_uri(world, (const unsigned char *)SBOL_URI "#"); // raptor_uri *purl_uri = raptor_new_uri(world, (const unsigned char *)PURL_URI ); // raptor_uri *prov_uri = raptor_new_uri(world, (const unsigned char *)PROV_URI "#"); - // + // // const unsigned char *sbol_prefix = (const unsigned char *)"sbol"; // const unsigned char *purl_prefix = (const unsigned char *)"dcterms"; // const unsigned char *prov_prefix = (const unsigned char *)"prov"; - // + // // raptor_namespace *sbol_namespace = raptor_new_namespace_from_uri(sbol_namespaces, sbol_prefix, sbol_uri, 1); // raptor_namespace *purl_namespace = raptor_new_namespace_from_uri(sbol_namespaces, purl_prefix, purl_uri, 1); // raptor_namespace *prov_namespace = raptor_new_namespace_from_uri(sbol_namespaces, prov_prefix, prov_uri, 1); - // + // // raptor_serializer_set_namespace_from_namespace(sbol_serializer, sbol_namespace); // raptor_serializer_set_namespace_from_namespace(sbol_serializer, purl_namespace); // raptor_serializer_set_namespace_from_namespace(sbol_serializer, prov_namespace); @@ -1399,7 +1862,7 @@ std::string ReferencedObject::create(std::string uri) Identified& parent_obj = (Identified&)*sbol_owner; if (Config::getOption("sbol_compliant_uris").compare("True") == 0) { - + Identified& new_obj = (Identified&)SBOL_DATA_MODEL_REGISTER[ reference_type_uri ](); // Call constructor for the referenced object new_obj.identity.set(getHomespace() + "/" + parseClassName(reference_type_uri) + "/" + uri + "/" + parent_obj.version.get()); new_obj.persistentIdentity.set(getHomespace() + "/" + parseClassName(reference_type_uri) + "/" + uri); @@ -1418,7 +1881,7 @@ std::string ReferencedObject::create(std::string uri) } else new_id = uri; - + Identified& new_obj = (Identified&)SBOL_DATA_MODEL_REGISTER[ reference_type_uri ](); // Call constructor for the referenced object new_obj.identity.set(new_id); new_obj.persistentIdentity.set(new_id); @@ -1432,31 +1895,39 @@ std::string ReferencedObject::create(std::string uri) Identified& Identified::copy(Document* target_doc, string ns, string version) { // Call constructor for the copy - Identified& new_obj = (Identified&)SBOL_DATA_MODEL_REGISTER[ this->type ](); - + string new_obj_type; + if (SBOL_DATA_MODEL_REGISTER.find(this->type) != SBOL_DATA_MODEL_REGISTER.end()) + new_obj_type = this->type; + else + new_obj_type = SBOL_IDENTIFIED; + Identified& new_obj = (Identified&)SBOL_DATA_MODEL_REGISTER[ new_obj_type ](); + // Assign the new object to the target Document (null for non-TopLevel objects) if (target_doc) new_obj.doc = target_doc; new_obj.type = this->type; - + // Copy properties for (auto i_store = properties.begin(); i_store != properties.end(); ++i_store) { string store_uri = i_store->first; vector < string > property_store = i_store->second; vector < string > property_store_copy = property_store; // Copy properties - + // Add the property namespace to the target document if not present - string property_ns = parseNamespace(store_uri); - for (auto i_document_ns : this->doc->namespaces) + if (doc) { - string prefix = i_document_ns.first; - string document_ns = i_document_ns.second; - if (!document_ns.compare(property_ns)) - target_doc->namespaces[prefix] = property_ns; - } - + string property_ns = parseNamespace(store_uri); + for (auto i_document_ns : this->doc->namespaces) + { + string prefix = i_document_ns.first; + string document_ns = i_document_ns.second; + if (!document_ns.compare(property_ns)) + target_doc->namespaces[prefix] = property_ns; + } + } + // If caller specified a namespace argument, then replace namespace in URIs // Don't overwrite namespaces for the wasDerivedFrom field, which points back to the original object if (ns.compare("") != 0 && store_uri.compare(SBOL_WAS_DERIVED_FROM) != 0) @@ -1472,44 +1943,91 @@ Identified& Identified::copy(Document* target_doc, string ns, string version) pos = property_val.find(old_ns, pos); if (pos != std::string::npos) { - SBOLObject* referenced_obj = doc->find(uri); // Distinguish between a referenced object versus an ontology URI - if (referenced_obj || store_uri == SBOL_PERSISTENT_IDENTITY) + // Copy object reference to new namespace and insert type + string replace_target; + string replacement; + string class_name; + if (store_uri == SBOL_PERSISTENT_IDENTITY) { - // Copy object reference to new namespace and insert type - if (Config::getOption("sbol_typed_uris").compare("True") == 0 && dynamic_cast(referenced_obj)) - { - property_val.erase(pos, old_ns.size()); - property_val.insert(pos, getHomespace() + "/" + parseClassName(referenced_obj->getTypeURI())); - } - else + class_name = parseClassName(new_obj.getTypeURI()); + replace_target = old_ns + "/" + class_name; + pos = property_val.find(replace_target, 0); + if (pos == std::string::npos) { - property_val.erase(pos, old_ns.size()); - property_val.insert(pos, getHomespace()); + replace_target = old_ns; + pos = property_val.find(replace_target, 0); } } - property_store_copy[i_property_val] = property_val; + else + { + SBOLObject* referenced_obj = doc->find(uri); // Distinguish between a referenced object versus an ontology URI + if (referenced_obj) + { + class_name = parseClassName(referenced_obj->getTypeURI()); + replace_target = old_ns + "/" + class_name; + pos = property_val.find(replace_target, 0); + if (pos == std::string::npos) + { + replace_target = old_ns; + pos = property_val.find(replace_target, 0); + } + } + } + // Construct replacement token + if (Config::getOption("sbol_compliant_uris") == "True" && Config::getOption("sbol_typed_uris") == "True") + { + replacement = getHomespace() + "/" + class_name; + } + else + { + replacement = getHomespace(); + } + property_val.erase(pos, replace_target.size()); + property_val.insert(pos, replacement); + property_store_copy[i_property_val] = property_val; } } } } new_obj.properties[store_uri] = property_store_copy; } - + // Set version - new_obj.wasDerivedFrom.set(this->identity.get()); - if (version.compare("") == 0) - new_obj.version.incrementMajor(); + if (version.compare("") != 0) + new_obj.version.set(version); + else if (this->version.size() > 0) + if (this->doc != NULL && this->doc == target_doc) // In order to create a copy of the object in this Document, it's version must be incremented + new_obj.version.incrementMajor(); + else + { + new_obj.version.set(this->version.get()); // Copy this object's version if the user doesn't specify a new one + } + + + string id; + if (Config::getOption("sbol_compliant_uris") == "True") + id = new_obj.persistentIdentity.get() + "/" + new_obj.version.get(); else - new_obj.version.set(version); - + id = new_obj.persistentIdentity.get(); + new_obj.identity.set(id); + + // Copy wasDerivedFrom + if (this->identity.get() != new_obj.identity.get()) + new_obj.wasDerivedFrom.set(this->identity.get()); // When generating a new object from an old, point back to the copied object + else if (this->wasDerivedFrom.size() > 0) + new_obj.wasDerivedFrom.set(this->wasDerivedFrom.get()); // When cloning an object, don't overwrite the wasDerivedFrom + for (auto i_store = owned_objects.begin(); i_store != owned_objects.end(); ++i_store) { string store_uri = i_store->first; + if (target_doc && std::find(hidden_properties.begin(), hidden_properties.end(), store_uri) != hidden_properties.end() ) + continue; + vector < SBOLObject* >& object_store = i_store->second; for (auto i_obj = object_store.begin(); i_obj != object_store.end(); ++i_obj) { Identified& child_obj = (Identified&)**i_obj; - + // Recurse into child objects and copy. This should be after all other object properties are set, to ensure proper generation of new URIs with updated namespace and version Identified& child_obj_copy = child_obj.copy(target_doc, ns, version); new_obj.owned_objects[store_uri].push_back((SBOLObject*)&child_obj_copy); // Copy child object @@ -1523,7 +2041,7 @@ Identified& Identified::simpleCopy(string uri) { // Call constructor for the copy Identified& new_obj = (Identified&)SBOL_DATA_MODEL_REGISTER[ this->type ](); - + // Copy properties for (auto i_store = properties.begin(); i_store != properties.end(); ++i_store) { @@ -1537,7 +2055,7 @@ Identified& Identified::simpleCopy(string uri) } new_obj.properties[store_uri] = property_store_copy; } - + // Initialize the object's URI, this code is same as Identified's constructor if(Config::getOption("sbol_compliant_uris").compare("True") == 0) { @@ -1559,10 +2077,10 @@ Identified& Identified::simpleCopy(string uri) } new_obj.type = this->type; - + // Record provenance of object new_obj.wasDerivedFrom.set(this->identity.get()); - + return new_obj; }; @@ -1588,21 +2106,21 @@ std::string Document::request_validation(std::string& sbol) request["main_file"] = sbol; Json::StyledWriter writer; string json = writer.write( request ); - - + + /* Perform HTTP request */ string response; CURL *curl; CURLcode res; - + /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); - + struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Accept: application/json"); headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, "charsets: utf-8"); - + /* get a curl handle */ curl = curl_easy_init(); if(curl) { @@ -1611,10 +2129,10 @@ std::string Document::request_validation(std::string& sbol) data. */ curl_easy_setopt(curl, CURLOPT_URL, Config::getOption("validator_url").c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - + /* Now specify the POST data */ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str()); - + /* Now specify the callback to read the response into string */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); @@ -1624,7 +2142,7 @@ std::string Document::request_validation(std::string& sbol) /* Check for errors */ if(res != CURLE_OK) throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Cannot validate online. HTTP post request failed with: " + string(curl_easy_strerror(res))); - + /* always cleanup */ curl_easy_cleanup(curl); } @@ -1656,7 +2174,7 @@ std::string Document::request_comparison(Document& diff_file) { /* Form validation options in JSON */ Json::Value request; // 'root' will contain the root value after parsing. - + vector opts = {"language", "test_equality", "check_uri_compliance", "check_completeness", "check_best_practices", "fail_on_first_error", "provide_detailed_stack_trace", "subset_uri", "uri_prefix", "version", "insert_type", "main_file_name", "diff_file_name" }; for (auto const& opt : opts) { @@ -1678,20 +2196,20 @@ std::string Document::request_comparison(Document& diff_file) Json::StyledWriter writer; string json = writer.write( request ); - + /* Perform HTTP request */ string response; CURL *curl; CURLcode res; - + /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); - + struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Accept: application/json"); headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, "charsets: utf-8"); - + /* get a curl handle */ curl = curl_easy_init(); if(curl) { @@ -1700,26 +2218,26 @@ std::string Document::request_comparison(Document& diff_file) data. */ curl_easy_setopt(curl, CURLOPT_URL, Config::getOption("validator_url").c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - + /* Now specify the POST data */ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str()); - + /* Now specify the callback to read the response into string */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); - + /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Cannot compare documents with online validator. HTTP get request failed with: " + string(curl_easy_strerror(res))); - + /* always cleanup */ curl_easy_cleanup(curl); } curl_slist_free_all(headers); curl_global_cleanup(); - + Json::Value json_response; Json::Reader reader; bool parsed = reader.parse( response, json_response ); //parse process @@ -1742,7 +2260,7 @@ std::string Document::query_repository(std::string command) { // /* Form validation options in JSON */ // Json::Value request; // 'root' will contain the root value after parsing. -// +// // vector opts = {"language", "test_equality", "check_uri_compliance", "check_completeness", "check_best_practices", "fail_on_first_error", "provide_detailed_stack_trace", "subset_uri", "uri_prefix", "version", "insert_type", "main_file_name", "diff_file_name" }; // for (auto const& opt : opts) // { @@ -1760,21 +2278,21 @@ std::string Document::query_repository(std::string command) // request["main_file"] = sbol; // Json::StyledWriter writer; // string json = writer.write( request ); - - + + /* Perform HTTP request */ string response; CURL *curl; CURLcode res; - + /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); - + struct curl_slist *headers = NULL; // headers = curl_slist_append(headers, "Accept: application/json"); // headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded"); // headers = curl_slist_append(headers, "charsets: utf-8"); - + /* get a curl handle */ curl = curl_easy_init(); if(curl) { @@ -1784,20 +2302,20 @@ std::string Document::query_repository(std::string command) //curl_easy_setopt(curl, CURLOPT_URL, Config::getOption("validator_url").c_str()); curl_easy_setopt(curl, CURLOPT_URL, "http://synbiohub.utah.edu/public/igem/BBa_F2620/1/sbol"); // curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - + /* Now specify the POST data */ // curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str()); - + /* Now specify the callback to read the response into string */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); - + /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Attempt to validate online failed with " + string(curl_easy_strerror(res))); - + /* always cleanup */ curl_easy_cleanup(curl); } @@ -1831,11 +2349,11 @@ std::string Document::search_metadata(std::string role, std::string type, std::s /* Form validation options in JSON */ Json::Value request; // 'root' will contain the root value after parsing. Json::Value criteria = Json::Value(Json::arrayValue); - + request["offset"] = 0; request["limit"] = 25; request["criteria"] = criteria; - + map Q = { {"role", role}, {"type", type}, {"name", name}, {"collection", collection} }; vector option_keys = { "role", "type", "name", "collection" }; for (auto const& key : option_keys) @@ -1850,24 +2368,24 @@ std::string Document::search_metadata(std::string role, std::string type, std::s } } request["criteria"] = criteria; - + Json::StyledWriter writer; string json = writer.write( request ); // cout << json << endl; - + /* Perform HTTP request */ string response; CURL *curl; CURLcode res; - + /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); - + struct curl_slist *headers = NULL; // headers = curl_slist_append(headers, "Accept: application/json"); headers = curl_slist_append(headers, "Content-Type: application/json"); // headers = curl_slist_append(headers, "charsets: utf-8"); - + /* get a curl handle */ curl = curl_easy_init(); if(curl) @@ -1878,26 +2396,26 @@ std::string Document::search_metadata(std::string role, std::string type, std::s //curl_easy_setopt(curl, CURLOPT_URL, Config::getOption("validator_url").c_str()); curl_easy_setopt(curl, CURLOPT_URL, "http://synbiohub.org/component/search/metadata"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - + /* Now specify the POST data */ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str()); - + /* Now specify the callback to read the response into string */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); - + /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Attempt to validate online failed with " + string(curl_easy_strerror(res))); - + /* always cleanup */ curl_easy_cleanup(curl); } curl_slist_free_all(headers); curl_global_cleanup(); - + cout << response << endl; Json::Value json_response; Json::Reader reader; @@ -1918,7 +2436,7 @@ std::string Document::search_metadata(std::string role, std::string type, std::s }; -Document& Document::copy(std::string ns, Document* doc) +Document& Document::copy(std::string ns, Document* doc, std::string version) { if (!doc) doc = new Document(); @@ -1926,8 +2444,27 @@ Document& Document::copy(std::string ns, Document* doc) for (auto & id_and_obj_pair : SBOLObjects) { TopLevel& tl = *(TopLevel*)id_and_obj_pair.second; - tl.copy(doc, ns, VERSION_STRING); + TopLevel* tl_copy; + try + { + if (version == "" && tl.version.size() == 1) + tl_copy = &tl.copy(doc, ns, tl.version.get()); + else if (version == "" && tl.version.size() == 0) + tl_copy = &tl.copy(doc, ns); + else + tl_copy = &tl.copy(doc, ns, VERSION_STRING); + } + catch(SBOLError &e) + { + if (e.error_code() == SBOL_ERROR_URI_NOT_UNIQUE) + { + continue; + } + else + throw SBOLError(e.error_code(), e.what()); + } } + doc->dress_document(); return *doc; }; @@ -1958,8 +2495,6 @@ void ReferencedObject::set(SBOLObject& obj) { if (obj.type != reference_type_uri) throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Cannot set " + this->type + " property. The referenced object is not the correct type."); -// if (!this->sbol_owner->doc) -// throw SBOLError(SBOL_ERROR_MISSING_DOCUMENT, "Cannot set " + this->type + " property of " + this->sbol_owner->identity.get() + " This object does not belong to a Document. Either add it to a Document, or use set(obj.identity) to set an external reference."); TopLevel* tl = dynamic_cast(&obj); if (this->sbol_owner->doc) @@ -1976,8 +2511,6 @@ void ReferencedObject::add(SBOLObject& obj) { if (obj.type != reference_type_uri) throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Cannot set " + this->type + " property. The referenced object is not the correct type."); -// if (!this->sbol_owner->doc) -// throw SBOLError(SBOL_ERROR_MISSING_DOCUMENT, "Cannot set " + this->type + " property of " + this->sbol_owner->identity.get() + " This object does not belong to a Document. Either add it to a Document, or use set(obj.identity) to set an external reference."); TopLevel* tl = dynamic_cast(&obj); if (this->sbol_owner->doc) @@ -2024,13 +2557,13 @@ void SBOLObject::update_uri() // Reset SBOLCompliant properties sbol_obj.identity.set(obj_id); sbol_obj.persistentIdentity.set(persistent_id); - + // Check for uniqueness of URI in local object properties vector matches = this->parent->find_property_value(SBOL_IDENTITY, obj_id); if (matches.size() > 1) - throw SBOLError(DUPLICATE_URI_ERROR, "Cannot update SBOL-compliant URI. The URI " + sbol_obj.identity.get() + " is not unique"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "Cannot update SBOL-compliant URI. The URI " + sbol_obj.identity.get() + " is not unique"); + - for (auto & property : sbol_obj.owned_objects) { std::string property_name = property.first; @@ -2044,7 +2577,7 @@ void SBOLObject::update_uri() { vector matches = parent.doc->find_property_value(SBOL_IDENTITY, sbol_obj.identity.get()); if (matches.size() > 1) - throw SBOLError(DUPLICATE_URI_ERROR, "Cannot update SBOL-compliant URI. An object with URI " + sbol_obj.identity.get() + " is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "Cannot update SBOL-compliant URI. An object with URI " + sbol_obj.identity.get() + " is already in the Document"); } }; diff --git a/source/document.h b/source/document.h index 7a4c41d8..3fafaa77 100644 --- a/source/document.h +++ b/source/document.h @@ -40,11 +40,13 @@ #include "combinatorialderivation.h" #include "implementation.h" #include "dbtl.h" +#include "experiment.h" #include #include #include #include +#include #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) #include "Python.h" @@ -67,17 +69,13 @@ namespace sbol { friend class SBOLObject; private: - std::string home; ///< The authoritative namespace for the Document. Setting the home namespace is like signing a piece of paper. - int SBOLCompliant; ///< Flag indicating whether to autoconstruct URI's consistent with SBOL's versioning scheme ValidationRules validationRules; ///< A list of validation functions to run on the Document prior to serialization raptor_world *rdf_graph; ///< RDF triple store that holds SBOL objects and properties public: /// Construct a Document. The Document is a container for Components, Modules, and all other SBOLObjects Document() : - Identified(SBOL_DOCUMENT, ""), - home(""), - SBOLCompliant(0), + Identified(SBOL_DOCUMENT, "", VERSION_STRING), rdf_graph(raptor_new_world()), validationRules({ }), designs(this, SYSBIO_DESIGN, '0', '*', { libsbol_rule_11 }), @@ -95,14 +93,19 @@ namespace sbol { attachments(this, SBOL_ATTACHMENT, '0', '*', ValidationRules({})), combinatorialderivations(this, SBOL_COMBINATORIAL_DERIVATION, '0', '*', ValidationRules({})), implementations(this, SBOL_IMPLEMENTATION, '0', '*', ValidationRules({})), + experiments(this, SBOL_EXPERIMENT, '0', '*', ValidationRules({})), + experimentalData(this, SBOL_EXPERIMENTAL_DATA, '0', '*', ValidationRules({})), sampleRosters(this, SYSBIO_SAMPLE_ROSTER, '0', '*', { libsbol_rule_16 }), citations(this, PURL_URI "bibliographicCitation", '0', '*', ValidationRules({})), keywords(this, PURL_URI "elements/1.1/subject", '0', '*', ValidationRules({})) { + namespaces["rdf"] = RDF_URI; namespaces["sbol"] = SBOL_URI "#"; namespaces["dcterms"] = PURL_URI; namespaces["prov"] = PROV_URI "#"; namespaces["sys-bio"] = SYSBIO_URI "#"; + for (auto & ns : Config::extension_namespaces) + namespaces[ns.first] = ns.second; doc = this; }; @@ -117,7 +120,9 @@ namespace sbol { /// @cond /// The Document's register of objects std::unordered_map SBOLObjects; - + std::map objectCache; + std::set resource_namespaces; + TopLevel& getTopLevel(std::string); raptor_world* getWorld(); /// @endcond @@ -138,6 +143,8 @@ namespace sbol { OwnedObject combinatorialderivations; OwnedObject implementations; OwnedObject sampleRosters; + OwnedObject experiments; + OwnedObject experimentalData; URIProperty citations; URIProperty keywords; @@ -188,18 +195,25 @@ namespace sbol { /// @return The comparison results std::string request_comparison(Document& diff_file); + /// Delete all properties and objects in the Document + void clear(); + std::string query_repository(std::string command); std::string search_metadata(std::string role, std::string type, std::string name, std::string collection); - + + static std::string string_from_raptor_term(raptor_term *term, bool addWrapper=false); + /// Generates rdf/xml void generate(raptor_world** world, raptor_serializer** sbol_serializer, char** sbol_buffer, size_t* sbol_buffer_len, raptor_iostream** ios, raptor_uri** base_uri); + void serialize_rdfxml(std::ostream &os); + /// Run validation on this Document via the online validation tool. /// @return A string containing a message with the validation results std::string validate(); - Document& copy(std::string ns, Document* doc = NULL); + Document& copy(std::string ns = "", Document* doc = NULL, std::string version = ""); /// Get the total number of objects in the Document, including SBOL core object and custom annotation objects int size() @@ -221,7 +235,40 @@ namespace sbol { }; #endif - + void cacheObjects(); + + std::string referenceNamespace(const std::string uri) const { + std::string newURI = uri; + + if(default_namespace.size() > 0) { + std::string::size_type pos = newURI.find(default_namespace); + + if(pos != std::string::npos) + { + newURI = newURI.replace(pos, default_namespace.size(), + ""); + return newURI; + } + } + + for(auto nsPair : namespaces) + { + std::string::size_type pos = newURI.find(nsPair.second); + if(pos == std::string::npos) + { + continue; + } + + newURI = newURI.replace(pos, nsPair.second.size(), + nsPair.first + ":"); + + // Assume only one namespace per URI + break; + } + + return newURI; + } + /// Get a summary of objects in the Document, including SBOL core object and custom annotation objects std::string summary() { @@ -253,8 +300,9 @@ namespace sbol { } // override the indirection operator - sbol::SBOLObject& operator*() { - return *std::unordered_map::iterator::operator*().second; + sbol::TopLevel& operator*() { + SBOLObject* obj = std::unordered_map::iterator::operator*().second; + return *(TopLevel*)obj; } }; @@ -280,14 +328,24 @@ namespace sbol { static void parse_objects(void* user_data, raptor_statement* triple); static void parse_properties(void* user_data, raptor_statement* triple); static void namespaceHandler(void *user_data, raptor_namespace *nspace); + static void count_triples(void *user_data, raptor_statement* triple); void addNamespace(std::string ns, std::string prefix, raptor_serializer* sbol_serializer); void parse_annotation_objects(); - void parse_extension_objects(); + void dress_document(); + + void parse_objects_inner(const std::string &subject, + const std::string &object); + + void parse_properties_inner(const std::string &subject, + const std::string &predicate, + const std::string &object); SBOLObject* find_property(std::string uri); std::vector find_reference(std::string uri); /// @endcond + int countTriples(); + /// @return A vector of namespaces /// Get namespaces contained in this Document std::vector getNamespaces(); @@ -364,16 +422,18 @@ namespace sbol { template void Document::add(SBOLClass& sbol_obj) { - // Check if the uri is already assigned and delete the object, otherwise it will cause a memory leak!!! - //if (SBOLObjects[whatever]!=SBOLObjects.end()) {delete SBOLObjects[whatever]'} + // Check for uniqueness of URI if (this->SBOLObjects.find(sbol_obj.identity.get()) != this->SBOLObjects.end()) - throw SBOLError(DUPLICATE_URI_ERROR, "Cannot add " + sbol_obj.identity.get() + " to Document. An object with this identity is already contained in the Document"); + { + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "Cannot add " + sbol_obj.identity.get() + " to Document. An object with this identity is already contained in the Document"); + } else { // If TopLevel add to Document. + if (dynamic_cast(&sbol_obj)) + SBOLObjects[sbol_obj.identity.get()] = (SBOLObject*)&sbol_obj; if (owned_objects.find(sbol_obj.type) != owned_objects.end()) { - SBOLObjects[sbol_obj.identity.get()] = (SBOLObject*)&sbol_obj; sbol_obj.parent = this; // Set back-pointer to parent object this->owned_objects[sbol_obj.getTypeURI()].push_back((SBOLClass*)&sbol_obj); // Add the object to the Document's property store, eg, componentDefinitions, moduleDefinitions, etc. } @@ -384,7 +444,13 @@ namespace sbol { std::vector& object_store = i_store->second; for (auto i_obj = object_store.begin(); i_obj != object_store.end(); ++i_obj) { - this->add(**i_obj); + SBOLObject& owned_obj = **i_obj; + // // This check for URI duplication adds an inefficiency but is a necessary kludge to accommodate the OwnedObject pattern + // if (this->SBOLObjects.find(owned_obj.identity.get()) == this->SBOLObjects.end()) + if (owned_obj.doc != this) + { + this->add(**i_obj); + } } } } @@ -399,11 +465,11 @@ namespace sbol { } }; - template<> - Design& Document::get(std::string uri); // Definition is in dbtl.cpp + // template<> + // Design& Document::get(std::string uri); // Definition is in dbtl.cpp - template<> - Build& Document::get(std::string uri); // Definition is in dbtl.cpp + // template<> + // Build& Document::get(std::string uri); // Definition is in dbtl.cpp template SBOLClass& Document::get(std::string uri) { @@ -471,6 +537,7 @@ namespace sbol { /// @cond std::string convert_ntriples_encoding_to_ascii(std::string s); // Convert ntriple encoding down to ascii, removing escape codes. See https://www.w3.org/TR/2004/REC-rdf-testcases-20040210/#ntrip_strings + std::string cut_sbol_resource(std::string& xml_string, const std::string resource_id); void replace_reference_to_resource(std::string& xml_string, const std::string property_name, const std::string resource_id, std::string& replacement_text); void seek_element(std::istringstream& xml_buffer, std::string uri); @@ -566,9 +633,9 @@ namespace sbol { // Check for uniqueness of URI in the Document if (parent_doc && parent_doc->find(child_id)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + child_id + " is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + child_id + " is already in the Document"); if (this->find(child_id)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + child_id + " is already in the " + this->type + " property"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + child_id + " is already in the " + this->type + " property"); // Initialize SBOLCompliant properties child_obj->identity.set(child_id); @@ -594,7 +661,7 @@ namespace sbol { else { if (parent_doc && parent_doc->find(uri)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + uri + " is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + uri + " is already in the Document"); // Construct a new child object //SBOLClass* child_obj = new SBOLClass(uri); @@ -657,9 +724,9 @@ namespace sbol { // Check for uniqueness of URI in the Document if (parent_doc && parent_doc->find(child_id)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + child_id + " is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + child_id + " is already in the Document"); if (this->find(child_id)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + child_id + " is already in the " + this->type + " property"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + child_id + " is already in the " + this->type + " property"); // Construct a new child object SBOLSubClass* child_obj = new SBOLSubClass(); @@ -688,7 +755,7 @@ namespace sbol { else { if (parent_doc && parent_doc->find(uri)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + uri + " is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + uri + " is already in the Document"); // Construct an SBOLObject with emplacement SBOLSubClass* child_obj = new SBOLSubClass(uri); @@ -715,14 +782,24 @@ namespace sbol { if (check_top_level && this->sbol_owner->doc) { Document& doc = (Document &)*this->sbol_owner->doc; - doc.add(sbol_obj); + if (this->isHidden() && doc.find(sbol_obj.identity.get())) // In order to avoid a duplicate URI error, don't attempt to add the object if this is a hidden property, + { + } + else + doc.add(sbol_obj); } - + + set_notoplevelcheck(sbol_obj); + }; + + template < class SBOLClass> + void OwnedObject::set_notoplevelcheck(SBOLClass& sbol_obj) + { // Add to parent object if (!this->sbol_owner->owned_objects[this->type].size()) this->sbol_owner->owned_objects[this->type].push_back((SBOLObject *)&sbol_obj); else - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "This property is already set. Call remove before attempting to overwrite the value."); + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot set " + parsePropertyName(this->type) + " property. The property is already set. Call remove before attempting to overwrite the value."); sbol_obj.parent = this->sbol_owner; // Set back-pointer to parent object // Update URI for the argument object and all its children, if SBOL-compliance is enabled. @@ -747,7 +824,7 @@ namespace sbol { { std::vector< sbol::SBOLObject* >& object_store = this->sbol_owner->owned_objects[this->type]; if (std::find(object_store.begin(), object_store.end(), &sbol_obj) != object_store.end()) - throw SBOLError(DUPLICATE_URI_ERROR, "The object " + sbol_obj.identity.get() + " is already contained by the " + this->type + " property"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "The object " + sbol_obj.identity.get() + " is already contained by the " + this->type + " property"); // Add to Document and check for uniqueness of URI if (this->sbol_owner->doc) @@ -905,6 +982,12 @@ namespace sbol { template SBOLClass& OwnedObject::operator[] (std::string uri) { + if (Config::getOption("verbose") == "True") + { + std::cout << "SBOL compliant URIs are set to " << Config::getOption("sbol_compliant_uris") << std::endl; + std::cout << "SBOL typed URIs are set to " << Config::getOption("sbol_typed_uris") << std::endl; + std::cout << "Searching for " << uri << std::endl; + } // Search this property's object store for the uri std::vector *object_store = &this->sbol_owner->owned_objects[this->type]; for (auto i_obj = object_store->begin(); i_obj != object_store->end(); ++i_obj) @@ -915,29 +998,86 @@ namespace sbol { return (SBOLClass&)*obj; } } - // In SBOLCompliant mode, the user may retrieve an object by displayId as well - if (Config::getOption("sbol_compliant_uris").compare("True") == 0) + + // If searching by the full URI fails, assume the user is searching for an SBOL-compliant URI using the displayId only + + // Form compliant URI for child object + SBOLObject* parent_obj = this->sbol_owner; + std::string compliant_uri; + std::string persistentIdentity; + std::string version; + + std::vector resource_namespaces; + resource_namespaces.push_back(getHomespace()); + if (parent_obj->doc) + { + for (auto & ns : parent_obj->doc->resource_namespaces) + resource_namespaces.push_back(ns); + } + + // Check for regular, SBOL-compliant URIs + for (auto & ns : resource_namespaces) { - // Form compliant URI for child object - SBOLObject* parent_obj = this->sbol_owner; - std::string compliant_uri; - std::string persistentIdentity; - std::string version; - // Assume the parent object is TopLevel and form the compliant URI - if (Config::getOption("sbol_typed_uris").compare("True") == 0) - { + compliant_uri = ns + "/" + uri + "/"; + if (Config::getOption("verbose") == "True") + std::cout << "Searching for TopLevel: " << compliant_uri << std::endl; - persistentIdentity = getHomespace() + "/" + parseClassName(this->type); + std::vector< SBOLClass* > persistent_id_matches; + for (auto i_obj = object_store->begin(); i_obj != object_store->end(); i_obj++) + { + SBOLObject* obj = *i_obj; + size_t found; + found = obj->identity.get().find(compliant_uri); + if (found != std::string::npos) + { + persistent_id_matches.push_back((SBOLClass*)obj); + } + // Sort objects with same persistentIdentity by version + sort(persistent_id_matches.begin(), persistent_id_matches.end(), [](SBOLClass* a, SBOLClass* b) { + return (a->version.get() < b->version.get()); + }); + } + // If objects matching the persistentIdentity were found, return the most recent version + if (persistent_id_matches.size() > 0) + return (SBOLClass&)*persistent_id_matches.back(); + + // Assume the object is not TopLevel + if (parent_obj->properties.find(SBOL_PERSISTENT_IDENTITY) != parent_obj->properties.end()) + { + persistentIdentity = parent_obj->properties[SBOL_PERSISTENT_IDENTITY].front(); + persistentIdentity = persistentIdentity.substr(1, persistentIdentity.length() - 2); // Removes flanking < and > from the uri + } + if (parent_obj->properties.find(SBOL_VERSION) != parent_obj->properties.end()) + { + version = parent_obj->properties[SBOL_VERSION].front(); + version = version.substr(1, version.length() - 2); // Removes flanking " from the uri + compliant_uri = persistentIdentity + "/" + uri + "/" + version; } else { - persistentIdentity = getHomespace(); + compliant_uri = persistentIdentity + "/" + uri; } + if (Config::getOption("verbose") == "True") + std::cout << "Searching for non-TopLevel: " << compliant_uri << std::endl; + for (auto i_obj = object_store->begin(); i_obj != object_store->end(); i_obj++) + { + SBOLObject* obj = *i_obj; + if (compliant_uri.compare(obj->identity.get()) == 0) + { + return (SBOLClass&)*obj; + } + } + } + // Check for typed, SBOL-compliant URIs + for (auto & ns : resource_namespaces) + { + // Assume the parent object is TopLevel and form the typed, compliant URI + compliant_uri = ns + "/" + parseClassName(this->type) + "/" + uri + "/"; + + if (Config::getOption("verbose") == "True") + std::cout << "Searching for TopLevel: " << compliant_uri << std::endl; - // Find latest version if they are using a different semantic versioning scheme - // This needs some work - compliant_uri = persistentIdentity + "/" + uri; std::vector< SBOLClass* > persistent_id_matches; for (auto i_obj = object_store->begin(); i_obj != object_store->end(); i_obj++) { @@ -973,7 +1113,8 @@ namespace sbol { { compliant_uri = persistentIdentity + "/" + uri; } - + if (Config::getOption("verbose") == "True") + std::cout << "Searching for non-TopLevel: " << compliant_uri << std::endl; for (auto i_obj = object_store->begin(); i_obj != object_store->end(); i_obj++) { SBOLObject* obj = *i_obj; @@ -1087,7 +1228,7 @@ namespace sbol { { std::vector< sbol::SBOLObject* >& object_store = this->sbol_owner->owned_objects[this->type]; if (std::find(object_store.begin(), object_store.end(), sbol_obj) != object_store.end()) - throw SBOLError(DUPLICATE_URI_ERROR, "The object " + sbol_obj->identity.get() + " is already contained by the property"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "The object " + sbol_obj->identity.get() + " is already contained by the property"); else { sbol_obj->parent = this->sbol_owner; // Set back-pointer to parent object @@ -1238,7 +1379,7 @@ namespace sbol { // Check for uniqueness of URI in the Document if (parent_doc && parent_doc->find(child_id)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + child_id + " is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + child_id + " is already in the Document"); // Construct a new child object // SBOLClass* child_obj = new SBOLClass(uri); @@ -1268,7 +1409,7 @@ namespace sbol { else { if (parent_doc && parent_doc->find(uri)) - throw SBOLError(DUPLICATE_URI_ERROR, "An object with URI " + uri + " is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with URI " + uri + " is already in the Document"); // Construct a new child object PyObject* py_obj = PyObject_CallObject(constructor_for_owned_object, NULL); @@ -1392,7 +1533,6 @@ namespace sbol { { if (this->sbol_owner) { - if (this->sbol_owner->owned_objects.find(this->type) != this->sbol_owner->owned_objects.end()) { std::vector& object_store = this->sbol_owner->owned_objects[this->type]; @@ -1411,7 +1551,8 @@ namespace sbol { // Erase nested, hidden TopLevel objects from Document if (obj->doc && !obj->doc->find(uri)) obj->doc = NULL; - SBOLClass* cast_obj = dynamic_cast(cast_obj); + + SBOLClass* cast_obj = dynamic_cast(obj); return *cast_obj; } } @@ -1460,6 +1601,13 @@ namespace sbol { for (auto i_obj = object_store.begin(); i_obj != object_store.end(); ++i_obj) { SBOLObject* obj = *i_obj; + if (dynamic_cast(obj)) + { + if (obj->doc) + { + obj->doc->SBOLObjects.erase(obj->identity.get()); + } + } obj->close(); } object_store.clear(); @@ -1477,9 +1625,29 @@ namespace sbol { if (!target_doc) target_doc = this->doc; Identified& obj_copy = Identified::copy(target_doc, ns, version); - SBOLClass& new_obj = (SBOLClass&)obj_copy; - if (target_doc) - target_doc->add < SBOLClass > (new_obj); + SBOLObject* p_new_obj; + if (SBOL_DATA_MODEL_REGISTER.find(obj_copy.type) != SBOL_DATA_MODEL_REGISTER.end()) + p_new_obj = &(SBOLObject&)obj_copy; + else + { + p_new_obj = &(SBOLObject&)obj_copy. template cast(); + obj_copy.close(); + } + + SBOLClass& new_obj = *(SBOLClass*)p_new_obj; + try + { + if (target_doc) + target_doc->add < SBOLClass > (new_obj); + } + catch(SBOLError &e) + { + if (e.error_code() == SBOL_ERROR_URI_NOT_UNIQUE) + { + new_obj.close(); + } + throw SBOLError(e.error_code(), e.what()); + } return new_obj; }; @@ -1524,7 +1692,7 @@ namespace sbol { // Check for uniqueness of URI in the Document if (doc && doc->find(new_obj.identity.get())) - throw SBOLError(DUPLICATE_URI_ERROR, "Cannot generate " + uri + ". An object with that URI is already in the Document"); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "Cannot generate " + uri + ". An object with that URI is already in the Document"); doc->add(new_obj); std::string id; diff --git a/source/experiment.h b/source/experiment.h new file mode 100644 index 00000000..dab2da4e --- /dev/null +++ b/source/experiment.h @@ -0,0 +1,74 @@ +/** + * @file experiment.h + * @brief Classes for grouping experimental data files + * @author Bryan Bartley + * @email bartleyba@sbolstandard.org + * + * */ + +#ifndef EXPERIMENT_INCLUDED +#define EXPERIMENT_INCLUDED + +namespace sbol +{ + + /// The ExperimentalData class represents a set of links to experimental data files (Attachment objects) that are typically but not always associated with a single sample, experimental condition, and/or lab instrument. + class SBOL_DECLSPEC ExperimentalData : public TopLevel + { + public: + /// Construct a new ExperimentalData object. + /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. + /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string of the form "major.minor.patch". + ExperimentalData(std::string uri = "example", std::string version = VERSION_STRING) : ExperimentalData(SBOL_EXPERIMENTAL_DATA, uri, version) {}; + + /// Constructor used for defining extension classes + /// @param rdf_type The RDF type for an extension class derived from this one + ExperimentalData(rdf_type type, std::string uri, std::string version) : + TopLevel(type, uri, version) + { + }; + virtual ~ExperimentalData(){}; + }; + + + /// A generated Entity is linked through a wasGeneratedBy relationship to an Activity, which is used to describe how different Agents and other entities were used. An Activity is linked through a qualifiedAssociation to Associations, to describe the role of agents, and is linked through qualifiedUsage to Usages to describe the role of other entities used as part of the activity. Moreover, each Activity includes optional startedAtTime and endedAtTime properties. When using Activity to capture how an entity was derived, it is expected that any additional information needed will be attached as annotations. This may include software settings or textual notes. Activities can also be linked together using the wasInformedBy relationship to provide dependency without explicitly specifying start and end times. + class SBOL_DECLSPEC Experiment : public TopLevel + { + public: + /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. + /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string of the form "major.minor.patch". + Experiment(std::string uri = "example", std::string version = VERSION_STRING) : Experiment(SBOL_EXPERIMENT, uri, version) {}; + + /// Constructor used for defining extension classes + /// @param rdf_type The RDF type for an extension class derived from this one + Experiment(rdf_type type, std::string uri, std::string version) : + TopLevel(type, uri, version), + experimentalData(this, SBOL_URI "#experimentalData", SBOL_EXPERIMENTAL_DATA, '0', '*', ValidationRules({})) + { + }; + + /// The experimentalData property is OPTIONAL and MAY contain zero or more URIs that refer to ExperimentalData objects. + ReferencedObject experimentalData; + + virtual ~Experiment(){}; + }; +} + +#endif /* EXPERIMENT_INCLUDED */ diff --git a/source/identified.h b/source/identified.h index 19901a63..b48cfce3 100644 --- a/source/identified.h +++ b/source/identified.h @@ -41,7 +41,7 @@ namespace sbol friend class PartShop; public: - Identified(rdf_type type_uri, std::string uri, std::string version = "1.0.0") : + Identified(rdf_type type_uri = SBOL_IDENTIFIED, std::string uri = "example", std::string version = VERSION_STRING) : SBOLObject(type_uri, uri), persistentIdentity(this, SBOL_PERSISTENT_IDENTITY, '0', '1', ValidationRules({}), uri), displayId(this, SBOL_DISPLAY_ID, '0', '1', ValidationRules({ sbol_rule_10204 })), diff --git a/source/implementation.h b/source/implementation.h index 1e33a0f6..e4997a84 100644 --- a/source/implementation.h +++ b/source/implementation.h @@ -36,7 +36,7 @@ namespace sbol public: /// Construct an Implementation /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. - Implementation(std::string uri = "example", std::string version = "1.0.0") : Implementation(SBOL_IMPLEMENTATION, uri, version) {}; + Implementation(std::string uri = "example", std::string version = VERSION_STRING) : Implementation(SBOL_IMPLEMENTATION, uri, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one diff --git a/source/model.h b/source/model.h index 3b6c6cb1..a90b9903 100644 --- a/source/model.h +++ b/source/model.h @@ -39,7 +39,7 @@ namespace sbol /// @param source A URI reference to the model file /// @param An EDAM ontology term that specifies the language in which the model was implemented /// @param An SBOL ontology term that specifies whether the model is continuous, discrete, or other modeling technique - Model(std::string uri = "example", std::string source = "", std::string language = EDAM_SBML, std::string framework = SBO_CONTINUOUS, std::string version = "1.0.0") : Model(SBOL_MODEL, uri, source, language, framework, version) {}; + Model(std::string uri = "example", std::string source = "", std::string language = EDAM_SBML, std::string framework = SBO_CONTINUOUS, std::string version = VERSION_STRING) : Model(SBOL_MODEL, uri, source, language, framework, version) {}; /// Constructor used for defining extension classes /// @param type The RDF type for an extension class derived from this one diff --git a/source/module.h b/source/module.h index 7ae3d708..bf2c3492 100644 --- a/source/module.h +++ b/source/module.h @@ -48,7 +48,7 @@ namespace sbol /// @param uri If operating in open-world mode, this should be a full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param definition The identity of the Component with this structural constraint /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string of the form "major.minor.patch". - Module(std::string uri = "example", std::string definition = "", std::string version = "1.0.0") : Module(SBOL_MODULE, uri, definition, version) {}; + Module(std::string uri = "example", std::string definition = "", std::string version = VERSION_STRING) : Module(SBOL_MODULE, uri, definition, version) {}; /// Constructor used for defining extension classes /// @param type The RDF type for an extension class derived from this one diff --git a/source/moduledefinition.h b/source/moduledefinition.h index b2a306e7..c513ba53 100644 --- a/source/moduledefinition.h +++ b/source/moduledefinition.h @@ -46,7 +46,7 @@ namespace sbol /// Construct a ModuleDefinition /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a valid [Maven version string](http://maven.apache.org/). - ModuleDefinition(std::string uri = "example", std::string version = "1.0.0") : ModuleDefinition(SBOL_MODULE_DEFINITION, uri, version) {}; + ModuleDefinition(std::string uri = "example", std::string version = VERSION_STRING) : ModuleDefinition(SBOL_MODULE_DEFINITION, uri, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one @@ -103,6 +103,12 @@ namespace sbol /// @param lowlevel A low-level FunctionalComponent in a nested sub-Module void override(FunctionalComponent& highlevel, FunctionalComponent& lowlevel); + /// Perform an operation on every ModuleDefinition in a structurally-linked hierarchy of ModuleDefinitions by applying a callback function. If no callback is specified, the default behavior is to return a pointer list of each ModuleDefinition in the hierarchy. + /// @param callback_fun A pointer to a callback function with signature void callback_fn(ModuleDefinition *, void *). + /// @param user_data Arbitrary user data which can be passed in and out of the callback as an argument or return value. + /// @return Returns a flat list of pointers to all ModuleDefinitions in the hierarchy. + std::vector applyToModuleHierarchy(void (*callback_fn)(ModuleDefinition *, void *) = NULL, void * user_data = NULL); + virtual ~ModuleDefinition() {}; /// Assemble a high-level ModuleDefinition from lower-level submodules. Autoconstructs Module objects in the process. @@ -111,4 +117,4 @@ namespace sbol }; } -#endif \ No newline at end of file +#endif diff --git a/source/object.cpp b/source/object.cpp index 708ad932..8ebef23e 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -29,6 +29,7 @@ #include #include #include +#include "document.h" #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) #include "Python.h" @@ -44,9 +45,12 @@ SBOLObject::~SBOLObject() { for (auto &i_own : owned_objects) { - vector& object_store = i_own.second; - for (auto &i_obj : object_store) - i_obj->close(); + if (std::find(hidden_properties.begin(), hidden_properties.end(), i_own.first) == hidden_properties.end()) + { + vector& object_store = i_own.second; + for (auto &i_obj : object_store) + i_obj->close(); + } } } } @@ -62,7 +66,7 @@ void SBOLObject::register_extension_class(PyObject* python_class, std::string ex // size_t left_class_name = repr_name.find_last_of('.') + 1; // size_t len_class_name = repr_name.size() - left_class_name - 2; // eg, // std::string class_name = repr_name.substr(left_class_name, len_class_name); - + // Register namespace and its prefix (extension name) Config::PYTHON_DATA_MODEL_REGISTER[getTypeURI()] = python_class; std::string ns = parseNamespace(getTypeURI()); @@ -80,15 +84,15 @@ PyObject* SBOLObject::cast(PyObject* python_class) int own; PyObject *next; } SwigPyObject; - + PyObject* py_obj = PyObject_CallObject(python_class, NULL); // Call constructor PyObject* temp_py_object = PyObject_GetAttr(py_obj, PyUnicode_FromString("this")); SwigPyObject* swig_py_object = (SwigPyObject*)PyObject_GetAttr(py_obj, PyUnicode_FromString("this")); SBOLObject* new_obj = (SBOLObject *)swig_py_object->ptr; - + // Set identity new_obj->identity.set(this->identity.get()); - + // Copy properties for (auto it = this->properties.begin(); it != this->properties.end(); it++) { @@ -104,12 +108,14 @@ PyObject* SBOLObject::cast(PyObject* python_class) } new_obj->parent = this->parent; new_obj->doc = this->doc; - + return py_obj; }; #endif + + bool sbol::operator !=(const SBOLObject &a, const SBOLObject &b) { return (&a != &b); @@ -163,7 +169,7 @@ int SBOLObject::compare(SBOLObject* comparand) int IS_EQUAL = 0; } } - + std::string l_id; std::string r_id; std::map < std::string, std::vector >::iterator i_lp; // iterator for left-hand side @@ -237,7 +243,7 @@ int SBOLObject::compare(SBOLObject* comparand) for (auto i_p = owned_objects.begin(); i_p != owned_objects.end(); ++i_p) { string p = i_p->first; - + SBOLObject* l; SBOLObject* r; if (this->owned_objects[p].size() >= comparand->owned_objects[p].size()) @@ -253,7 +259,7 @@ int SBOLObject::compare(SBOLObject* comparand) vector& l_object_store = l->owned_objects[p]; vector& r_object_store = r->owned_objects[p]; - + map l_store_map; map r_store_map; for (auto i_obj = l_object_store.begin(); i_obj != l_object_store.end(); ++i_obj) @@ -312,6 +318,41 @@ int SBOLObject::compare(SBOLObject* comparand) // return 0; //}; + +void SBOLObject::apply(void (*callback_fn)(SBOLObject *, void *), void * user_data) +{ + callback_fn(this, user_data); + for (auto i_store = owned_objects.begin(); i_store != owned_objects.end(); ++i_store) + { + // Skip hidden properties + if (std::find(hidden_properties.begin(), hidden_properties.end(), i_store->first) != hidden_properties.end()) + continue; + vector& store = i_store->second; + for (auto i_obj = store.begin(); i_obj != store.end(); ++i_obj) + { + SBOLObject& obj = **i_obj; + obj.apply(callback_fn, user_data); + } + } + return; +}; + +void SBOLObject::cacheObjects(std::map &cache) { + cache[identity.get()] = this; + + for (auto i_store = owned_objects.begin(); i_store != owned_objects.end(); ++i_store) + { + if (std::find(hidden_properties.begin(), hidden_properties.end(), i_store->first) != hidden_properties.end()) + continue; + vector& store = i_store->second; + for (auto i_obj = store.begin(); i_obj != store.end(); ++i_obj) + { + SBOLObject &obj = **i_obj; + obj.cacheObjects(cache); + } + } +} + SBOLObject* SBOLObject::find(string uri) { if (identity.get() == uri) @@ -388,8 +429,8 @@ vector SBOLObject::find_property_value(string uri, string value, ve matches.insert(matches.end(), more_matches.begin(), more_matches.end()); } } - if (properties.find(uri) == properties.end()) - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot find property value. " + uri + " is not a valid property type."); + // if (properties.find(uri) == properties.end()) + // throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot find property value. " + uri + " is not a valid property type."); std::vector value_store = properties[uri]; for (auto & val : value_store) { @@ -414,18 +455,26 @@ vector SBOLObject::find_reference(string uri) for (auto i_obj = store.begin(); i_obj != store.end(); ++i_obj) { SBOLObject& obj = **i_obj; - matches = obj.find_reference(uri); + vector newMatches = obj.find_reference(uri); + for(auto &el : newMatches) + { + matches.push_back(el); + } } } + for (auto &i_p : properties) { - string val = i_p.second.front(); - if (val.compare("<" + uri + ">") == 0) + for(string val : i_p.second) { - matches.push_back(this); - break; + if (val.compare("<" + uri + ">") == 0) + { + matches.push_back(this); + break; + } } } + return matches; }; @@ -456,17 +505,39 @@ std::string SBOLObject::getPropertyValue(std::string property_uri) void SBOLObject::setPropertyValue(std::string property_uri, std::string val) { + if (properties.find(property_uri) != properties.end()) + { + if (properties[property_uri][0][0] == '<') + { + // Check if new value is a URI... + properties[property_uri][0] = "<" + val + ">"; + } + else if (properties[property_uri][0][0] == '\"') + { + // ...else treat the value as a literal + properties[property_uri][0] = "\"" + val + "\""; + } + } + else throw SBOLError(SBOL_ERROR_NOT_FOUND, property_uri + " not contained in this object."); - if (val[0] == '<' && val[val.length() - 1] == '>') +}; + +void SBOLObject::addPropertyValue(std::string property_uri, std::string val) +{ + if (properties.find(property_uri) != properties.end()) + { + if (properties[property_uri][0][0] == '<') { // Check if new value is a URI... - properties[property_uri].push_back(val); + properties[property_uri].push_back("<" + val + ">"); } - else + else if (properties[property_uri][0][0] == '\"') { // ...else treat the value as a literal properties[property_uri].push_back("\"" + val + "\""); } + } + else throw SBOLError(SBOL_ERROR_NOT_FOUND, property_uri + " not contained in this object."); }; std::vector < std::string > SBOLObject::getPropertyValues(std::string property_uri) @@ -786,3 +857,128 @@ void ReferencedObject::addReference(const std::string uri) this->sbol_owner->properties[this->type].push_back("<" + uri + ">"); }; +void SBOLObject::serialize_rdfxml(std::ostream &os, size_t indentLevel) { + const size_t spaces_per_indent = 2; + + std::string indentString = std::string(spaces_per_indent * indentLevel, + ' '); + + // Serialize properties + for(auto &propPair : properties) { + auto &propValues = propPair.second; + + if(propPair.first.compare("http://sbols.org/v2#identity") == 0) { + // This property is not serialized + continue; + } + + + if((propValues.size() == 1) && + (propValues.at(0) == "\"\"") || (propValues.at(0) == "<>")) + { + // No properties of this type + continue; + } + + auto predicate = doc->referenceNamespace(propPair.first); + + for(auto propValue : propValues) { + if(propValue[0] == '<') { + // URI + os << indentString + << "<" << predicate << " rdf:resource=\"" + << propValue.substr(1, propValue.size()-2) + << "\"/>" << std::endl; + + } else { + // Non-URI Literal + + // Some characters need to be escaped + std::string::size_type pos = 0; + while(true) { + const char *cStr = propValue.c_str(); + std::string::size_type len = propValue.size(); + bool done = true; + + for(; pos') + { + propValue = propValue.replace(pos, 1, ">"); + pos += 4; + done = false; + break; + } + + if(cStr[pos] == '&') + { + propValue = propValue.replace(pos, 1, "&"); + pos += 5; + done = false; + break; + } + } + + if(done) { + break; + } + } + + os << indentString + << "<" << predicate << ">" + << propValue.substr(1, propValue.size()-2) + << "" + << std::endl; + } + } + } + + std::string indentString2 = + std::string(spaces_per_indent * (indentLevel + 1), ' '); + + // Serialize owned objects + for(auto ownedPair : owned_objects) + { + if(ownedPair.second.size() == 0) { + continue; + } + + std::string predicate = doc->referenceNamespace(ownedPair.first); + + for(auto &i_obj : ownedPair.second) + { + auto typeURI = i_obj->getTypeURI(); + + if (std::find(hidden_properties.begin(), hidden_properties.end(), typeURI) + != hidden_properties.end()) { + continue; + } + + std::string rdfType = doc->referenceNamespace(typeURI); + std::string identity = i_obj->identity.get(); + + os << indentString << "<" << predicate + << ">" << std::endl; + + os << indentString2 + << "<" << rdfType << " rdf:about=\"" + << identity << "\">" << std::endl; + + i_obj->serialize_rdfxml(os, indentLevel + 2); + + os << indentString2 + << "" << std::endl; + + os << indentString + << "" << std::endl; + } + } +} diff --git a/source/object.h b/source/object.h index ac653ed0..a6b715a1 100644 --- a/source/object.h +++ b/source/object.h @@ -61,6 +61,7 @@ namespace sbol protected: /// @cond std::unordered_map namespaces; + std::string default_namespace; void serialize(raptor_serializer* sbol_serializer, raptor_world *sbol_world = NULL); // Convert an SBOL object into RDF triples std::string nest(std::string& rdfxml_buffer); // Pretty-writer that converts flat RDF/XML into nested RDF/XML (ie, SBOL) std::string makeQName(std::string uri); @@ -79,7 +80,7 @@ namespace sbol /// @cond Document *doc = NULL; rdf_type type; - SBOLObject* parent; + SBOLObject* parent = NULL; std::map > properties; std::map > owned_objects; @@ -104,6 +105,8 @@ namespace sbol /// @return A pointer to theobject with this URI if it exists, NULL otherwise SBOLObject* find(std::string uri); + void cacheObjects(std::map &objectCache); + /// Search this object recursively to see if it contains a member property with the given RDF type. /// @param uri The RDF type of the property to search for. /// @return A pointer to the object that contains a member property with the specified RDF type, NULL otherwise @@ -140,10 +143,14 @@ namespace sbol /// @return A vector of URIs that identify the properties contained in this object std::vector < std::string > getProperties(); - /// Set the value for a user-defined annotation property. - /// @val If the value is a URI, it should be surrounded by angle brackets, else it will be interpreted as a literal value + /// Set and overwrite the value for a user-defined annotation property. + /// @val Either a literal or URI value void setPropertyValue(std::string property_uri, std::string val); + /// Append a value to a user-defined annotation property. + /// @val Either a literal or URI value + void addPropertyValue(std::string property_uri, std::string val); + /// Set the value for a user-defined annotation property. Synonymous with setPropertyValue /// @val If the value is a URI, it should be surrounded by angle brackets, else it will be interpreted as a literal value void setAnnotation(std::string property_uri, std::string val); @@ -153,6 +160,8 @@ namespace sbol /// @return The value of the property or SBOL_ERROR_NOT_FOUND std::string getAnnotation(std::string property_uri); + void apply(void (*callback_fn)(SBOLObject *, void *), void * user_data); + void update_uri(); #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) @@ -163,6 +172,10 @@ namespace sbol PyObject* cast(PyObject* python_class); #endif + void serialize_rdfxml(std::ostream &os, size_t indentLevel); + + template < class SBOLClass > SBOLClass& cast(); + /// Use this method to destroy an SBOL object that is not contained by a parent Document. If the object does have a parent Document, instead use doc.close() with the object's URI identity as an argument. /// @TODO Recurse through child objects and delete them. virtual void close(); @@ -184,6 +197,36 @@ namespace sbol }; + template + SBOLClass& SBOLObject::cast() + { + SBOLClass& new_obj = *new SBOLClass(); + + // Set identity + new_obj.identity.set(this->identity.get()); + + // Copy properties + for (auto it = this->properties.begin(); it != this->properties.end(); it++) + { + new_obj.properties[it->first] = this->properties[it->first]; + } + for (auto it = this->owned_objects.begin(); it != this->owned_objects.end(); it++) + { + new_obj.owned_objects[it->first] = this->owned_objects[it->first]; + } + for (auto it = this->namespaces.begin(); it != this->namespaces.end(); it++) + { + new_obj.namespaces[it->first] = this->namespaces[it->first]; + } + for (auto it = this->hidden_properties.begin(); it != this->hidden_properties.end(); it++) + { + new_obj.hidden_properties.push_back(*it); + } + // new_obj->parent = this->parent; + // new_obj->doc = this->doc; + return new_obj; + } + /// @ingroup extension_layer /// @brief A reference to another SBOL object /// Contains a Uniform Resource Identifier (URI) that refers to an an associated object. The object it points to may be another resource in this Document or an external reference, for example to an object in an external repository or database. In the SBOL specification, association by reference is indicated in class diagrams by arrows with open (white) diamonds. @@ -361,7 +404,9 @@ namespace sbol /// @param sbol_obj A child object to add to this container property. /// Assigns a child object to this OwnedObject container property. This method always overwrites the first SBOLObject in the container. appends another object to those already contained in this OwnedObject property. In SBOLCompliant mode, the create method is preferred void set(SBOLClass& sbol_obj); - + + void set_notoplevelcheck(SBOLClass& sbol_obj); + /// @tparam SBOLClass The type of SBOL object contained in this OwnedObject property /// @param sbol_obj A child object to add to this container property. /// Adds a child object to the parent object. This method always appends another object to those already contained in this OwnedObject property. In SBOLCompliant mode, the create method is preferred @@ -566,6 +611,13 @@ namespace sbol if (obj->identity.get() == uri) return true; } + if (Config::getOption("sbol_compliant_uris") == "True") + if (this->sbol_owner->properties.find(SBOL_DISPLAY_ID) != this->sbol_owner->properties.end()) + for (auto & obj : this->sbol_owner->owned_objects[this->type]) + { + if (obj->properties[SBOL_DISPLAY_ID].front() == "\"" + uri + "\"") + return true; + } return false; }; diff --git a/source/participation.h b/source/participation.h index b97c9f80..4424c046 100644 --- a/source/participation.h +++ b/source/participation.h @@ -41,12 +41,12 @@ namespace sbol /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param participant A reference to the participating FunctionalComponent in the parent Interaction - Participation(std::string uri = "example", std::string participant = "", std::string version = "1.0.0") : Participation(SBOL_PARTICIPATION, uri, participant, version) {}; + Participation(std::string uri = "example", std::string participant = "", std::string version = VERSION_STRING) : Participation(SBOL_PARTICIPATION, uri, participant, version) {}; /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param species A ComponentDefinition that represents one of the participating species in the parent Interaction - Participation(std::string uri, ComponentDefinition& species, std::string version = "1.0.0") : + Participation(std::string uri, ComponentDefinition& species, std::string version = VERSION_STRING) : Participation(SBOL_PARTICIPATION, uri, "", version) { }; diff --git a/source/partshop.cpp b/source/partshop.cpp index 0469f822..e77ad61c 100644 --- a/source/partshop.cpp +++ b/source/partshop.cpp @@ -1,6 +1,17 @@ #include "partshop.h" #include +// For UNIX like implementation of getch (see login method) +// this may not be portable to windows, may need conio.h +#ifndef SBOL_WIN +#include +#include +#else +#include +#endif + +#include + using namespace std; using namespace sbol; @@ -17,27 +28,49 @@ void replace(string& text, string target, string replacement) }; // A utility function for encoding text into UTF8 for http requests -void encode_http(string& text) +void encode_url(string& text) { - string UTF8_AMPERSAND = "%26"; - string UTF8_EQUALS = "%3D"; - string UTF8_LESS_THAN = "%3C"; - string UTF8_GREATER_THAN = "%3E"; - string UTF8_COLON = "%3A"; - string UTF8_HASH = "%23"; - string UTF8_APOSTROPHE = "%27"; - string UTF8_SPACE = "%20"; - string UTF8_SLASH = "%2F"; - - replace(text, "&", UTF8_AMPERSAND); - replace(text, "=", UTF8_EQUALS); - replace(text, "<", UTF8_LESS_THAN); - replace(text, ">", UTF8_GREATER_THAN); - replace(text, ":", UTF8_COLON); - replace(text, "#", UTF8_HASH); - replace(text, "'", UTF8_APOSTROPHE); - replace(text, " ", UTF8_SPACE); - replace(text, "/", UTF8_SLASH); + // string UTF8_AMPERSAND = "%26"; + // string UTF8_EQUALS = "%3D"; + // string UTF8_LESS_THAN = "%3C"; + // string UTF8_GREATER_THAN = "%3E"; + // string UTF8_COLON = "%3A"; + // string UTF8_HASH = "%23"; + // string UTF8_APOSTROPHE = "%27"; + // string UTF8_SPACE = "%20"; + // string UTF8_SLASH = "%2F"; + // string UTF8_CURLYBRACE_OPEN = "%7B"; + // string UTF8_CURLYBRACE_CLOSED = "%7D"; + // string UTF8_SEMICOLON = "%3B"; + // string UTF8_DOT = "%2E"; + // string UTF8_QUOTE = "%22"; + // string UTF8_QUESTION_MARK = "%3F"; + // string UTF8_OPEN_PARENTHESES = "%28"; + // string UTF8_CLOSE_PARENTHESES = "%29"; + // string UTF8_LINEFEED = "%0A"; + // string UTF8_CARRIAGE_RETURN = "%0D"; + + // replace(text, "&", UTF8_AMPERSAND); + // replace(text, "=", UTF8_EQUALS); + // replace(text, "<", UTF8_LESS_THAN); + // replace(text, ">", UTF8_GREATER_THAN); + // replace(text, ":", UTF8_COLON); + // replace(text, "#", UTF8_HASH); + // replace(text, "'", UTF8_APOSTROPHE); + // replace(text, " ", UTF8_SPACE); + // replace(text, "/", UTF8_SLASH); + // replace(text, "{", UTF8_CURLYBRACE_OPEN); + // replace(text, "}", UTF8_CURLYBRACE_CLOSED); + // replace(text, ";", UTF8_SEMICOLON); + // replace(text, ".", UTF8_DOT); + // replace(text, "\"", UTF8_DOT); + // replace(text, "?", UTF8_DOT); + // replace(text, ".", UTF8_DOT); + // replace(text, "(", UTF8_DOT); + // replace(text, ")", UTF8_DOT); + CURL *curl; + char * encoded_text = curl_easy_escape(curl, text.c_str(), text.size()); + text = string(encoded_text); }; // Advanced search @@ -108,7 +141,7 @@ SearchResponse& sbol::PartShop::search(SearchQuery& q) else throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Invalid limit parameter specified"); - encode_http(parameters); + encode_url(parameters); parameters = url + "/remoteSearch/" + parameters; /* First set the URL that is about to receive our GET. */ @@ -191,7 +224,7 @@ SearchResponse& sbol::PartShop::search(std::string search_text, rdf_type object_ // Encode as a literal parameters += "'" + search_text + "'&"; - encode_http(parameters); + encode_url(parameters); // Specify how many records to retrieve parameters += "/?offset=" + to_string(offset) + "&limit=" + to_string(limit); @@ -211,7 +244,7 @@ SearchResponse& sbol::PartShop::search(std::string search_text, rdf_type object_ res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) - throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Attempt to validate online failed with " + string(curl_easy_strerror(res))); + throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Search failed with: " + string(curl_easy_strerror(res))); /* always cleanup */ curl_easy_cleanup(curl); @@ -242,6 +275,11 @@ SearchResponse& sbol::PartShop::search(std::string search_text, rdf_type object_ return search_response; }; +std::string sbol::PartShop::getKey() +{ + return key; +}; + // General search SearchResponse& sbol::PartShop::search(std::string search_text, rdf_type object_type, int offset, int limit) { @@ -270,7 +308,7 @@ SearchResponse& sbol::PartShop::search(std::string search_text, rdf_type object_ // Specify partial search text. Specify how many records to retrieve parameters = parameters + search_text; - encode_http(search_text); + encode_url(search_text); // Specify how many records to retrieve parameters += "/?offset=" + to_string(offset) + "&limit=" + to_string(limit); @@ -377,7 +415,7 @@ int sbol::PartShop::searchCount(SearchQuery& q) } } - encode_http(parameters); + encode_url(parameters); parameters = url + "/searchCount/" + parameters; /* First set the URL that is about to receive our GET. */ @@ -448,7 +486,7 @@ int sbol::PartShop::searchCount(std::string search_text, rdf_type object_type, s // Encode as a literal parameters += "'" + search_text + "'&"; - encode_http(parameters); + encode_url(parameters); parameters = parseURLDomain(url) + "/remoteSearch/" + parameters; @@ -512,7 +550,7 @@ int sbol::PartShop::searchCount(std::string search_text, rdf_type object_type) // Specify partial search text. Specify how many records to retrieve parameters = parameters + search_text; - encode_http(search_text); + encode_url(search_text); parameters = url + "/searchCount/" + parameters; @@ -550,13 +588,60 @@ int sbol::PartShop::searchCount(std::string search_text, rdf_type object_type) }; -void sbol::PartShop::login(std::string email, std::string password) +#ifndef SBOL_WIN +// Unix-like implementation of getch, might not be portable to Windows +/* reads from keypress, doesn't echo */ +int getch(void) { + struct termios oldattr, newattr; + int ch; + tcgetattr( STDIN_FILENO, &oldattr ); + newattr = oldattr; + newattr.c_lflag &= ~( ICANON | ECHO ); + tcsetattr( STDIN_FILENO, TCSANOW, &newattr ); + ch = getchar(); + tcsetattr( STDIN_FILENO, TCSANOW, &oldattr ); + return ch; +} +#endif + +void sbol::PartShop::login(std::string user_id, std::string password) +{ + this->user = user_id; + + if (password == "") + { + cout << "Password: "; + int ch; + while ((ch = getch())) + { + if (ch == 10 || ch == 13) + { + cout << endl; + break; + } + if (ch == 127 || ch == 8) + { + if (password.length() > 0) + { + cout << "\b \b"; + password.erase(password.length() - 1); + } + } + else + { + cout << "*"; + password += ch; + } + } + } + /* Perform HTTP request */ string response; CURL *curl; CURLcode res; - + long http_response_code = 0; + /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); @@ -576,7 +661,7 @@ void sbol::PartShop::login(std::string email, std::string password) curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); /* Now specify the POST data */ - string parameters = "email=" + email + "&" + "password=" + password; + string parameters = "email=" + user_id + "&" + "password=" + password; curl_easy_setopt(curl, CURLOPT_POSTFIELDS, parameters.c_str()); /* Now specify the callback to read the response into string */ @@ -587,25 +672,41 @@ void sbol::PartShop::login(std::string email, std::string password) res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) - throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Attempt to validate online failed with " + string(curl_easy_strerror(res))); - + throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Login failed due to an HTTP error: " + string(curl_easy_strerror(res))); + + curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_response_code); + + /* always cleanup */ curl_easy_cleanup(curl); } curl_slist_free_all(headers); curl_global_cleanup(); - if (response == "Your password was not recognized.") - std::cout << response << std::endl; - else - key = response; + if (http_response_code != 200) + throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Login failed due to a " + to_string(http_response_code) + " HTTP error: " + response); + + key = response; }; std::string sbol::PartShop::submit(Document& doc, std::string collection, int overwrite) { + if (collection == "" && (doc.displayId.size() == 0 || doc.name.size() == 0 || doc.description.size() == 0)) + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot submit Document. The Document must be assigned a displayId, name, and description for upload."); + int t_start; // For timing + int t_end; // For timing + if (Config::getOption("verbose") == "True") + t_start = getTime(); + + if (Config::getOption("serialization_format") == "rdfxml") + { + addSynBioHubAnnotations(doc); + } + /* Perform HTTP request */ string response; + long http_response_code = 0; CURL *curl; CURLcode res; @@ -653,6 +754,7 @@ std::string sbol::PartShop::submit(Document& doc, std::string collection, int ov curl_formadd(&post, &last, CURLFORM_COPYNAME, "overwrite_merge", CURLFORM_COPYCONTENTS, std::to_string(overwrite).c_str(), CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "user", CURLFORM_COPYCONTENTS, key.c_str(), CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "file", CURLFORM_COPYCONTENTS, doc.writeString().c_str(), CURLFORM_CONTENTTYPE, "text/xml", CURLFORM_END); + if (collection != "") curl_formadd(&post, &last, CURLFORM_COPYNAME, "rootCollections", CURLFORM_COPYCONTENTS, collection.c_str()); @@ -663,9 +765,18 @@ std::string sbol::PartShop::submit(Document& doc, std::string collection, int ov /* Now specify the callback to read the response into string */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); - + + if (Config::getOption("verbose") == "True") + { + t_end = getTime(); + cout << "Serialization took " << t_end - t_start << " seconds" << endl; + t_start = getTime(); + } /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); + + curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_response_code); + /* Check for errors */ if(res != CURLE_OK) throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "HTTP post request failed with: " + string(curl_easy_strerror(res))); @@ -676,9 +787,19 @@ std::string sbol::PartShop::submit(Document& doc, std::string collection, int ov curl_slist_free_all(headers); curl_global_cleanup(); - if (response.compare("Found. Redirecting to /login?next=%2Fsubmit") == 0) - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "You must login with valid credentials before submitting"); - return response; + if (Config::getOption("verbose") == "True") + { + cout << "Submission request returned HTTP response code " << http_response_code << endl; + t_end = getTime(); + cout << "Submission request took " << t_end - t_start << " seconds" << endl; + } + + if (http_response_code == 200) + return response; + else if (http_response_code == 401) + throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "You must login with valid credentials before submitting"); + else + throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "HTTP post request failed with: " + response); }; //std::string sbol::PartShop::submit(std::string filename, std::string collection, int overwrite) @@ -822,11 +943,14 @@ std::string PartShop::searchRootCollections() CURL *curl; CURLcode res; - /* In windows, this will init the winsock stuff */ - curl_global_init(CURL_GLOBAL_ALL); - struct curl_slist *headers = NULL; + headers = curl_slist_append(headers, "Accept: text/plain"); + headers = curl_slist_append(headers, string("X-authorization: " + key).c_str()); + + /* In windows, this will init the winsock stuff */ + curl_global_init(CURL_GLOBAL_ALL); + /* get a curl handle */ curl = curl_easy_init(); if(curl) { @@ -834,6 +958,7 @@ std::string PartShop::searchRootCollections() just as well be a https:// URL if that is what should receive the data. */ //curl_easy_setopt(curl, CURLOPT_URL, Config::getOption("validator_url").c_str()); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_URL, get_request.c_str()); // curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); @@ -867,11 +992,13 @@ std::string PartShop::searchSubCollections(std::string uri) CURL *curl; CURLcode res; + struct curl_slist *headers = NULL; + headers = curl_slist_append(headers, "Accept: text/plain"); + headers = curl_slist_append(headers, string("X-authorization: " + key).c_str()); + /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); - - struct curl_slist *headers = NULL; - + /* get a curl handle */ curl = curl_easy_init(); if(curl) { @@ -879,6 +1006,7 @@ std::string PartShop::searchSubCollections(std::string uri) just as well be a https:// URL if that is what should receive the data. */ //curl_easy_setopt(curl, CURLOPT_URL, Config::getOption("validator_url").c_str()); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_URL, get_request.c_str()); // curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); @@ -901,10 +1029,10 @@ std::string PartShop::searchSubCollections(std::string uri) }; -void PartShop::pull(std::vector uris, Document& doc) +void PartShop::pull(std::vector uris, Document& doc, bool recursive) { for (auto & uri : uris) - pull(uri, doc); + pull(uri, doc, recursive); } std::string http_get_request(std::string get_request, unordered_map* headers = NULL, unordered_map* response_headers = NULL) @@ -913,16 +1041,15 @@ std::string http_get_request(std::string get_request, unordered_map") != std::string::npos || response.find("not found") != std::string::npos) + std::string response; // holds the response returned from the http get request + unordered_map headers; + headers["X-authorization"] = key; + headers["Accept"] = "text/plain"; + + string query; + if (uri.find(resource) != std::string::npos) + query = uri; // User has specified full URI + else if (uri.find(parseURLDomain(resource)) != std::string::npos) + query = uri; // User has specified full URI + else if (uri.find(spoofed_resource) != std::string::npos) + query = uri.replace(uri.find(spoofed_resource), spoofed_resource.size(), resource); + else + query = resource + "/" + uri; // Assume user has only specified displayId + try { - // Reattempt, assuming user supplied a full URI for the requested part + string get_request = query + "/sbol"; + if (!recursive) + get_request += "nr"; if (Config::getOption("verbose") == "True") - std::cout << "Not found. Attempting to pull " << uri << std::endl; - get_request = uri + "/sbol"; - response = http_get_request(get_request); - if (response.find("") != std::string::npos || response.find("not found") != std::string::npos) + std::cout << "Issuing get request:\n" << get_request << std::endl; + response = http_get_request(get_request, &headers); + } + catch (SBOLError& e) + { + if (e.error_code() == SBOL_ERROR_NOT_FOUND) throw SBOLError(SBOL_ERROR_NOT_FOUND, "Part not found. Unable to pull " + uri); } + Document temp_doc = Document(); - temp_doc.readString(response); - temp_doc.copy(resource, &doc); + string serialization_format = Config::getOption("serialization_format"); + Config::setOption("serialization_format", "sbol"); + doc.readString(response); + Config::setOption("serialization_format", serialization_format); + doc.resource_namespaces.insert(resource); +}; + +void sbol::PartShop::spoof(std::string spoofed_url) +{ + spoofed_resource = spoofed_url; +}; + +std::string sbol::PartShop::sparqlQuery(std::string query) +{ + string endpoint = parseURLDomain(this->resource) + "/sparql?query="; + string resource; + if (spoofed_resource == "") + resource = this->resource; + else + resource = this->spoofed_resource; + + size_t p = query.find("WHERE"); + if (p != std::string::npos) + { + string from_clause = " FROM <" + parseURLDomain(resource) + "/user/" + user + "> "; + query = query.insert(p, from_clause); + } + encode_url(query); + query = endpoint + query; + + unordered_map headers; + unordered_map header_response; + headers["X-authorization"] = key; + headers["Accept"] = "application/json"; + + string response; + if (Config::getOption("verbose") == "True") + std::cout << "Issuing SPARQL:\n" << query << std::endl; + response = http_get_request(query, &headers); + + return response; +}; + +void sbol::PartShop::remove(string uri) +{ + if (spoofed_resource != "") + { + size_t p = uri.find(resource); + if (p != std::string::npos) + { + uri = uri.insert(p, spoofed_resource); + } + } + string endpoint = uri + "/remove"; + + unordered_map headers; + unordered_map header_response; + headers["X-authorization"] = key; + headers["Accept"] = "application/json"; + + http_get_request(endpoint, &headers); }; string PartShop::getURL() @@ -1007,6 +1218,7 @@ void PartShop::attachFile(std::string topleveluri, std::string filename) /* Perform HTTP request */ string response; + long http_response_code = 0; CURL *curl; CURLcode res; @@ -1046,16 +1258,21 @@ void PartShop::attachFile(std::string topleveluri, std::string filename) if(res != CURLE_OK) throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Attempt to upload attachment failed with " + string(curl_easy_strerror(res))); + curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_response_code); + /* always cleanup */ curl_easy_cleanup(curl); } curl_slist_free_all(headers); curl_global_cleanup(); - if (response.compare("Found. Redirecting to /login?next=%2Fsubmit") == 0) - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "You must login with valid credentials before submitting"); if (Config::getOption("verbose") == "True") std::cout << response << std::endl; + + if (http_response_code == 401) + throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "You must login with valid credentials before submitting"); + if (http_response_code != 200) + throw SBOLError(SBOL_ERROR_BAD_HTTP_REQUEST, "Attempt to attach file failed with HTTP " + to_string(http_response_code)); }; void PartShop::downloadAttachment(string attachment_uri, string path) @@ -1086,6 +1303,20 @@ void PartShop::downloadAttachment(string attachment_uri, string path) fclose(fh); } +void PartShop::addSynBioHubAnnotations(Document& doc) +{ + doc.addNamespace("http://wiki.synbiohub.org/wiki/Terms/synbiohub#", "sbh"); + for (auto & key_val_pair : doc.SBOLObjects) + { + SBOLObject* toplevel = key_val_pair.second; + toplevel->apply( [](SBOLObject* o, void * user_data) + { + SBOLObject* toplevel = (SBOLObject*)user_data; + URIProperty annotation = URIProperty(o, "http://wiki.synbiohub.org/wiki/Terms/synbiohub#topLevel", '0', '1', ValidationRules({}), toplevel->identity.get()); + }, (void*)toplevel); + } +} + void SearchResponse::extend(SearchResponse& response) { diff --git a/source/partshop.h b/source/partshop.h index 3ed27ccc..c1a3e721 100644 --- a/source/partshop.h +++ b/source/partshop.h @@ -87,7 +87,7 @@ namespace sbol std::vector < sbol::Identified* > records; /// Adds more search records to an existing SearchResponse - /// @param records A SearchResponse object + /// @param response A SearchResponse object void extend(SearchResponse& response); SearchResponse() : @@ -155,13 +155,17 @@ namespace sbol { private: std::string resource; + std::string spoofed_resource; std::string key; - + std::string user; + public: /// Construct an interface to an instance of SynBioHub or other parts repository /// @param The URL of the online repository - PartShop(std::string url) : - resource(url) + PartShop(std::string url, std::string spoofed_url = "") : + resource(url), + key(""), + spoofed_resource(spoofed_url) { }; @@ -169,16 +173,24 @@ namespace sbol /// @tparam SBOLClass The type of SBOL object, usually a ComponentDefinition template < class SBOLClass > int count(); + /// Issue a SPARQL query + std::string sparqlQuery(std::string query); + + /// Specify the URL of a resource that is simulated or spoofed by this PartShop + void spoof(std::string spoofed_url); + + void remove(std::string uri); + /// Retrieve an object from an online resource /// @param uri The identity of the SBOL object you want to retrieve /// @param doc A document to add the data to - void pull(std::string uri, Document& doc); + void pull(std::string uri, Document& doc, bool recursive = true); /// Retrieve an object from an online resource /// @param uris A vector of URIs for multiple SBOL objects you want to retrieve /// @param doc A document to add the data to - void pull(std::vector uris, Document& doc); - + void pull(std::vector uris, Document& doc, bool recursive = true ); + template < class SBOLClass > void pull(std::string uri, Document& doc, bool recursive = true); /// Returns all Collections that are not members of any other Collections @@ -240,12 +252,14 @@ namespace sbol /// In order to submit to a PartShop, you must login first. Register on [SynBioHub](http://synbiohub.org) to obtain account credentials. /// @param email The email associated with the user's SynBioHub account /// @param password The user's password - void login(std::string email, std::string password); + void login(std::string user_id, std::string password = ""); /// Returns the network address of the PartShop /// @return The URL of the online repository std::string getURL(); - + + std::string getKey(); + /// Upload and attach a file to a TopLevel object in a PartShop. /// @param top_level_uri The identity of the object to which the file will be attached /// @param file_name A path to the file attachment @@ -255,7 +269,9 @@ namespace sbol /// @param attachment_uri The full URI of the attached object /// @param path The target path to which the file will be downloaded void downloadAttachment(std::string attachment_uri, std::string path = "."); - + + // private: + void addSynBioHubAnnotations(Document& doc); }; // /// Returns a Document including all objects referenced from this object diff --git a/source/properties.cpp b/source/properties.cpp index e7c12456..4ed2f01b 100644 --- a/source/properties.cpp +++ b/source/properties.cpp @@ -29,9 +29,12 @@ #include #include -#include #include +#ifndef SBOL_BUILD_MANYLINUX +#include +#endif + using namespace sbol; using namespace std; @@ -157,6 +160,7 @@ double FloatProperty::get() void VersionProperty::incrementMinor() { +#ifndef SBOL_BUILD_MANYLINUX pair< vector, vector > v = this->split(); vector< string > v_tokens = v.first; vector< string > v_delimiters = v.second; @@ -194,10 +198,12 @@ void VersionProperty::incrementMinor() } parent_obj->identity.set(persistentIdentity + "/" + new_version); } +#endif }; void VersionProperty::incrementMajor() { +#ifndef SBOL_BUILD_MANYLINUX pair< vector, vector > v = this->split(); vector< string > v_tokens = v.first; vector< string > v_delimiters = v.second; @@ -241,10 +247,12 @@ void VersionProperty::incrementMajor() } parent_obj->identity.set(persistentIdentity + "/" + new_version); } +#endif }; void VersionProperty::incrementPatch() { +#ifndef SBOL_BUILD_MANYLINUX pair< vector, vector > v = this->split(); vector< string > v_tokens = v.first; vector< string > v_delimiters = v.second; @@ -281,6 +289,7 @@ void VersionProperty::incrementPatch() } parent_obj->identity.set(persistentIdentity + "/" + new_version); } +#endif }; void VersionProperty::decrementMinor() @@ -377,7 +386,8 @@ pair < vector, vector > VersionProperty::split() const string& s = this->get(); vector tokens; vector delimiters; - + +#ifndef SBOL_BUILD_MANYLINUX std::regex rgx("[-|.|\\\\|_]"); std::sregex_token_iterator i_token(s.begin(), s.end(), rgx, -1); std::sregex_token_iterator end; @@ -393,7 +403,7 @@ pair < vector, vector > VersionProperty::split() delimiters.push_back(*i_delimiter); ++i_delimiter; } - +#endif return make_pair(tokens, delimiters); } diff --git a/source/properties.cpp~ b/source/properties.cpp~ new file mode 100644 index 00000000..e7c99281 --- /dev/null +++ b/source/properties.cpp~ @@ -0,0 +1,472 @@ +/** + * @file properties.cpp + * @brief Property template classes (eg, TextProperty, URIProperty, IntProperty) + * @author Bryan Bartley + * @email bartleyba@sbolstandard.org + * + * */ + +#include "object.h" + +#include // std::invalid_argument + +#include +#include +#include + +#ifndef SBOL_BUILD_MANYLINUX +#include +#endif + +using namespace sbol; +using namespace std; + +/// @return A string literal +std::string TextProperty::get() +{ + if (this->sbol_owner) + { + // check if property a valid member of this object (mismatching of properties can result from improper template calls) + if (this->sbol_owner->properties.find(type) == this->sbol_owner->properties.end()) + { + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "This object does not have a property of type " + type); + } + else + { + // property value not set + if (this->sbol_owner->properties[type].size() == 0) + throw SBOLError(SBOL_ERROR_NOT_FOUND, "The " + type + " property has not been set"); + // property value is found + else + { + std::string value = this->sbol_owner->properties[type].front(); + value = value.substr(1, value.length() - 2); // Strips angle brackets from URIs and quotes from literals + if (value == "") + throw SBOLError(SBOL_ERROR_NOT_FOUND, "The " + type + " property has not been set"); + return value; + } + } + } else + { + throw SBOLError(SBOL_ERROR_ORPHAN_OBJECT, "Property " + type + " is not a member of a parent SBOLObject"); } +}; + +/// @return A string of characters used to identify a resource +std::string URIProperty::get() +{ + if (this->sbol_owner) + { + // check if property a valid member of this object (mismatching of properties can result from improper template calls) + if (this->sbol_owner->properties.find(type) == this->sbol_owner->properties.end()) + { + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "This object does not have a property of type " + type); + } + else + { + // property value not set + if (this->sbol_owner->properties[type].size() == 0) + throw SBOLError(SBOL_ERROR_NOT_FOUND, "Property has not been set"); + // property value is found + else + { + std::string value = this->sbol_owner->properties[type].front(); + value = value.substr(1, value.length() - 2); // Strips angle brackets from URIs and quotes from literals + if (value == "") + throw SBOLError(SBOL_ERROR_NOT_FOUND, "The " + type + " property has not been set"); + return value; + } + } + } else + { + throw SBOLError(SBOL_ERROR_ORPHAN_OBJECT, "Property " + type + " is not a member of a parent SBOLObject"); } +}; + +/// @return An integer +int IntProperty::get() +{ + if (this->sbol_owner) + { + // check if property a valid member of this object (mismatching of properties can result from improper template calls) + if (this->sbol_owner->properties.find(type) == this->sbol_owner->properties.end()) + { + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "This object does not have a property of type " + type); + } + else + { + // property value not set + if (this->sbol_owner->properties[type].size() == 0) + throw SBOLError(SBOL_ERROR_NOT_FOUND, "Property has not been set"); + // property value is found + else + { + std::string value = this->sbol_owner->properties[type].front(); + value = value.substr(1, value.length() - 2); // Strips angle brackets from URIs and quotes from literals + if (value == "") + throw SBOLError(SBOL_ERROR_NOT_FOUND, "The " + type + " property has not been set"); + return stoi(value); + } + } + } else + { + throw SBOLError(SBOL_ERROR_ORPHAN_OBJECT, "Property " + type + " is not a member of a parent SBOLObject"); } +}; + +/// @return An integer +double FloatProperty::get() +{ + if (this->sbol_owner) + { + // check if property a valid member of this object (mismatching of properties can result from improper template calls) + if (this->sbol_owner->properties.find(type) == this->sbol_owner->properties.end()) + { + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "This object does not have a property of type " + type); + } + else + { + // property value not set + if (this->sbol_owner->properties[type].size() == 0) + throw SBOLError(SBOL_ERROR_NOT_FOUND, "Property has not been set"); + // property value is found + else + { + std::string value = this->sbol_owner->properties[type].front(); + value = value.substr(1, value.length() - 2); // Strips angle brackets from URIs and quotes from literals + if (value == "") + throw SBOLError(SBOL_ERROR_NOT_FOUND, "The " + type + " property has not been set"); + return stod(value); + } + } + } else + { + throw SBOLError(SBOL_ERROR_ORPHAN_OBJECT, "Property " + type + " is not a member of a parent SBOLObject"); } +}; + +void VersionProperty::incrementMinor() +{ +#ifndef SBOL_BUILD_MANYLINUX + pair< vector, vector > v = this->split(); + vector< string > v_tokens = v.first; + vector< string > v_delimiters = v.second; + + if (v_tokens.size() < 2) + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Maven version string does not have a minor version"); + + // Increment minor version + regex d("([0-9]+)"); + smatch m; + regex_search(v_tokens[1], m, d); + string minor_version = to_string(stoi(v_tokens[1]) + 1) + m.suffix().str(); + v_tokens[1] = minor_version; + + // Concatenate new version string + string new_version; + unsigned int i_v = 0; + do + { + new_version += v_tokens[i_v] + v_delimiters[i_v]; + ++i_v; + } while (i_v < v_tokens.size() - 1); + new_version += v_tokens[i_v]; + this->set(new_version); + + /// Update the identity if SBOLCompliant + if (Config::getOption("sbol_compliant_uris").compare("True") == 0) + { + SBOLObject* parent_obj = this->sbol_owner; + std::string persistentIdentity; + if (parent_obj->properties.find(SBOL_PERSISTENT_IDENTITY) != parent_obj->properties.end()) + { + persistentIdentity = parent_obj->properties[SBOL_PERSISTENT_IDENTITY].front(); + persistentIdentity = persistentIdentity.substr(1, persistentIdentity.length() - 2); // Removes flanking < and > from the uri + } + parent_obj->identity.set(persistentIdentity + "/" + new_version); + } +#endif +}; + +void VersionProperty::incrementMajor() +{ +#ifndef SBOL_BUILD_MANYLINUX + pair< vector, vector > v = this->split(); + vector< string > v_tokens = v.first; + vector< string > v_delimiters = v.second; + + if (v_tokens.size() < 1) + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Maven version string does not have a valid major version"); + + // Increment major version + regex d("([0-9]+)"); + smatch m; + regex_search(v_tokens[0], m, d); + string major_version = to_string(stoi(v_tokens[0]) + 1) + m.suffix().str(); + v_tokens[0] = major_version; + + // Concatenate new version string + string new_version; + if (v_tokens.size() == 1) + new_version = v_tokens[0]; + else + { + // Insert delimiters + unsigned int i_v = 0; + do + { + new_version += v_tokens[i_v] + v_delimiters[i_v]; + ++i_v; + } while (i_v < v_tokens.size() - 1); + new_version += v_tokens[i_v]; + } + this->set(new_version); + + /// Update the identity if SBOLCompliant + if (Config::getOption("sbol_compliant_uris").compare("True") == 0) + { + SBOLObject* parent_obj = this->sbol_owner; + std::string persistentIdentity; + if (parent_obj->properties.find(SBOL_PERSISTENT_IDENTITY) != parent_obj->properties.end()) + { + persistentIdentity = parent_obj->properties[SBOL_PERSISTENT_IDENTITY].front(); + persistentIdentity = persistentIdentity.substr(1, persistentIdentity.length() - 2); // Removes flanking < and > from the uri + } + parent_obj->identity.set(persistentIdentity + "/" + new_version); + } +#endif +}; + +void VersionProperty::incrementPatch() +{ +#ifndef SBOL_BUILD_MANYLINUX + pair< vector, vector > v = this->split(); + vector< string > v_tokens = v.first; + vector< string > v_delimiters = v.second; + + // Increment patch version + if (v_tokens.size() < 3) + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Maven version string does not have a minor version"); + regex d("([0-9]+)"); + smatch m; + regex_search(v_tokens[2], m, d); + string patch_version = to_string(stoi(v_tokens[2]) + 1) + m.suffix().str(); + v_tokens[2] = patch_version; + + // Concatenate new version string + string new_version; + unsigned int i_v = 0; + do + { + new_version += v_tokens[i_v] + v_delimiters[i_v]; + ++i_v; + } while (i_v < v_tokens.size() - 1); + new_version += v_tokens[i_v]; + this->set(new_version); + + /// Update the identity if SBOLCompliant + if (Config::getOption("sbol_compliant_uris").compare("True") == 0) + { + SBOLObject* parent_obj = this->sbol_owner; + std::string persistentIdentity; + if (parent_obj->properties.find(SBOL_PERSISTENT_IDENTITY) != parent_obj->properties.end()) + { + persistentIdentity = parent_obj->properties[SBOL_PERSISTENT_IDENTITY].front(); + persistentIdentity = persistentIdentity.substr(1, persistentIdentity.length() - 2); // Removes flanking < and > from the uri + } + parent_obj->identity.set(persistentIdentity + "/" + new_version); + } +#endif +}; + +void VersionProperty::decrementMinor() +{ +}; + +void VersionProperty::decrementMajor() +{ +}; + +void VersionProperty::decrementPatch() +{ +}; + +/// @return The major version as an integer +/// Splits the version string by a delimiter and returns the major version number +int VersionProperty::major() +{ + pair< vector, vector > v = this->split(); + vector< string > v_tokens = v.first; + vector< string > v_delimiters = v.second; + int major_version = stoi(v_tokens[0]); + return major_version; +}; + +/// @return The minor version as an integer +/// Splits the version string by a delimiter and returns the minor version number +int VersionProperty::minor() +{ + pair< vector, vector > v = this->split(); + vector< string > v_tokens = v.first; + vector< string > v_delimiters = v.second; + + int minor_version; + try + { + // bitset constructor throws an invalid_argument if initialized + // with a string containing characters other than 0 and 1 + minor_version = stoi(v_tokens[1]); + } + catch (const std::invalid_argument& ia) + { + std::cerr << "Invalid minor version: " << ia.what() << "\nMinor version must begin with an int"; + } + return minor_version; +}; + +/// @return The patch version as an integer +/// Splits the version string by a delimiter and returns the patch version +int VersionProperty::patch() +{ + pair< vector, vector > v = this->split(); + vector< string > v_tokens = v.first; + vector< string > v_delimiters = v.second; + + int patch_version; + try + { + // bitset constructor throws an invalid_argument if initialized + // with a string containing characters other than 0 and 1 + patch_version = stoi(v_tokens[2]); + } + catch (const std::invalid_argument& ia) + { + std::cerr << "Invalid patch version: " << ia.what() << "\nPatch number must begin with an int"; + } + return patch_version; +}; + + +vector VersionProperty::split(const char c) +{ + // Adapted from C++ cookbook + const string& s = this->get(); + vector v; + + string::size_type i = 0; + string::size_type j = s.find(c); + + while (j != string::npos) + { + v.push_back(s.substr(i, j - i)); + i = ++j; + j = s.find(c, j); + if (j == string::npos) + v.push_back(s.substr(i, s.length())); + } + return v; +} + +pair < vector, vector > VersionProperty::split() +{ +#ifndef SBOL_BUILD_MANYLINUX + // Adapted from C++ cookbook + const string& s = this->get(); + vector tokens; + vector delimiters; + + std::regex rgx("[-|.|\\\\|_]"); + std::sregex_token_iterator i_token(s.begin(), s.end(), rgx, -1); + std::sregex_token_iterator end; + while (i_token != end) + { + tokens.push_back(*i_token); + ++i_token; + } + + std::sregex_token_iterator i_delimiter(s.begin(), s.end(), rgx); + while (i_delimiter != end) + { + delimiters.push_back(*i_delimiter); + ++i_delimiter; + } + + return make_pair(tokens, delimiters); +#endif +} + +string DateTimeProperty::stampTime() +{ + time_t curtime; + struct tm * GMT; + string stamp; + + time(&curtime); + GMT = gmtime(&curtime); + curtime = mktime(GMT); + stamp = string(ctime(&curtime)); + stamp.erase(stamp.length()-1, 1); + + // Split date string at delimiter (adapted from C++ cookbook) + const char delimiter = ' '; + vector tokens; + string::size_type i = 0; + string::size_type j = stamp.find(delimiter); + + while (j != string::npos) + { + tokens.push_back(stamp.substr(i, j - i)); + i = ++j; + j = stamp.find(delimiter, j); + if (j == string::npos) + tokens.push_back(stamp.substr(i, stamp.length())); + } + + // Format into DateTime XSD Schema + string month = tokens[1]; + string day = tokens[2]; + string t = tokens[3]; + string yr = tokens[4]; + + if (month.compare("Jan") == 0) + month = "01"; + else if(month.compare("Feb") == 0) + month = "02"; + else if(month.compare("Mar") == 0) + month = "03"; + else if(month.compare("Apr") == 0) + month = "04"; + else if(month.compare("May") == 0) + month = "05"; + else if(month.compare("Jun") == 0) + month = "06"; + else if(month.compare("Jul") == 0) + month = "07"; + else if(month.compare("Aug") == 0) + month = "08"; + else if(month.compare("Sep") == 0) + month = "09"; + else if(month.compare("Oct") == 0) + month = "10"; + else if(month.compare("Nov") == 0) + month = "11"; + else if(month.compare("Nov") == 0) + month = "12"; + return stamp; +} + + + diff --git a/source/properties.h b/source/properties.h index 7e9d7c43..9ee42aa2 100644 --- a/source/properties.h +++ b/source/properties.h @@ -416,6 +416,7 @@ namespace sbol VersionProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, std::string initial_value) : TextProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({}), initial_value) { +#ifndef SBOL_BUILD_MANYLINUX std::string v = this->get(); // @TODO move this error checking to validation rules to be run on VersionProperty::set() and VersionProperty()::VersionProperty() // sbol-10207 The version property of an Identified object is OPTIONAL and MAY contain a String that MUST be composed of only alphanumeric characters, underscores, hyphens, or periods and MUST begin with a digit. 20 Reference: Section 7.4 on page 16 21 @@ -426,7 +427,7 @@ namespace sbol if (!std::regex_match(v.begin(), v.end(), v_rgx)) throw SBOLError(SBOL_ERROR_NONCOMPLIANT_VERSION, "SBOL-compliant versions require a major, minor, and patch number in accordance with Maven versioning schemes. Use toggleSBOLCompliance() to relax these versioning requirements."); } - +#endif } }; @@ -456,4 +457,4 @@ namespace sbol } -#endif \ No newline at end of file +#endif diff --git a/source/properties.h~ b/source/properties.h~ new file mode 100644 index 00000000..7e9d7c43 --- /dev/null +++ b/source/properties.h~ @@ -0,0 +1,459 @@ +/** + * @file properties.h + * @brief Property template classes (eg, TextProperty, URIProperty, IntProperty) + * @author Bryan Bartley + * @email bartleyba@sbolstandard.org + * + * */ + +#ifndef PROPERTIES_INCLUDED +#define PROPERTIES_INCLUDED + +#include "property.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) +#include "Python.h" +#undef tolower // This macro is defined in pyport.h and causes a symbol conflict with another macro in regex standard library on OS X + +#endif + +namespace sbol +{ + class SBOLObject; + + /// @ingroup extension_layer + /// A URIProperty may contain a restricted type of string that conforms to the specification for a Uniform Resource Identifier (URI), typically consisting of a namespace authority followed by an identifier. A URIProperty often contains a reference to an SBOL object or may contain an ontology term. + class SBOL_DECLSPEC URIProperty : public Property + { + public: + /// Initialize the property with a value that is passed through a constructor for the parent SBOLObject. Validation rules are checked upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + URIProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules, std::string initial_value); + + /// Initialize a Property without a value. No validation rules are run upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + URIProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules); + + URIProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, char const* initial_value) : URIProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({}), std::string(initial_value)) {}; +// + URIProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound) : URIProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({})) {}; + + virtual std::string get(); ///< Get first URI. + + virtual std::vector getAll(); + + #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) + + std::string __getitem__(const int nIndex) + { + return this->operator[](nIndex); + } + + URIProperty* __iter__() + { + this->python_iter = URIProperty::iterator(this->begin()); + return this; + } + + // Built-in iterator function for Python 2 + std::string next() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + if (this->python_iter == this->end()) + { + PyErr_SetNone(PyExc_StopIteration); + } + return ref; + } + throw SBOLError(END_OF_LIST, ""); + return NULL; + } + + // Built-in iterator function for Python 3 + std::string __next__() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + + return ref; + } + throw SBOLError(END_OF_LIST, ""); + return NULL; + } + + int __len__() + { + return this->size(); + } + #endif + + }; + + /// @ingroup extension_layer + /// TextProperty objects are used to contain string literals. They can be used as member objects inside custom SBOL Extension classes. + class SBOL_DECLSPEC TextProperty : public Property + { + public: + /// Initialize the TextProperty with a value. Validation rules are checked upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + TextProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules, std::string initial_value); + + /// Initialize a TextProperty without a value. No validation rules are run upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + TextProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules); + + TextProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, char const* initial_value) : TextProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({}), std::string(initial_value)) {}; + + TextProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound) : TextProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({})) {}; + + virtual std::string get(); ///< Basic getter for all SBOL literal properties. + + virtual std::vector getAll(); + + #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) + std::string __getitem__(const int nIndex) + { + return this->operator[](nIndex); + } + + TextProperty* __iter__() + { + this->python_iter = TextProperty::iterator(this->begin()); + return this; + } + + // Built-in iterator function for Python 2 + std::string next() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + if (this->python_iter == this->end()) + { + PyErr_SetNone(PyExc_StopIteration); + } + return ref; + } + throw SBOLError(END_OF_LIST, ""); + return NULL; + } + + // Built-in iterator function for Python 3 + std::string __next__() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + + return ref; + } + throw SBOLError(END_OF_LIST, ""); + return NULL; + } + + int __len__() + { + return this->size(); + } + #endif + + }; + + /// @ingroup extension_layer + /// IntProperty objects are used to contain integers. They can be used as member objects inside custom SBOL Extension classes. + class SBOL_DECLSPEC IntProperty : public Property + { + public: + /// Initialize the IntProperty with a value. Validation rules are checked upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + IntProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules, int initial_value) : + Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules, initial_value) + { + } + + /// Initialize an IntProperty without a value. No validation rules are run upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + IntProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules) : + Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules) + { + } + + IntProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, int initial_value) : IntProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({}), initial_value) {}; + + IntProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound) : IntProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({})) {}; + + virtual int get(); ///< Get the integer value + + virtual std::vector getAll(); + + #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) + int __getitem__(const int nIndex) + { + return stoi(this->operator[](nIndex)); + } + + IntProperty* __iter__() + { + this->python_iter = IntProperty::iterator(this->begin()); + return this; + } + + // Built-in iterator function for Python 2 + int next() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + if (this->python_iter == this->end()) + { + PyErr_SetNone(PyExc_StopIteration); + } + return stoi(ref); + } + throw SBOLError(END_OF_LIST, ""); + } + + // Built-in iterator function for Python 3 + int __next__() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + + return stoi(ref); + } + throw SBOLError(END_OF_LIST, ""); + } + + int __len__() + { + return this->size(); + } + #endif + }; + + /// @ingroup extension_layer + /// FloatProperty objects are used to contain floats. They can be used as member objects inside custom SBOL Extension classes. + class SBOL_DECLSPEC FloatProperty : public Property + { + public: + /// Initialize the IntProperty with a value. Validation rules are checked upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + FloatProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules, double initial_value) : + Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules, initial_value) + { + }; + + /// Initialize a FloatProperty without a value. No validation rules are run upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + /// @param validation_rules A vector of pointers to the validation functions + FloatProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, ValidationRules validation_rules) : + Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules) + { + }; + + FloatProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, double initial_value) : FloatProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({}), initial_value) {}; + + FloatProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound) : FloatProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({})) {}; + + virtual double get(); ///< Get the float value. + + virtual std::vector getAll(); + + +#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) + double __getitem__(const int nIndex) + { + return stod(this->operator[](nIndex)); + } + + FloatProperty* __iter__() + { + this->python_iter = FloatProperty::iterator(this->begin()); + return this; + } + + // Built-in iterator function for Python 2 + double next() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + if (this->python_iter == this->end()) + { + PyErr_SetNone(PyExc_StopIteration); + } + return stod(ref); + } + throw SBOLError(END_OF_LIST, ""); + } + + // Built-in iterator function for Python 3 + double __next__() + { + if (size() == 0) + throw SBOLError(END_OF_LIST, ""); + if (this->python_iter != this->end()) + { + std::string ref = *this->python_iter; + this->python_iter++; + if (this->python_iter == this->end()) + { + PyErr_SetNone(PyExc_StopIteration); + } + return stod(ref); + } + throw SBOLError(END_OF_LIST, ""); + } + + int __len__() + { + return this->size(); + } +#endif + }; + + + /// @ingroup extension_layer + /// @brief Contains a version number for an SBOL object. + /// The VersionProperty follows Maven versioning semantics and includes a major, minor, and patch version number. + class SBOL_DECLSPEC VersionProperty : public TextProperty + { + private: + std::vector split(const char c); + public: + /// @cond + std::pair< std::vector, std::vector > split(); + /// @endcond + + void incrementMajor(); ///< Increment major version + void incrementMinor(); ///< Increment minor version + void incrementPatch(); ///< Increment patch version + void decrementMinor(); ///< Decrement major version + void decrementMajor(); ///< Decrement major version + void decrementPatch(); ///< Decrement major version + int major(); ///< Get major version + int minor(); ///< Get minor version + int patch(); ///< Get patch version + + /// Initialize the VersionProperty with a version string. If a version is specified, it will be checked to confirm it follows Maven versioning semantics. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + VersionProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, std::string initial_value) : + TextProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({}), initial_value) + { + std::string v = this->get(); + // @TODO move this error checking to validation rules to be run on VersionProperty::set() and VersionProperty()::VersionProperty() + // sbol-10207 The version property of an Identified object is OPTIONAL and MAY contain a String that MUST be composed of only alphanumeric characters, underscores, hyphens, or periods and MUST begin with a digit. 20 Reference: Section 7.4 on page 16 21 + // sbol-10208 The version property of an Identified object SHOULD follow the conventions of semantic 22 versioning as implemented by Maven. + if (Config::getOption("sbol_compliant_uris").compare("True") == 0) + { + std::regex v_rgx("[0-9]+[a-zA-Z0-9_\\\\.-]*"); + if (!std::regex_match(v.begin(), v.end(), v_rgx)) + throw SBOLError(SBOL_ERROR_NONCOMPLIANT_VERSION, "SBOL-compliant versions require a major, minor, and patch number in accordance with Maven versioning schemes. Use toggleSBOLCompliance() to relax these versioning requirements."); + } + + } + }; + + + /// @brief Contains a DateTime string following XML Schema + class SBOL_DECLSPEC DateTimeProperty : public TextProperty + { + public: + /// Initialize the DateTime. Conformance to XML DateTime schema is validated upon initialization. + /// @param type_uri An RDF type for the property which determines how the property is serialized in SBOL files + /// @param lower_bound A char flag (typically '0' or '1') indicating the minimum number of values allowed for this property + /// @param upper_bound A char flag (typically '1' or '*') indicating the maximum number of values allowed for this property + DateTimeProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound, std::string initial_value) : + TextProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({ libsbol_rule_2 }), initial_value) + { + } + + DateTimeProperty(void *property_owner, rdf_type type_uri, char lower_bound, char upper_bound) : + TextProperty(property_owner, type_uri, lower_bound, upper_bound, ValidationRules({ libsbol_rule_2 })) + { + } + + + /// Set this property with the current time + std::string stampTime(); + }; + +} + +#endif \ No newline at end of file diff --git a/source/property.h b/source/property.h index b4fc40cd..82d7b5c6 100644 --- a/source/property.h +++ b/source/property.h @@ -37,6 +37,7 @@ #include #include #include +#include #if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3) #include "Python.h" @@ -167,9 +168,24 @@ namespace sbol { pythonValidationRules.push_back(std::make_pair(validation_fx, property_object)); }; - -#endif + bool __contains__(std::string value) + { + if (this->find(value)) + return true; + else + return false; + } +#endif + + protected: + bool isHidden() + { + if (std::find(this->sbol_owner->hidden_properties.begin(), this->sbol_owner->hidden_properties.end(), this->type) != this->sbol_owner->hidden_properties.end()) + return true; + else + return false; + } }; template diff --git a/source/provo.h b/source/provo.h index cea94316..5975c665 100644 --- a/source/provo.h +++ b/source/provo.h @@ -34,7 +34,7 @@ namespace sbol public: /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. - Association(std::string uri = "example", std::string agent = "", std::string role = "", std::string version = "1.0.0") : Association(PROVO_ASSOCIATION, agent, role, uri, version) {}; + Association(std::string uri = "example", std::string agent = "", std::string role = "", std::string version = VERSION_STRING) : Association(PROVO_ASSOCIATION, agent, role, uri, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one @@ -54,6 +54,8 @@ namespace sbol /// The hadPlan property is OPTIONAL and contains a URI that refers to a Plan. ReferencedObject plan; + + virtual ~Association() {}; }; /// How different entities are used in an Activity is specified with the Usage class, which is linked from an Activity through the qualifiedUsage relationship. A Usage is then linked to an Entity through the Entity’s URI and the role of this entity is qualified with the hadRole property. When the wasDerivedFrom property is used together with the full provenance described here, the entity pointed at by the wasDerivedFrom property MUST be included in a Usage. @@ -62,7 +64,7 @@ namespace sbol public: /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. - Usage(std::string uri = "example", std::string entity = "", std::string role = "", std::string version = "1.0.0") : Usage(PROVO_USAGE, uri, entity, role, version) {}; + Usage(std::string uri = "example", std::string entity = "", std::string role = "", std::string version = VERSION_STRING) : Usage(PROVO_USAGE, uri, entity, role, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one @@ -78,6 +80,8 @@ namespace sbol /// The hadRole property is REQUIRED and MAY contain a URI that refers to a particular term describing the usage of an entity referenced by the entity property. URIProperty roles; + + virtual ~Usage() {}; }; /// Examples of agents are person, organisation or software. These agents should be annotated with additional information, such as software version, needed to be able to run the same software again. @@ -86,7 +90,7 @@ namespace sbol public: /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. - Agent(std::string uri = "example", std::string version = "1.0.0") : Agent(PROVO_AGENT, uri, version) {}; + Agent(std::string uri = "example", std::string version = VERSION_STRING) : Agent(PROVO_AGENT, uri, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one @@ -94,6 +98,8 @@ namespace sbol TopLevel(type, uri, version) { } + + virtual ~Agent(){}; }; /// Examples of agents are person, organisation or software. These agents should be annotated with additional information, such as software version, needed to be able to run the same software again. @@ -102,7 +108,7 @@ namespace sbol public: /// Constructor /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. - Plan(std::string uri = "example", std::string version = "1.0.0") : Plan(PROVO_PLAN, uri, version) {}; + Plan(std::string uri = "example", std::string version = VERSION_STRING) : Plan(PROVO_PLAN, uri, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one @@ -110,6 +116,8 @@ namespace sbol TopLevel(type, uri, version) { } + + virtual ~Plan(){}; }; /// A generated Entity is linked through a wasGeneratedBy relationship to an Activity, which is used to describe how different Agents and other entities were used. An Activity is linked through a qualifiedAssociation to Associations, to describe the role of agents, and is linked through qualifiedUsage to Usages to describe the role of other entities used as part of the activity. Moreover, each Activity includes optional startedAtTime and endedAtTime properties. When using Activity to capture how an entity was derived, it is expected that any additional information needed will be attached as annotations. This may include software settings or textual notes. Activities can also be linked together using the wasInformedBy relationship to provide dependency without explicitly specifying start and end times. @@ -117,19 +125,23 @@ namespace sbol { public: /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. - Activity(std::string uri = "example", std::string action_type = "", std::string version = "1.0.0") : Activity(PROVO_ACTIVITY, uri, action_type, version) {}; + Activity(std::string uri = "example", std::string action_type = "", std::string version = VERSION_STRING) : Activity(PROVO_ACTIVITY, uri, action_type, version) {}; /// Constructor used for defining extension classes /// @param rdf_type The RDF type for an extension class derived from this one Activity(rdf_type type, std::string uri, std::string action_type, std::string version) : TopLevel(type, uri, version), //type(SBOL_TYPES, this, action_type), + plan(this, PROVO_PLAN, '0', '1', ValidationRules({ libsbol_rule_24 })), + agent(this, PROVO_AGENT, '0', '1', ValidationRules({ libsbol_rule_22 })), startedAtTime(this, PROVO_STARTED_AT_TIME, '0', '1'), endedAtTime(this, PROVO_ENDED_AT_TIME, '0', '1'), wasInformedBy(this, PROVO_WAS_INFORMED_BY, PROVO_ACTIVITY, '0', '*', ValidationRules({})), usages(this, PROVO_QUALIFIED_USAGE, '0', '*', ValidationRules({})), associations(this, PROVO_QUALIFIED_ASSOCIATION, '0', '*', ValidationRules({})) { + hidden_properties.push_back(PROVO_PLAN); + hidden_properties.push_back(PROVO_AGENT); }; DateTimeProperty startedAtTime; @@ -145,6 +157,12 @@ namespace sbol /// The qualifiedUsage property is OPTIONAL and MAY contain a set of URIs that refers to Usage objects. OwnedObject usages; + + /// An Agent object may be specified here, and it will be synced with the Association::agent property + OwnedObject agent; + + /// A Plan object may be specified here, and it will be synced with the Association::plan property + OwnedObject plan; /// The type property is an ontology term that designates an activity or stage in the synthetic biology workflow, such as codon optimization or DNA assembly. //URIProperty type; diff --git a/source/raptor/CMakeLists.txt b/source/raptor/CMakeLists.txt index a2517237..6e20ef1d 100644 --- a/source/raptor/CMakeLists.txt +++ b/source/raptor/CMakeLists.txt @@ -79,7 +79,6 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Windows") ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # If Linux set(CMAKE_MODULE_PATH "${SBOL_SOURCE_DIR}/raptor") if(NOT SBOL_BUILD_SHARED) - # Workaround for issue with dependencies built without PIC support # Search for Raptor and JsonCpp as a static library message("Using precompiled dependencies") unset(JsonCpp_LIBRARY CACHE) @@ -88,22 +87,8 @@ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # If Linux unset(RAPTOR_INCLUDE_DIR CACHE) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a) add_definitions(-DRAPTOR_STATIC) - FIND_LIBRARY(RAPTOR_LIBRARY - NAME libraptor2.a - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/linux/raptor2/lib/ - NO_DEFAULT_PATH - ) - FIND_LIBRARY(JsonCpp_LIBRARY - NAME libjsoncpp.a - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/linux/jsoncpp/lib - NO_DEFAULT_PATH - ) - find_path(RAPTOR_INCLUDE_DIR raptor2.h - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/linux/raptor2/include/raptor2 - ) - find_path(JsonCpp_INCLUDE_DIR json - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/linux/jsoncpp/include - ) + find_package( RAPTOR ) + find_package( JsonCpp ) endif() if(SBOL_BUILD_SHARED) # Search for Raptor and JsonCpp as a dynamic dependency @@ -118,7 +103,7 @@ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # If Linux set(CMAKE_FIND_LIBRARY_SUFFIXES .dll .dylib .so) find_package( LibXslt ) find_package( CURL ) - + find_package( rasqal ) ELSE () # If Mac OSX set(CMAKE_MODULE_PATH "${SBOL_SOURCE_DIR}/raptor") @@ -140,6 +125,8 @@ ELSE () # If Mac OSX set(CMAKE_FIND_LIBRARY_SUFFIXES .dll .dylib .so) find_package( LibXslt ) find_package( CURL ) + find_package( rasqal ) + ENDIF () diff --git a/source/raptor/FindJsonCpp.cmake b/source/raptor/FindJsonCpp.cmake index 672fbc18..1b3dd485 100644 --- a/source/raptor/FindJsonCpp.cmake +++ b/source/raptor/FindJsonCpp.cmake @@ -27,8 +27,8 @@ endif() endif() find_library(JsonCpp_LIBRARY - NAMES jsoncpp - PATHS ~/.linuxbrew/lib # linuxbrew + NAMES jsoncpp jsoncpp_static + PATHS ~/.linuxbrew/lib DOC "Specify the JsonCpp library here") set(JsonCpp_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR}) set(JsonCpp_LIBRARIES "${JsonCpp_LIBRARY}") diff --git a/source/raptor/FindRASQAL.cmake b/source/raptor/FindRASQAL.cmake new file mode 100644 index 00000000..bfa49a1f --- /dev/null +++ b/source/raptor/FindRASQAL.cmake @@ -0,0 +1,119 @@ +# Copyright (C) 2012 - 2013 by Pedro Mendes, Virginia Tech Intellectual +# Properties, Inc., University of Heidelberg, and The University +# of Manchester. +# All rights reserved. + +# - Try to find the Rasqal RDF query library (http://librdf.org/rasqal) +# Once done this will define +# +# RASQAL_FOUND - system has Rasqal +# RASQAL_LIBRARIES - Link these to use Rasqal +# RASQAL_INCLUDE_DIR - Include directory for using Rasqal +# RASQAL_DEFINITIONS - Compiler switches required for using Rasqal +# + +# (c) 2007-2011 Sebastian Trueg +# (c) 2011 Artem Serebriyskiy +# (c) 2011 Michael Jansen +# +# Based on FindFontconfig Copyright (c) 2006,2007 Laurent Montel, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO (FIND_RASQAL) + +ENDMACRO () + +# Check if we have cached results in case the last round was successful. +if (NOT (RASQAL_INCLUDE_DIR AND RASQAL_LIBRARIES) OR NOT RASQAL_FOUND) + + set(RASQAL_LDFLAGS) + + find_path(RASQAL_INCLUDE_DIR rasqal.h + PATHS $ENV{RASQAL_DIR}/include + $ENV{RASQAL_DIR} + ~/Library/Frameworks + /Library/Frameworks + /sw/include # Fink + /opt/local/include/rasqal # MacPorts + /opt/csw/include # Blastwave + /opt/include + /usr/freeware/include + /usr/local/include/rasqal # Homebrew + $ENV{HOME}/.linuxbrew/include/rasqal # linuxbrew + $ENV{LINUXBREW}/include/rasqal + /home/linuxbrew/.linuxbrew/include/rasqal + /usr/include/rasqal + NO_DEFAULT_PATH) + + find_path(RASQAL_INCLUDE_DIR rasqal.h) + + if(SBOL_BUILD_SHARED) + if(RASQAL_LIBRARY MATCHES "(.*).(a|lib)") + unset(RASQAL_LIBRARY CACHE) + endif() + else() + if(RASQAL_LIBRARY MATCHES "(.*).(so|dylib|dll)") + unset(RASQAL_LIBRARY CACHE) + endif() + endif() + + find_library(RASQAL_LIBRARY + NAMES rasqal librasqal + PATHS $ENV{RASQAL_DIR}/lib + $ENV{RASQAL_DIR}/lib-dbg + $ENV{RASQAL_DIR} + ~/Library/Frameworks + /Library/Frameworks + /sw/lib # Fink + /opt/local/lib # MacPorts + /opt/csw/lib # Blastwave + /opt/lib + /usr/freeware/lib64 + /usr/local/lib # Homebrew + /usr/local/opt/rasqal/lib # Homebrew + ~/.linuxbrew/lib # linuxbrew + /usr/lib/i386-linux-gnu + /usr/lib/x86_64-linux-gnu + NO_DEFAULT_PATH) + + if (NOT RASQAL_LIBRARY) + find_library(RASQAL_LIBRARY NAMES rasqal librasqal) + endif () + ### Homebrew debugging output + #message("Found Rasqal at ${RASQAL_LIBRARY}") + #message("home: $ENV{LINUXBREW}") + #message("user: $ENV{USER}") + #file(GLOB_RECURSE include_files LIST_DIRECTORIES true $ENV{LINUXBREW}/include/*) + #message("${include_files}") + + if (NOT WIN32) + find_package(PkgConfig) + pkg_check_modules(PC_RASQAL QUIET rasqal) + + if (PC_RASQAL_FOUND) + set(RASQAL_DEFINITIONS ${PC_RASQAL_CFLAGS_OTHER}) + set(RASQAL_VERSION ${PC_RASQAL_VERSION} CACHE STRING "Rasqal Version found" ) + string( REGEX REPLACE "^.*-lrasqal;" "" RASQAL_LDFLAGS "${PC_RASQAL_STATIC_LDFLAGS}") + string( REGEX REPLACE "-lexpat[;]*" "" RASQAL_LDFLAGS "${RASQAL_LDFLAGS}") + endif (PC_RASQAL_FOUND) + endif (NOT WIN32) + + if (RASQAL_LDFLAGS) + set(RASQAL_LIBRARY ${RASQAL_LIBRARY} ${RASQAL_LDFLAGS}) + endif (RASQAL_LDFLAGS) + + mark_as_advanced(RASQAL_INCLUDE_DIR RASQAL_LIBRARY) + +endif () # Check for cached values + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args( + Rasqal + VERSION_VAR RASQAL_VERSION + REQUIRED_VARS RASQAL_LIBRARY RASQAL_INCLUDE_DIR) + +mark_as_advanced(RASQAL_VERSION) diff --git a/source/raptor/linux/jsoncpp/include/json/allocator.h b/source/raptor/linux/jsoncpp/include/json/allocator.h deleted file mode 100644 index 9c7e573a..00000000 --- a/source/raptor/linux/jsoncpp/include/json/allocator.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED -#define CPPTL_JSON_ALLOCATOR_H_INCLUDED - -#include -#include - -#pragma pack(push, 8) - -namespace Json { -template -class SecureAllocator { - public: - // Type definitions - using value_type = T; - using pointer = T*; - using const_pointer = const T*; - using reference = T&; - using const_reference = const T&; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - /** - * Allocate memory for N items using the standard allocator. - */ - pointer allocate(size_type n) { - // allocate using "global operator new" - return static_cast(::operator new(n * sizeof(T))); - } - - /** - * Release memory which was allocated for N items at pointer P. - * - * The memory block is filled with zeroes before being released. - * The pointer argument is tagged as "volatile" to prevent the - * compiler optimizing out this critical step. - */ - void deallocate(volatile pointer p, size_type n) { - std::memset(p, 0, n * sizeof(T)); - // free using "global operator delete" - ::operator delete(p); - } - - /** - * Construct an item in-place at pointer P. - */ - template - void construct(pointer p, Args&&... args) { - // construct using "placement new" and "perfect forwarding" - ::new (static_cast(p)) T(std::forward(args)...); - } - - size_type max_size() const { - return size_t(-1) / sizeof(T); - } - - pointer address( reference x ) const { - return std::addressof(x); - } - - const_pointer address( const_reference x ) const { - return std::addressof(x); - } - - /** - * Destroy an item in-place at pointer P. - */ - void destroy(pointer p) { - // destroy using "explicit destructor" - p->~T(); - } - - // Boilerplate - SecureAllocator() {} - template SecureAllocator(const SecureAllocator&) {} - template struct rebind { using other = SecureAllocator; }; -}; - - -template -bool operator==(const SecureAllocator&, const SecureAllocator&) { - return true; -} - -template -bool operator!=(const SecureAllocator&, const SecureAllocator&) { - return false; -} - -} //namespace Json - -#pragma pack(pop) - -#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/assertions.h b/source/raptor/linux/jsoncpp/include/json/assertions.h deleted file mode 100644 index 1cca28d9..00000000 --- a/source/raptor/linux/jsoncpp/include/json/assertions.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED -#define CPPTL_JSON_ASSERTIONS_H_INCLUDED - -#include -#include - -#if !defined(JSON_IS_AMALGAMATION) -#include "config.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -/** It should not be possible for a maliciously designed file to - * cause an abort() or seg-fault, so these macros are used only - * for pre-condition violations and internal logic errors. - */ -#if JSON_USE_EXCEPTION - -// @todo <= add detail about condition in exception -# define JSON_ASSERT(condition) \ - {if (!(condition)) {Json::throwLogicError( "assert json failed" );}} - -# define JSON_FAIL_MESSAGE(message) \ - { \ - JSONCPP_OSTRINGSTREAM oss; oss << message; \ - Json::throwLogicError(oss.str()); \ - abort(); \ - } - -#else // JSON_USE_EXCEPTION - -# define JSON_ASSERT(condition) assert(condition) - -// The call to assert() will show the failure message in debug builds. In -// release builds we abort, for a core-dump or debugger. -# define JSON_FAIL_MESSAGE(message) \ - { \ - JSONCPP_OSTRINGSTREAM oss; oss << message; \ - assert(false && oss.str().c_str()); \ - abort(); \ - } - - -#endif - -#define JSON_ASSERT_MESSAGE(condition, message) \ - if (!(condition)) { \ - JSON_FAIL_MESSAGE(message); \ - } - -#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/autolink.h b/source/raptor/linux/jsoncpp/include/json/autolink.h deleted file mode 100644 index b2c0f002..00000000 --- a/source/raptor/linux/jsoncpp/include/json/autolink.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_AUTOLINK_H_INCLUDED -#define JSON_AUTOLINK_H_INCLUDED - -#include "config.h" - -#ifdef JSON_IN_CPPTL -#include -#endif - -#if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \ - !defined(JSON_IN_CPPTL) -#define CPPTL_AUTOLINK_NAME "json" -#undef CPPTL_AUTOLINK_DLL -#ifdef JSON_DLL -#define CPPTL_AUTOLINK_DLL -#endif -#include "autolink.h" -#endif - -#endif // JSON_AUTOLINK_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/config.h b/source/raptor/linux/jsoncpp/include/json/config.h deleted file mode 100644 index c83e78a3..00000000 --- a/source/raptor/linux/jsoncpp/include/json/config.h +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_CONFIG_H_INCLUDED -#define JSON_CONFIG_H_INCLUDED -#include -#include //typedef String -#include //typedef int64_t, uint64_t - -/// If defined, indicates that json library is embedded in CppTL library. -//# define JSON_IN_CPPTL 1 - -/// If defined, indicates that json may leverage CppTL library -//# define JSON_USE_CPPTL 1 -/// If defined, indicates that cpptl vector based map should be used instead of -/// std::map -/// as Value container. -//# define JSON_USE_CPPTL_SMALLMAP 1 - -// If non-zero, the library uses exceptions to report bad input instead of C -// assertion macros. The default is to use exceptions. -#ifndef JSON_USE_EXCEPTION -#define JSON_USE_EXCEPTION 1 -#endif - -/// If defined, indicates that the source file is amalgated -/// to prevent private header inclusion. -/// Remarks: it is automatically defined in the generated amalgated header. -// #define JSON_IS_AMALGAMATION - -#ifdef JSON_IN_CPPTL -#include -#ifndef JSON_USE_CPPTL -#define JSON_USE_CPPTL 1 -#endif -#endif - -#ifdef JSON_IN_CPPTL -#define JSON_API CPPTL_API -#elif defined(JSON_DLL_BUILD) -#if defined(_MSC_VER) || defined(__MINGW32__) -#define JSON_API __declspec(dllexport) -#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING -#endif // if defined(_MSC_VER) -#elif defined(JSON_DLL) -#if defined(_MSC_VER) || defined(__MINGW32__) -#define JSON_API __declspec(dllimport) -#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING -#endif // if defined(_MSC_VER) -#endif // ifdef JSON_IN_CPPTL -#if !defined(JSON_API) -#define JSON_API -#endif - -// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for -// integer -// Storages, and 64 bits integer support is disabled. -// #define JSON_NO_INT64 1 - -#if defined(_MSC_VER) // MSVC -# if _MSC_VER <= 1200 // MSVC 6 - // Microsoft Visual Studio 6 only support conversion from __int64 to double - // (no conversion from unsigned __int64). -# define JSON_USE_INT64_DOUBLE_CONVERSION 1 - // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' - // characters in the debug information) - // All projects I've ever seen with VS6 were using this globally (not bothering - // with pragma push/pop). -# pragma warning(disable : 4786) -# endif // MSVC 6 - -# if _MSC_VER >= 1500 // MSVC 2008 - /// Indicates that the following function is deprecated. -# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) -# endif - -#endif // defined(_MSC_VER) - -// In c++11 the override keyword allows you to explicity define that a function -// is intended to override the base-class version. This makes the code more -// managable and fixes a set of common hard-to-find bugs. -#if __cplusplus >= 201103L -# define JSONCPP_OVERRIDE override -# define JSONCPP_NOEXCEPT noexcept -#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 -# define JSONCPP_OVERRIDE override -# define JSONCPP_NOEXCEPT throw() -#elif defined(_MSC_VER) && _MSC_VER >= 1900 -# define JSONCPP_OVERRIDE override -# define JSONCPP_NOEXCEPT noexcept -#else -# define JSONCPP_OVERRIDE -# define JSONCPP_NOEXCEPT throw() -#endif - -#ifndef JSON_HAS_RVALUE_REFERENCES - -#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 -#define JSON_HAS_RVALUE_REFERENCES 1 -#endif // MSVC >= 2010 - -#ifdef __clang__ -#if __has_feature(cxx_rvalue_references) -#define JSON_HAS_RVALUE_REFERENCES 1 -#endif // has_feature - -#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) -#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) -#define JSON_HAS_RVALUE_REFERENCES 1 -#endif // GXX_EXPERIMENTAL - -#endif // __clang__ || __GNUC__ - -#endif // not defined JSON_HAS_RVALUE_REFERENCES - -#ifndef JSON_HAS_RVALUE_REFERENCES -#define JSON_HAS_RVALUE_REFERENCES 0 -#endif - -#ifdef __clang__ -# if __has_extension(attribute_deprecated_with_message) -# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) -# endif -#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) -# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) -# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) -# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) -# endif // GNUC version -#endif // __clang__ || __GNUC__ - -#if !defined(JSONCPP_DEPRECATED) -#define JSONCPP_DEPRECATED(message) -#endif // if !defined(JSONCPP_DEPRECATED) - -#if __GNUC__ >= 6 -# define JSON_USE_INT64_DOUBLE_CONVERSION 1 -#endif - -#if !defined(JSON_IS_AMALGAMATION) - -# include "version.h" - -# if JSONCPP_USING_SECURE_MEMORY -# include "allocator.h" //typedef Allocator -# endif - -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { -typedef int Int; -typedef unsigned int UInt; -#if defined(JSON_NO_INT64) -typedef int LargestInt; -typedef unsigned int LargestUInt; -#undef JSON_HAS_INT64 -#else // if defined(JSON_NO_INT64) -// For Microsoft Visual use specific types as long long is not supported -#if defined(_MSC_VER) // Microsoft Visual Studio -typedef __int64 Int64; -typedef unsigned __int64 UInt64; -#else // if defined(_MSC_VER) // Other platforms, use long long -typedef int64_t Int64; -typedef uint64_t UInt64; -#endif // if defined(_MSC_VER) -typedef Int64 LargestInt; -typedef UInt64 LargestUInt; -#define JSON_HAS_INT64 -#endif // if defined(JSON_NO_INT64) -#if JSONCPP_USING_SECURE_MEMORY -#define JSONCPP_STRING std::basic_string, Json::SecureAllocator > -#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream, Json::SecureAllocator > -#define JSONCPP_OSTREAM std::basic_ostream> -#define JSONCPP_ISTRINGSTREAM std::basic_istringstream, Json::SecureAllocator > -#define JSONCPP_ISTREAM std::istream -#else -#define JSONCPP_STRING std::string -#define JSONCPP_OSTRINGSTREAM std::ostringstream -#define JSONCPP_OSTREAM std::ostream -#define JSONCPP_ISTRINGSTREAM std::istringstream -#define JSONCPP_ISTREAM std::istream -#endif // if JSONCPP_USING_SECURE_MEMORY -} // end namespace Json - -#endif // JSON_CONFIG_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/forwards.h b/source/raptor/linux/jsoncpp/include/json/forwards.h deleted file mode 100644 index 70bbe191..00000000 --- a/source/raptor/linux/jsoncpp/include/json/forwards.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_FORWARDS_H_INCLUDED -#define JSON_FORWARDS_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "config.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { - -// writer.h -class FastWriter; -class StyledWriter; - -// reader.h -class Reader; - -// features.h -class Features; - -// value.h -typedef unsigned int ArrayIndex; -class StaticString; -class Path; -class PathArgument; -class Value; -class ValueIteratorBase; -class ValueIterator; -class ValueConstIterator; - -} // namespace Json - -#endif // JSON_FORWARDS_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/json.h b/source/raptor/linux/jsoncpp/include/json/json.h deleted file mode 100644 index a6f99af0..00000000 --- a/source/raptor/linux/jsoncpp/include/json/json.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_JSON_H_INCLUDED -#define JSON_JSON_H_INCLUDED - -#include "autolink.h" -#include "value.h" -#include "reader.h" -#include "writer.h" -#include "json_features.h" - -#endif // JSON_JSON_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/json_features.h b/source/raptor/linux/jsoncpp/include/json/json_features.h deleted file mode 100644 index 72eb6a8a..00000000 --- a/source/raptor/linux/jsoncpp/include/json/json_features.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_FEATURES_H_INCLUDED -#define CPPTL_JSON_FEATURES_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "forwards.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -#pragma pack(push, 8) - -namespace Json { - -/** \brief Configuration passed to reader and writer. - * This configuration object can be used to force the Reader or Writer - * to behave in a standard conforming way. - */ -class JSON_API Features { -public: - /** \brief A configuration that allows all features and assumes all strings - * are UTF-8. - * - C & C++ comments are allowed - * - Root object can be any JSON value - * - Assumes Value strings are encoded in UTF-8 - */ - static Features all(); - - /** \brief A configuration that is strictly compatible with the JSON - * specification. - * - Comments are forbidden. - * - Root object must be either an array or an object value. - * - Assumes Value strings are encoded in UTF-8 - */ - static Features strictMode(); - - /** \brief Initialize the configuration like JsonConfig::allFeatures; - */ - Features(); - - /// \c true if comments are allowed. Default: \c true. - bool allowComments_; - - /// \c true if root must be either an array or an object value. Default: \c - /// false. - bool strictRoot_; - - /// \c true if dropped null placeholders are allowed. Default: \c false. - bool allowDroppedNullPlaceholders_; - - /// \c true if numeric object key are allowed. Default: \c false. - bool allowNumericKeys_; -}; - -} // namespace Json - -#pragma pack(pop) - -#endif // CPPTL_JSON_FEATURES_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/reader.h b/source/raptor/linux/jsoncpp/include/json/reader.h deleted file mode 100644 index 345793c3..00000000 --- a/source/raptor/linux/jsoncpp/include/json/reader.h +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_READER_H_INCLUDED -#define CPPTL_JSON_READER_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "json_features.h" -#include "value.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include - -// Disable warning C4251: : needs to have dll-interface to -// be used by... -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(push) -#pragma warning(disable : 4251) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#pragma pack(push, 8) - -namespace Json { - -/** \brief Unserialize a JSON document into a - *Value. - * - * \deprecated Use CharReader and CharReaderBuilder. - */ -class JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead") JSON_API Reader { -public: - typedef char Char; - typedef const Char* Location; - - /** \brief An error tagged with where in the JSON text it was encountered. - * - * The offsets give the [start, limit) range of bytes within the text. Note - * that this is bytes, not codepoints. - * - */ - struct StructuredError { - ptrdiff_t offset_start; - ptrdiff_t offset_limit; - JSONCPP_STRING message; - }; - - /** \brief Constructs a Reader allowing all features - * for parsing. - */ - Reader(); - - /** \brief Constructs a Reader allowing the specified feature set - * for parsing. - */ - Reader(const Features& features); - - /** \brief Read a Value from a JSON - * document. - * \param document UTF-8 encoded string containing the document to read. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param collectComments \c true to collect comment and allow writing them - * back during - * serialization, \c false to discard comments. - * This parameter is ignored if - * Features::allowComments_ - * is \c false. - * \return \c true if the document was successfully parsed, \c false if an - * error occurred. - */ - bool - parse(const std::string& document, Value& root, bool collectComments = true); - - /** \brief Read a Value from a JSON - document. - * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the - document to read. - * \param endDoc Pointer on the end of the UTF-8 encoded string of the - document to read. - * Must be >= beginDoc. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param collectComments \c true to collect comment and allow writing them - back during - * serialization, \c false to discard comments. - * This parameter is ignored if - Features::allowComments_ - * is \c false. - * \return \c true if the document was successfully parsed, \c false if an - error occurred. - */ - bool parse(const char* beginDoc, - const char* endDoc, - Value& root, - bool collectComments = true); - - /// \brief Parse from input stream. - /// \see Json::operator>>(std::istream&, Json::Value&). - bool parse(JSONCPP_ISTREAM& is, Value& root, bool collectComments = true); - - /** \brief Returns a user friendly string that list errors in the parsed - * document. - * \return Formatted error message with the list of errors with their location - * in - * the parsed document. An empty string is returned if no error - * occurred - * during parsing. - * \deprecated Use getFormattedErrorMessages() instead (typo fix). - */ - JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.") - JSONCPP_STRING getFormatedErrorMessages() const; - - /** \brief Returns a user friendly string that list errors in the parsed - * document. - * \return Formatted error message with the list of errors with their location - * in - * the parsed document. An empty string is returned if no error - * occurred - * during parsing. - */ - JSONCPP_STRING getFormattedErrorMessages() const; - - /** \brief Returns a vector of structured erros encounted while parsing. - * \return A (possibly empty) vector of StructuredError objects. Currently - * only one error can be returned, but the caller should tolerate - * multiple - * errors. This can occur if the parser recovers from a non-fatal - * parse error and then encounters additional errors. - */ - std::vector getStructuredErrors() const; - - /** \brief Add a semantic error message. - * \param value JSON Value location associated with the error - * \param message The error message. - * \return \c true if the error was successfully added, \c false if the - * Value offset exceeds the document size. - */ - bool pushError(const Value& value, const JSONCPP_STRING& message); - - /** \brief Add a semantic error message with extra context. - * \param value JSON Value location associated with the error - * \param message The error message. - * \param extra Additional JSON Value location to contextualize the error - * \return \c true if the error was successfully added, \c false if either - * Value offset exceeds the document size. - */ - bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra); - - /** \brief Return whether there are any errors. - * \return \c true if there are no errors to report \c false if - * errors have occurred. - */ - bool good() const; - -private: - enum TokenType { - tokenEndOfStream = 0, - tokenObjectBegin, - tokenObjectEnd, - tokenArrayBegin, - tokenArrayEnd, - tokenString, - tokenNumber, - tokenTrue, - tokenFalse, - tokenNull, - tokenArraySeparator, - tokenMemberSeparator, - tokenComment, - tokenError - }; - - class Token { - public: - TokenType type_; - Location start_; - Location end_; - }; - - class ErrorInfo { - public: - Token token_; - JSONCPP_STRING message_; - Location extra_; - }; - - typedef std::deque Errors; - - bool readToken(Token& token); - void skipSpaces(); - bool match(Location pattern, int patternLength); - bool readComment(); - bool readCStyleComment(); - bool readCppStyleComment(); - bool readString(); - void readNumber(); - bool readValue(); - bool readObject(Token& token); - bool readArray(Token& token); - bool decodeNumber(Token& token); - bool decodeNumber(Token& token, Value& decoded); - bool decodeString(Token& token); - bool decodeString(Token& token, JSONCPP_STRING& decoded); - bool decodeDouble(Token& token); - bool decodeDouble(Token& token, Value& decoded); - bool decodeUnicodeCodePoint(Token& token, - Location& current, - Location end, - unsigned int& unicode); - bool decodeUnicodeEscapeSequence(Token& token, - Location& current, - Location end, - unsigned int& unicode); - bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0); - bool recoverFromError(TokenType skipUntilToken); - bool addErrorAndRecover(const JSONCPP_STRING& message, - Token& token, - TokenType skipUntilToken); - void skipUntilSpace(); - Value& currentValue(); - Char getNextChar(); - void - getLocationLineAndColumn(Location location, int& line, int& column) const; - JSONCPP_STRING getLocationLineAndColumn(Location location) const; - void addComment(Location begin, Location end, CommentPlacement placement); - void skipCommentTokens(Token& token); - - static bool containsNewLine(Location begin, Location end); - static JSONCPP_STRING normalizeEOL(Location begin, Location end); - - typedef std::stack Nodes; - Nodes nodes_; - Errors errors_; - JSONCPP_STRING document_; - Location begin_; - Location end_; - Location current_; - Location lastValueEnd_; - Value* lastValue_; - JSONCPP_STRING commentsBefore_; - Features features_; - bool collectComments_; -}; // Reader - -/** Interface for reading JSON from a char array. - */ -class JSON_API CharReader { -public: - virtual ~CharReader() {} - /** \brief Read a Value from a JSON - document. - * The document must be a UTF-8 encoded string containing the document to read. - * - * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the - document to read. - * \param endDoc Pointer on the end of the UTF-8 encoded string of the - document to read. - * Must be >= beginDoc. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param errs [out] Formatted error messages (if not NULL) - * a user friendly string that lists errors in the parsed - * document. - * \return \c true if the document was successfully parsed, \c false if an - error occurred. - */ - virtual bool parse( - char const* beginDoc, char const* endDoc, - Value* root, JSONCPP_STRING* errs) = 0; - - class JSON_API Factory { - public: - virtual ~Factory() {} - /** \brief Allocate a CharReader via operator new(). - * \throw std::exception if something goes wrong (e.g. invalid settings) - */ - virtual CharReader* newCharReader() const = 0; - }; // Factory -}; // CharReader - -/** \brief Build a CharReader implementation. - -Usage: -\code - using namespace Json; - CharReaderBuilder builder; - builder["collectComments"] = false; - Value value; - JSONCPP_STRING errs; - bool ok = parseFromStream(builder, std::cin, &value, &errs); -\endcode -*/ -class JSON_API CharReaderBuilder : public CharReader::Factory { -public: - // Note: We use a Json::Value so that we can add data-members to this class - // without a major version bump. - /** Configuration of this builder. - These are case-sensitive. - Available settings (case-sensitive): - - `"collectComments": false or true` - - true to collect comment and allow writing them - back during serialization, false to discard comments. - This parameter is ignored if allowComments is false. - - `"allowComments": false or true` - - true if comments are allowed. - - `"strictRoot": false or true` - - true if root must be either an array or an object value - - `"allowDroppedNullPlaceholders": false or true` - - true if dropped null placeholders are allowed. (See StreamWriterBuilder.) - - `"allowNumericKeys": false or true` - - true if numeric object keys are allowed. - - `"allowSingleQuotes": false or true` - - true if '' are allowed for strings (both keys and values) - - `"stackLimit": integer` - - Exceeding stackLimit (recursive depth of `readValue()`) will - cause an exception. - - This is a security issue (seg-faults caused by deeply nested JSON), - so the default is low. - - `"failIfExtra": false or true` - - If true, `parse()` returns false when extra non-whitespace trails - the JSON value in the input string. - - `"rejectDupKeys": false or true` - - If true, `parse()` returns false when a key is duplicated within an object. - - `"allowSpecialFloats": false or true` - - If true, special float values (NaNs and infinities) are allowed - and their values are lossfree restorable. - - You can examine 'settings_` yourself - to see the defaults. You can also write and read them just like any - JSON Value. - \sa setDefaults() - */ - Json::Value settings_; - - CharReaderBuilder(); - ~CharReaderBuilder() JSONCPP_OVERRIDE; - - CharReader* newCharReader() const JSONCPP_OVERRIDE; - - /** \return true if 'settings' are legal and consistent; - * otherwise, indicate bad settings via 'invalid'. - */ - bool validate(Json::Value* invalid) const; - - /** A simple way to update a specific setting. - */ - Value& operator[](JSONCPP_STRING key); - - /** Called by ctor, but you can use this to reset settings_. - * \pre 'settings' != NULL (but Json::null is fine) - * \remark Defaults: - * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults - */ - static void setDefaults(Json::Value* settings); - /** Same as old Features::strictMode(). - * \pre 'settings' != NULL (but Json::null is fine) - * \remark Defaults: - * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode - */ - static void strictMode(Json::Value* settings); -}; - -/** Consume entire stream and use its begin/end. - * Someday we might have a real StreamReader, but for now this - * is convenient. - */ -bool JSON_API parseFromStream( - CharReader::Factory const&, - JSONCPP_ISTREAM&, - Value* root, std::string* errs); - -/** \brief Read from 'sin' into 'root'. - - Always keep comments from the input JSON. - - This can be used to read a file into a particular sub-object. - For example: - \code - Json::Value root; - cin >> root["dir"]["file"]; - cout << root; - \endcode - Result: - \verbatim - { - "dir": { - "file": { - // The input stream JSON would be nested here. - } - } - } - \endverbatim - \throw std::exception on parse error. - \see Json::operator<<() -*/ -JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&); - -} // namespace Json - -#pragma pack(pop) - -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(pop) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#endif // CPPTL_JSON_READER_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/value.h b/source/raptor/linux/jsoncpp/include/json/value.h deleted file mode 100644 index ebca175d..00000000 --- a/source/raptor/linux/jsoncpp/include/json/value.h +++ /dev/null @@ -1,887 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_H_INCLUDED -#define CPPTL_JSON_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "forwards.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include - -#ifndef JSON_USE_CPPTL_SMALLMAP -#include -#else -#include -#endif -#ifdef JSON_USE_CPPTL -#include -#endif - -//Conditional NORETURN attribute on the throw functions would: -// a) suppress false positives from static code analysis -// b) possibly improve optimization opportunities. -#if !defined(JSONCPP_NORETURN) -# if defined(_MSC_VER) -# define JSONCPP_NORETURN __declspec(noreturn) -# elif defined(__GNUC__) -# define JSONCPP_NORETURN __attribute__ ((__noreturn__)) -# else -# define JSONCPP_NORETURN -# endif -#endif - -// Disable warning C4251: : needs to have dll-interface to -// be used by... -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(push) -#pragma warning(disable : 4251) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#pragma pack(push, 8) - -/** \brief JSON (JavaScript Object Notation). - */ -namespace Json { - -/** Base class for all exceptions we throw. - * - * We use nothing but these internally. Of course, STL can throw others. - */ -class JSON_API Exception : public std::exception { -public: - Exception(JSONCPP_STRING const& msg); - ~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE; - char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE; -protected: - JSONCPP_STRING msg_; -}; - -/** Exceptions which the user cannot easily avoid. - * - * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input - * - * \remark derived from Json::Exception - */ -class JSON_API RuntimeError : public Exception { -public: - RuntimeError(JSONCPP_STRING const& msg); -}; - -/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. - * - * These are precondition-violations (user bugs) and internal errors (our bugs). - * - * \remark derived from Json::Exception - */ -class JSON_API LogicError : public Exception { -public: - LogicError(JSONCPP_STRING const& msg); -}; - -/// used internally -JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg); -/// used internally -JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg); - -/** \brief Type of the value held by a Value object. - */ -enum ValueType { - nullValue = 0, ///< 'null' value - intValue, ///< signed integer value - uintValue, ///< unsigned integer value - realValue, ///< double value - stringValue, ///< UTF-8 string value - booleanValue, ///< bool value - arrayValue, ///< array value (ordered list) - objectValue ///< object value (collection of name/value pairs). -}; - -enum CommentPlacement { - commentBefore = 0, ///< a comment placed on the line before a value - commentAfterOnSameLine, ///< a comment just after a value on the same line - commentAfter, ///< a comment on the line after a value (only make sense for - /// root value) - numberOfCommentPlacement -}; - -//# ifdef JSON_USE_CPPTL -// typedef CppTL::AnyEnumerator EnumMemberNames; -// typedef CppTL::AnyEnumerator EnumValues; -//# endif - -/** \brief Lightweight wrapper to tag static string. - * - * Value constructor and objectValue member assignement takes advantage of the - * StaticString and avoid the cost of string duplication when storing the - * string or the member name. - * - * Example of usage: - * \code - * Json::Value aValue( StaticString("some text") ); - * Json::Value object; - * static const StaticString code("code"); - * object[code] = 1234; - * \endcode - */ -class JSON_API StaticString { -public: - explicit StaticString(const char* czstring) : c_str_(czstring) {} - - operator const char*() const { return c_str_; } - - const char* c_str() const { return c_str_; } - -private: - const char* c_str_; -}; - -/** \brief Represents a JSON value. - * - * This class is a discriminated union wrapper that can represents a: - * - signed integer [range: Value::minInt - Value::maxInt] - * - unsigned integer (range: 0 - Value::maxUInt) - * - double - * - UTF-8 string - * - boolean - * - 'null' - * - an ordered list of Value - * - collection of name/value pairs (javascript object) - * - * The type of the held value is represented by a #ValueType and - * can be obtained using type(). - * - * Values of an #objectValue or #arrayValue can be accessed using operator[]() - * methods. - * Non-const methods will automatically create the a #nullValue element - * if it does not exist. - * The sequence of an #arrayValue will be automatically resized and initialized - * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. - * - * The get() methods can be used to obtain default value in the case the - * required element does not exist. - * - * It is possible to iterate over the list of a #objectValue values using - * the getMemberNames() method. - * - * \note #Value string-length fit in size_t, but keys must be < 2^30. - * (The reason is an implementation detail.) A #CharReader will raise an - * exception if a bound is exceeded to avoid security holes in your app, - * but the Value API does *not* check bounds. That is the responsibility - * of the caller. - */ -class JSON_API Value { - friend class ValueIteratorBase; -public: - typedef std::vector Members; - typedef ValueIterator iterator; - typedef ValueConstIterator const_iterator; - typedef Json::UInt UInt; - typedef Json::Int Int; -#if defined(JSON_HAS_INT64) - typedef Json::UInt64 UInt64; - typedef Json::Int64 Int64; -#endif // defined(JSON_HAS_INT64) - typedef Json::LargestInt LargestInt; - typedef Json::LargestUInt LargestUInt; - typedef Json::ArrayIndex ArrayIndex; - - static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value(). - static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null - static Value const& nullSingleton(); ///< Prefer this to null or nullRef. - - /// Minimum signed integer value that can be stored in a Json::Value. - static const LargestInt minLargestInt; - /// Maximum signed integer value that can be stored in a Json::Value. - static const LargestInt maxLargestInt; - /// Maximum unsigned integer value that can be stored in a Json::Value. - static const LargestUInt maxLargestUInt; - - /// Minimum signed int value that can be stored in a Json::Value. - static const Int minInt; - /// Maximum signed int value that can be stored in a Json::Value. - static const Int maxInt; - /// Maximum unsigned int value that can be stored in a Json::Value. - static const UInt maxUInt; - -#if defined(JSON_HAS_INT64) - /// Minimum signed 64 bits int value that can be stored in a Json::Value. - static const Int64 minInt64; - /// Maximum signed 64 bits int value that can be stored in a Json::Value. - static const Int64 maxInt64; - /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. - static const UInt64 maxUInt64; -#endif // defined(JSON_HAS_INT64) - -private: -#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - class CZString { - public: - enum DuplicationPolicy { - noDuplication = 0, - duplicate, - duplicateOnCopy - }; - CZString(ArrayIndex index); - CZString(char const* str, unsigned length, DuplicationPolicy allocate); - CZString(CZString const& other); -#if JSON_HAS_RVALUE_REFERENCES - CZString(CZString&& other); -#endif - ~CZString(); - CZString& operator=(const CZString& other); - -#if JSON_HAS_RVALUE_REFERENCES - CZString& operator=(CZString&& other); -#endif - - bool operator<(CZString const& other) const; - bool operator==(CZString const& other) const; - ArrayIndex index() const; - //const char* c_str() const; ///< \deprecated - char const* data() const; - unsigned length() const; - bool isStaticString() const; - - private: - void swap(CZString& other); - - struct StringStorage { - unsigned policy_: 2; - unsigned length_: 30; // 1GB max - }; - - char const* cstr_; // actually, a prefixed string, unless policy is noDup - union { - ArrayIndex index_; - StringStorage storage_; - }; - }; - -public: -#ifndef JSON_USE_CPPTL_SMALLMAP - typedef std::map ObjectValues; -#else - typedef CppTL::SmallMap ObjectValues; -#endif // ifndef JSON_USE_CPPTL_SMALLMAP -#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - -public: - /** \brief Create a default Value of the given type. - - This is a very useful constructor. - To create an empty array, pass arrayValue. - To create an empty object, pass objectValue. - Another Value can then be set to this one by assignment. -This is useful since clear() and resize() will not alter types. - - Examples: -\code -Json::Value null_value; // null -Json::Value arr_value(Json::arrayValue); // [] -Json::Value obj_value(Json::objectValue); // {} -\endcode - */ - Value(ValueType type = nullValue); - Value(Int value); - Value(UInt value); -#if defined(JSON_HAS_INT64) - Value(Int64 value); - Value(UInt64 value); -#endif // if defined(JSON_HAS_INT64) - Value(double value); - Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.) - Value(const char* begin, const char* end); ///< Copy all, incl zeroes. - /** \brief Constructs a value from a static string. - - * Like other value string constructor but do not duplicate the string for - * internal storage. The given string must remain alive after the call to this - * constructor. - * \note This works only for null-terminated strings. (We cannot change the - * size of this class, so we have nowhere to store the length, - * which might be computed later for various operations.) - * - * Example of usage: - * \code - * static StaticString foo("some text"); - * Json::Value aValue(foo); - * \endcode - */ - Value(const StaticString& value); - Value(const JSONCPP_STRING& value); ///< Copy data() til size(). Embedded zeroes too. -#ifdef JSON_USE_CPPTL - Value(const CppTL::ConstString& value); -#endif - Value(bool value); - /// Deep copy. - Value(const Value& other); -#if JSON_HAS_RVALUE_REFERENCES - /// Move constructor - Value(Value&& other); -#endif - ~Value(); - - /// Deep copy, then swap(other). - /// \note Over-write existing comments. To preserve comments, use #swapPayload(). - Value& operator=(Value other); - - /// Swap everything. - void swap(Value& other); - /// Swap values but leave comments and source offsets in place. - void swapPayload(Value& other); - - /// copy everything. - void copy(const Value& other); - /// copy values but leave comments and source offsets in place. - void copyPayload(const Value& other); - - ValueType type() const; - - /// Compare payload only, not comments etc. - bool operator<(const Value& other) const; - bool operator<=(const Value& other) const; - bool operator>=(const Value& other) const; - bool operator>(const Value& other) const; - bool operator==(const Value& other) const; - bool operator!=(const Value& other) const; - int compare(const Value& other) const; - - const char* asCString() const; ///< Embedded zeroes could cause you trouble! -#if JSONCPP_USING_SECURE_MEMORY - unsigned getCStringLength() const; //Allows you to understand the length of the CString -#endif - JSONCPP_STRING asString() const; ///< Embedded zeroes are possible. - /** Get raw char* of string-value. - * \return false if !string. (Seg-fault if str or end are NULL.) - */ - bool getString( - char const** begin, char const** end) const; -#ifdef JSON_USE_CPPTL - CppTL::ConstString asConstString() const; -#endif - Int asInt() const; - UInt asUInt() const; -#if defined(JSON_HAS_INT64) - Int64 asInt64() const; - UInt64 asUInt64() const; -#endif // if defined(JSON_HAS_INT64) - LargestInt asLargestInt() const; - LargestUInt asLargestUInt() const; - float asFloat() const; - double asDouble() const; - bool asBool() const; - - bool isNull() const; - bool isBool() const; - bool isInt() const; - bool isInt64() const; - bool isUInt() const; - bool isUInt64() const; - bool isIntegral() const; - bool isDouble() const; - bool isNumeric() const; - bool isString() const; - bool isArray() const; - bool isObject() const; - - bool isConvertibleTo(ValueType other) const; - - /// Number of values in array or object - ArrayIndex size() const; - - /// \brief Return true if empty array, empty object, or null; - /// otherwise, false. - bool empty() const; - - /// Return isNull() - bool operator!() const; - - /// Remove all object members and array elements. - /// \pre type() is arrayValue, objectValue, or nullValue - /// \post type() is unchanged - void clear(); - - /// Resize the array to size elements. - /// New elements are initialized to null. - /// May only be called on nullValue or arrayValue. - /// \pre type() is arrayValue or nullValue - /// \post type() is arrayValue - void resize(ArrayIndex size); - - /// Access an array element (zero based index ). - /// If the array contains less than index element, then null value are - /// inserted - /// in the array so that its size is index+1. - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - Value& operator[](ArrayIndex index); - - /// Access an array element (zero based index ). - /// If the array contains less than index element, then null value are - /// inserted - /// in the array so that its size is index+1. - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - Value& operator[](int index); - - /// Access an array element (zero based index ) - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - const Value& operator[](ArrayIndex index) const; - - /// Access an array element (zero based index ) - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - const Value& operator[](int index) const; - - /// If the array contains at least index+1 elements, returns the element - /// value, - /// otherwise returns defaultValue. - Value get(ArrayIndex index, const Value& defaultValue) const; - /// Return true if index < size(). - bool isValidIndex(ArrayIndex index) const; - /// \brief Append value to array at the end. - /// - /// Equivalent to jsonvalue[jsonvalue.size()] = value; - Value& append(const Value& value); - -#if JSON_HAS_RVALUE_REFERENCES - Value& append(Value&& value); -#endif - - /// Access an object value by name, create a null member if it does not exist. - /// \note Because of our implementation, keys are limited to 2^30 -1 chars. - /// Exceeding that will cause an exception. - Value& operator[](const char* key); - /// Access an object value by name, returns null if there is no member with - /// that name. - const Value& operator[](const char* key) const; - /// Access an object value by name, create a null member if it does not exist. - /// \param key may contain embedded nulls. - Value& operator[](const JSONCPP_STRING& key); - /// Access an object value by name, returns null if there is no member with - /// that name. - /// \param key may contain embedded nulls. - const Value& operator[](const JSONCPP_STRING& key) const; - /** \brief Access an object value by name, create a null member if it does not - exist. - - * If the object has no entry for that name, then the member name used to store - * the new entry is not duplicated. - * Example of use: - * \code - * Json::Value object; - * static const StaticString code("code"); - * object[code] = 1234; - * \endcode - */ - Value& operator[](const StaticString& key); -#ifdef JSON_USE_CPPTL - /// Access an object value by name, create a null member if it does not exist. - Value& operator[](const CppTL::ConstString& key); - /// Access an object value by name, returns null if there is no member with - /// that name. - const Value& operator[](const CppTL::ConstString& key) const; -#endif - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - Value get(const char* key, const Value& defaultValue) const; - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - /// \note key may contain embedded nulls. - Value get(const char* begin, const char* end, const Value& defaultValue) const; - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - /// \param key may contain embedded nulls. - Value get(const JSONCPP_STRING& key, const Value& defaultValue) const; -#ifdef JSON_USE_CPPTL - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - Value get(const CppTL::ConstString& key, const Value& defaultValue) const; -#endif - /// Most general and efficient version of isMember()const, get()const, - /// and operator[]const - /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30 - Value const* find(char const* begin, char const* end) const; - /// Most general and efficient version of object-mutators. - /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30 - /// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue. - Value const* demand(char const* begin, char const* end); - /// \brief Remove and return the named member. - /// - /// Do nothing if it did not exist. - /// \return the removed Value, or null. - /// \pre type() is objectValue or nullValue - /// \post type() is unchanged - /// \deprecated - JSONCPP_DEPRECATED("") - Value removeMember(const char* key); - /// Same as removeMember(const char*) - /// \param key may contain embedded nulls. - /// \deprecated - JSONCPP_DEPRECATED("") - Value removeMember(const JSONCPP_STRING& key); - /// Same as removeMember(const char* begin, const char* end, Value* removed), - /// but 'key' is null-terminated. - bool removeMember(const char* key, Value* removed); - /** \brief Remove the named map member. - - Update 'removed' iff removed. - \param key may contain embedded nulls. - \return true iff removed (no exceptions) - */ - bool removeMember(JSONCPP_STRING const& key, Value* removed); - /// Same as removeMember(JSONCPP_STRING const& key, Value* removed) - bool removeMember(const char* begin, const char* end, Value* removed); - /** \brief Remove the indexed array element. - - O(n) expensive operations. - Update 'removed' iff removed. - \return true iff removed (no exceptions) - */ - bool removeIndex(ArrayIndex i, Value* removed); - - /// Return true if the object has a member named key. - /// \note 'key' must be null-terminated. - bool isMember(const char* key) const; - /// Return true if the object has a member named key. - /// \param key may contain embedded nulls. - bool isMember(const JSONCPP_STRING& key) const; - /// Same as isMember(JSONCPP_STRING const& key)const - bool isMember(const char* begin, const char* end) const; -#ifdef JSON_USE_CPPTL - /// Return true if the object has a member named key. - bool isMember(const CppTL::ConstString& key) const; -#endif - - /// \brief Return a list of the member names. - /// - /// If null, return an empty list. - /// \pre type() is objectValue or nullValue - /// \post if type() was nullValue, it remains nullValue - Members getMemberNames() const; - - //# ifdef JSON_USE_CPPTL - // EnumMemberNames enumMemberNames() const; - // EnumValues enumValues() const; - //# endif - - /// \deprecated Always pass len. - JSONCPP_DEPRECATED("Use setComment(JSONCPP_STRING const&) instead.") - void setComment(const char* comment, CommentPlacement placement); - /// Comments must be //... or /* ... */ - void setComment(const char* comment, size_t len, CommentPlacement placement); - /// Comments must be //... or /* ... */ - void setComment(const JSONCPP_STRING& comment, CommentPlacement placement); - bool hasComment(CommentPlacement placement) const; - /// Include delimiters and embedded newlines. - JSONCPP_STRING getComment(CommentPlacement placement) const; - - JSONCPP_STRING toStyledString() const; - - const_iterator begin() const; - const_iterator end() const; - - iterator begin(); - iterator end(); - - // Accessors for the [start, limit) range of bytes within the JSON text from - // which this value was parsed, if any. - void setOffsetStart(ptrdiff_t start); - void setOffsetLimit(ptrdiff_t limit); - ptrdiff_t getOffsetStart() const; - ptrdiff_t getOffsetLimit() const; - -private: - void initBasic(ValueType type, bool allocated = false); - - Value& resolveReference(const char* key); - Value& resolveReference(const char* key, const char* end); - - struct CommentInfo { - CommentInfo(); - ~CommentInfo(); - - void setComment(const char* text, size_t len); - - char* comment_; - }; - - // struct MemberNamesTransform - //{ - // typedef const char *result_type; - // const char *operator()( const CZString &name ) const - // { - // return name.c_str(); - // } - //}; - - union ValueHolder { - LargestInt int_; - LargestUInt uint_; - double real_; - bool bool_; - char* string_; // actually ptr to unsigned, followed by str, unless !allocated_ - ObjectValues* map_; - } value_; - ValueType type_ : 8; - unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. - // If not allocated_, string_ must be null-terminated. - CommentInfo* comments_; - - // [start, limit) byte offsets in the source JSON text from which this Value - // was extracted. - ptrdiff_t start_; - ptrdiff_t limit_; -}; - -/** \brief Experimental and untested: represents an element of the "path" to - * access a node. - */ -class JSON_API PathArgument { -public: - friend class Path; - - PathArgument(); - PathArgument(ArrayIndex index); - PathArgument(const char* key); - PathArgument(const JSONCPP_STRING& key); - -private: - enum Kind { - kindNone = 0, - kindIndex, - kindKey - }; - JSONCPP_STRING key_; - ArrayIndex index_; - Kind kind_; -}; - -/** \brief Experimental and untested: represents a "path" to access a node. - * - * Syntax: - * - "." => root node - * - ".[n]" => elements at index 'n' of root node (an array value) - * - ".name" => member named 'name' of root node (an object value) - * - ".name1.name2.name3" - * - ".[0][1][2].name1[3]" - * - ".%" => member name is provided as parameter - * - ".[%]" => index is provied as parameter - */ -class JSON_API Path { -public: - Path(const JSONCPP_STRING& path, - const PathArgument& a1 = PathArgument(), - const PathArgument& a2 = PathArgument(), - const PathArgument& a3 = PathArgument(), - const PathArgument& a4 = PathArgument(), - const PathArgument& a5 = PathArgument()); - - const Value& resolve(const Value& root) const; - Value resolve(const Value& root, const Value& defaultValue) const; - /// Creates the "path" to access the specified node and returns a reference on - /// the node. - Value& make(Value& root) const; - -private: - typedef std::vector InArgs; - typedef std::vector Args; - - void makePath(const JSONCPP_STRING& path, const InArgs& in); - void addPathInArg(const JSONCPP_STRING& path, - const InArgs& in, - InArgs::const_iterator& itInArg, - PathArgument::Kind kind); - void invalidPath(const JSONCPP_STRING& path, int location); - - Args args_; -}; - -/** \brief base class for Value iterators. - * - */ -class JSON_API ValueIteratorBase { -public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef unsigned int size_t; - typedef int difference_type; - typedef ValueIteratorBase SelfType; - - bool operator==(const SelfType& other) const { return isEqual(other); } - - bool operator!=(const SelfType& other) const { return !isEqual(other); } - - difference_type operator-(const SelfType& other) const { - return other.computeDistance(*this); - } - - /// Return either the index or the member name of the referenced value as a - /// Value. - Value key() const; - - /// Return the index of the referenced Value, or -1 if it is not an arrayValue. - UInt index() const; - - /// Return the member name of the referenced Value, or "" if it is not an - /// objectValue. - /// \note Avoid `c_str()` on result, as embedded zeroes are possible. - JSONCPP_STRING name() const; - - /// Return the member name of the referenced Value. "" if it is not an - /// objectValue. - /// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls. - JSONCPP_DEPRECATED("Use `key = name();` instead.") - char const* memberName() const; - /// Return the member name of the referenced Value, or NULL if it is not an - /// objectValue. - /// \note Better version than memberName(). Allows embedded nulls. - char const* memberName(char const** end) const; - -protected: - Value& deref() const; - - void increment(); - - void decrement(); - - difference_type computeDistance(const SelfType& other) const; - - bool isEqual(const SelfType& other) const; - - void copy(const SelfType& other); - -private: - Value::ObjectValues::iterator current_; - // Indicates that iterator is for a null value. - bool isNull_; - -public: - // For some reason, BORLAND needs these at the end, rather - // than earlier. No idea why. - ValueIteratorBase(); - explicit ValueIteratorBase(const Value::ObjectValues::iterator& current); -}; - -/** \brief const iterator for object and array value. - * - */ -class JSON_API ValueConstIterator : public ValueIteratorBase { - friend class Value; - -public: - typedef const Value value_type; - //typedef unsigned int size_t; - //typedef int difference_type; - typedef const Value& reference; - typedef const Value* pointer; - typedef ValueConstIterator SelfType; - - ValueConstIterator(); - ValueConstIterator(ValueIterator const& other); - -private: -/*! \internal Use by Value to create an iterator. - */ - explicit ValueConstIterator(const Value::ObjectValues::iterator& current); -public: - SelfType& operator=(const ValueIteratorBase& other); - - SelfType operator++(int) { - SelfType temp(*this); - ++*this; - return temp; - } - - SelfType operator--(int) { - SelfType temp(*this); - --*this; - return temp; - } - - SelfType& operator--() { - decrement(); - return *this; - } - - SelfType& operator++() { - increment(); - return *this; - } - - reference operator*() const { return deref(); } - - pointer operator->() const { return &deref(); } -}; - -/** \brief Iterator for object and array value. - */ -class JSON_API ValueIterator : public ValueIteratorBase { - friend class Value; - -public: - typedef Value value_type; - typedef unsigned int size_t; - typedef int difference_type; - typedef Value& reference; - typedef Value* pointer; - typedef ValueIterator SelfType; - - ValueIterator(); - explicit ValueIterator(const ValueConstIterator& other); - ValueIterator(const ValueIterator& other); - -private: -/*! \internal Use by Value to create an iterator. - */ - explicit ValueIterator(const Value::ObjectValues::iterator& current); -public: - SelfType& operator=(const SelfType& other); - - SelfType operator++(int) { - SelfType temp(*this); - ++*this; - return temp; - } - - SelfType operator--(int) { - SelfType temp(*this); - --*this; - return temp; - } - - SelfType& operator--() { - decrement(); - return *this; - } - - SelfType& operator++() { - increment(); - return *this; - } - - reference operator*() const { return deref(); } - - pointer operator->() const { return &deref(); } -}; - -} // namespace Json - - -namespace std { -/// Specialize std::swap() for Json::Value. -template<> -inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); } -} - -#pragma pack(pop) - -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(pop) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#endif // CPPTL_JSON_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/version.h b/source/raptor/linux/jsoncpp/include/json/version.h deleted file mode 100644 index b1d2a5ff..00000000 --- a/source/raptor/linux/jsoncpp/include/json/version.h +++ /dev/null @@ -1,20 +0,0 @@ -// DO NOT EDIT. This file (and "version") is generated by CMake. -// Run CMake configure step to update it. -#ifndef JSON_VERSION_H_INCLUDED -# define JSON_VERSION_H_INCLUDED - -# define JSONCPP_VERSION_STRING "1.8.3" -# define JSONCPP_VERSION_MAJOR 1 -# define JSONCPP_VERSION_MINOR 8 -# define JSONCPP_VERSION_PATCH 3 -# define JSONCPP_VERSION_QUALIFIER -# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) - -#ifdef JSONCPP_USING_SECURE_MEMORY -#undef JSONCPP_USING_SECURE_MEMORY -#endif -#define JSONCPP_USING_SECURE_MEMORY 0 -// If non-zero, the library zeroes any memory that it has allocated before -// it frees its memory. - -#endif // JSON_VERSION_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/include/json/writer.h b/source/raptor/linux/jsoncpp/include/json/writer.h deleted file mode 100644 index f258cbfd..00000000 --- a/source/raptor/linux/jsoncpp/include/json/writer.h +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_WRITER_H_INCLUDED -#define JSON_WRITER_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "value.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include - -// Disable warning C4251: : needs to have dll-interface to -// be used by... -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(push) -#pragma warning(disable : 4251) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#pragma pack(push, 8) - -namespace Json { - -class Value; - -/** - -Usage: -\code - using namespace Json; - void writeToStdout(StreamWriter::Factory const& factory, Value const& value) { - std::unique_ptr const writer( - factory.newStreamWriter()); - writer->write(value, &std::cout); - std::cout << std::endl; // add lf and flush - } -\endcode -*/ -class JSON_API StreamWriter { -protected: - JSONCPP_OSTREAM* sout_; // not owned; will not delete -public: - StreamWriter(); - virtual ~StreamWriter(); - /** Write Value into document as configured in sub-class. - Do not take ownership of sout, but maintain a reference during function. - \pre sout != NULL - \return zero on success (For now, we always return zero, so check the stream instead.) - \throw std::exception possibly, depending on configuration - */ - virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0; - - /** \brief A simple abstract factory. - */ - class JSON_API Factory { - public: - virtual ~Factory(); - /** \brief Allocate a CharReader via operator new(). - * \throw std::exception if something goes wrong (e.g. invalid settings) - */ - virtual StreamWriter* newStreamWriter() const = 0; - }; // Factory -}; // StreamWriter - -/** \brief Write into stringstream, then return string, for convenience. - * A StreamWriter will be created from the factory, used, and then deleted. - */ -JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const& factory, Value const& root); - - -/** \brief Build a StreamWriter implementation. - -Usage: -\code - using namespace Json; - Value value = ...; - StreamWriterBuilder builder; - builder["commentStyle"] = "None"; - builder["indentation"] = " "; // or whatever you like - std::unique_ptr writer( - builder.newStreamWriter()); - writer->write(value, &std::cout); - std::cout << std::endl; // add lf and flush -\endcode -*/ -class JSON_API StreamWriterBuilder : public StreamWriter::Factory { -public: - // Note: We use a Json::Value so that we can add data-members to this class - // without a major version bump. - /** Configuration of this builder. - Available settings (case-sensitive): - - "commentStyle": "None" or "All" - - "indentation": "" - - "enableYAMLCompatibility": false or true - - slightly change the whitespace around colons - - "dropNullPlaceholders": false or true - - Drop the "null" string from the writer's output for nullValues. - Strictly speaking, this is not valid JSON. But when the output is being - fed to a browser's Javascript, it makes for smaller output and the - browser can handle the output just fine. - - "useSpecialFloats": false or true - - If true, outputs non-finite floating point values in the following way: - NaN values as "NaN", positive infinity as "Infinity", and negative infinity - as "-Infinity". - - You can examine 'settings_` yourself - to see the defaults. You can also write and read them just like any - JSON Value. - \sa setDefaults() - */ - Json::Value settings_; - - StreamWriterBuilder(); - ~StreamWriterBuilder() JSONCPP_OVERRIDE; - - /** - * \throw std::exception if something goes wrong (e.g. invalid settings) - */ - StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE; - - /** \return true if 'settings' are legal and consistent; - * otherwise, indicate bad settings via 'invalid'. - */ - bool validate(Json::Value* invalid) const; - /** A simple way to update a specific setting. - */ - Value& operator[](JSONCPP_STRING key); - - /** Called by ctor, but you can use this to reset settings_. - * \pre 'settings' != NULL (but Json::null is fine) - * \remark Defaults: - * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults - */ - static void setDefaults(Json::Value* settings); -}; - -/** \brief Abstract class for writers. - * \deprecated Use StreamWriter. (And really, this is an implementation detail.) - */ -class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer { -public: - virtual ~Writer(); - - virtual JSONCPP_STRING write(const Value& root) = 0; -}; - -/** \brief Outputs a Value in JSON format - *without formatting (not human friendly). - * - * The JSON document is written in a single line. It is not intended for 'human' - *consumption, - * but may be usefull to support feature such as RPC where bandwith is limited. - * \sa Reader, Value - * \deprecated Use StreamWriterBuilder. - */ -class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter : public Writer { - -public: - FastWriter(); - ~FastWriter() JSONCPP_OVERRIDE {} - - void enableYAMLCompatibility(); - - /** \brief Drop the "null" string from the writer's output for nullValues. - * Strictly speaking, this is not valid JSON. But when the output is being - * fed to a browser's Javascript, it makes for smaller output and the - * browser can handle the output just fine. - */ - void dropNullPlaceholders(); - - void omitEndingLineFeed(); - -public: // overridden from Writer - JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE; - -private: - void writeValue(const Value& value); - - JSONCPP_STRING document_; - bool yamlCompatiblityEnabled_; - bool dropNullPlaceholders_; - bool omitEndingLineFeed_; -}; - -/** \brief Writes a Value in JSON format in a - *human friendly way. - * - * The rules for line break and indent are as follow: - * - Object value: - * - if empty then print {} without indent and line break - * - if not empty the print '{', line break & indent, print one value per - *line - * and then unindent and line break and print '}'. - * - Array value: - * - if empty then print [] without indent and line break - * - if the array contains no object value, empty array or some other value - *types, - * and all the values fit on one lines, then print the array on a single - *line. - * - otherwise, it the values do not fit on one line, or the array contains - * object or non empty array, then print one value per line. - * - * If the Value have comments then they are outputed according to their - *#CommentPlacement. - * - * \sa Reader, Value, Value::setComment() - * \deprecated Use StreamWriterBuilder. - */ -class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledWriter : public Writer { -public: - StyledWriter(); - ~StyledWriter() JSONCPP_OVERRIDE {} - -public: // overridden from Writer - /** \brief Serialize a Value in JSON format. - * \param root Value to serialize. - * \return String containing the JSON document that represents the root value. - */ - JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE; - -private: - void writeValue(const Value& value); - void writeArrayValue(const Value& value); - bool isMultineArray(const Value& value); - void pushValue(const JSONCPP_STRING& value); - void writeIndent(); - void writeWithIndent(const JSONCPP_STRING& value); - void indent(); - void unindent(); - void writeCommentBeforeValue(const Value& root); - void writeCommentAfterValueOnSameLine(const Value& root); - bool hasCommentForValue(const Value& value); - static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text); - - typedef std::vector ChildValues; - - ChildValues childValues_; - JSONCPP_STRING document_; - JSONCPP_STRING indentString_; - unsigned int rightMargin_; - unsigned int indentSize_; - bool addChildValues_; -}; - -/** \brief Writes a Value in JSON format in a - human friendly way, - to a stream rather than to a string. - * - * The rules for line break and indent are as follow: - * - Object value: - * - if empty then print {} without indent and line break - * - if not empty the print '{', line break & indent, print one value per - line - * and then unindent and line break and print '}'. - * - Array value: - * - if empty then print [] without indent and line break - * - if the array contains no object value, empty array or some other value - types, - * and all the values fit on one lines, then print the array on a single - line. - * - otherwise, it the values do not fit on one line, or the array contains - * object or non empty array, then print one value per line. - * - * If the Value have comments then they are outputed according to their - #CommentPlacement. - * - * \sa Reader, Value, Value::setComment() - * \deprecated Use StreamWriterBuilder. - */ -class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledStreamWriter { -public: -/** - * \param indentation Each level will be indented by this amount extra. - */ - StyledStreamWriter(JSONCPP_STRING indentation = "\t"); - ~StyledStreamWriter() {} - -public: - /** \brief Serialize a Value in JSON format. - * \param out Stream to write to. (Can be ostringstream, e.g.) - * \param root Value to serialize. - * \note There is no point in deriving from Writer, since write() should not - * return a value. - */ - void write(JSONCPP_OSTREAM& out, const Value& root); - -private: - void writeValue(const Value& value); - void writeArrayValue(const Value& value); - bool isMultineArray(const Value& value); - void pushValue(const JSONCPP_STRING& value); - void writeIndent(); - void writeWithIndent(const JSONCPP_STRING& value); - void indent(); - void unindent(); - void writeCommentBeforeValue(const Value& root); - void writeCommentAfterValueOnSameLine(const Value& root); - bool hasCommentForValue(const Value& value); - static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text); - - typedef std::vector ChildValues; - - ChildValues childValues_; - JSONCPP_OSTREAM* document_; - JSONCPP_STRING indentString_; - unsigned int rightMargin_; - JSONCPP_STRING indentation_; - bool addChildValues_ : 1; - bool indented_ : 1; -}; - -#if defined(JSON_HAS_INT64) -JSONCPP_STRING JSON_API valueToString(Int value); -JSONCPP_STRING JSON_API valueToString(UInt value); -#endif // if defined(JSON_HAS_INT64) -JSONCPP_STRING JSON_API valueToString(LargestInt value); -JSONCPP_STRING JSON_API valueToString(LargestUInt value); -JSONCPP_STRING JSON_API valueToString(double value); -JSONCPP_STRING JSON_API valueToString(bool value); -JSONCPP_STRING JSON_API valueToQuotedString(const char* value); - -/// \brief Output using the StyledStreamWriter. -/// \see Json::operator>>() -JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root); - -} // namespace Json - -#pragma pack(pop) - -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(pop) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#endif // JSON_WRITER_H_INCLUDED diff --git a/source/raptor/linux/jsoncpp/lib/libjsoncpp.a b/source/raptor/linux/jsoncpp/lib/libjsoncpp.a deleted file mode 100644 index dc9580fb..00000000 Binary files a/source/raptor/linux/jsoncpp/lib/libjsoncpp.a and /dev/null differ diff --git a/source/raptor/linux/raptor2/include/raptor2/raptor.h b/source/raptor/linux/raptor2/include/raptor2/raptor.h deleted file mode 100644 index 91d361ed..00000000 --- a/source/raptor/linux/raptor2/include/raptor2/raptor.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/source/raptor/linux/raptor2/include/raptor2/raptor2.h b/source/raptor/linux/raptor2/include/raptor2/raptor2.h deleted file mode 100644 index 87b40981..00000000 --- a/source/raptor/linux/raptor2/include/raptor2/raptor2.h +++ /dev/null @@ -1,2186 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 2 -*- - * - * raptor.h - Redland Parser Toolkit for RDF (Raptor) - public API - * - * Copyright (C) 2000-2013, David Beckett http://www.dajobe.org/ - * Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac.uk/ - * - * This package is Free Software and part of Redland http://librdf.org/ - * - * It is licensed under the following three licenses as alternatives: - * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version - * 2. GNU General Public License (GPL) V2 or any newer version - * 3. Apache License, V2.0 or any newer version - * - * You may not use this file except in compliance with at least one of - * the above three licenses. - * - * See LICENSE.html or LICENSE.txt at the top of this package for the - * complete terms and further detail along with the license texts for - * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. - * - * - */ - - - -#ifndef RAPTOR_H -#define RAPTOR_H - - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* Required for va_list in raptor_vsnprintf */ -#include - - -/** - * RAPTOR_V2_AVAILABLE - * - * Flag for marking raptor2 API availability. - */ -#define RAPTOR_V2_AVAILABLE 1 - - -/** - * RAPTOR_VERSION: - * - * Raptor library version number - * - * Format: major * 10000 + minor * 100 + release - */ -#define RAPTOR_VERSION 20015 - -/** - * RAPTOR_VERSION_STRING: - * - * Raptor library version string - */ -#define RAPTOR_VERSION_STRING "2.0.15" - -/** - * RAPTOR_VERSION_MAJOR: - * - * Raptor library major version - */ -#define RAPTOR_VERSION_MAJOR 2 - -/** - * RAPTOR_VERSION_MINOR: - * - * Raptor library minor version - */ -#define RAPTOR_VERSION_MINOR 0 - -/** - * RAPTOR_VERSION_RELEASE: - * - * Raptor library release - */ -#define RAPTOR_VERSION_RELEASE 15 - -/** - * RAPTOR_API: - * - * Macro for wrapping API function call declarations. - * - */ -#ifndef RAPTOR_API -# ifdef WIN32 -# ifdef __GNUC__ -# undef _declspec -# define _declspec(x) __declspec(x) -# endif -# ifdef RAPTOR_STATIC -# define RAPTOR_API -# else -# ifdef RAPTOR_INTERNAL -# define RAPTOR_API _declspec(dllexport) -# else -# define RAPTOR_API _declspec(dllimport) -# endif -# endif -# else -# define RAPTOR_API -# endif -#endif - -/* Use gcc 3.1+ feature to allow marking of deprecated API calls. - * This gives a warning during compiling. - */ -#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -#define RAPTOR_DEPRECATED __attribute__((deprecated)) -#define RAPTOR_NORETURN __attribute__((__noreturn__)) -#else -#define RAPTOR_DEPRECATED -#define RAPTOR_NORETURN -#endif - -/** - * RAPTOR_PRINTF_FORMAT: - * @string_index: ignore me - * @first_to_check_index: ignore me - * - * Internal macro - */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) -#define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index) \ - __attribute__((__format__(__printf__, string_index, first_to_check_index))) -#else -#define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index) -#endif - -/** - * raptor_uri: - * - * Raptor URI Class. - */ -typedef struct raptor_uri_s raptor_uri; - - -/* Public statics */ - -/** - * raptor_short_copyright_string: - * - * Short copyright string (one line). - */ -RAPTOR_API -extern const char * const raptor_short_copyright_string; - -/** - * raptor_copyright_string: - * - * Copyright string (multiple lines). - */ -RAPTOR_API -extern const char * const raptor_copyright_string; - -/** - * raptor_version_string: - * - * Raptor version as a string. - */ -RAPTOR_API -extern const char * const raptor_version_string; - -/** - * raptor_version_major: - * - * Raptor major version number. - */ -RAPTOR_API -extern const unsigned int raptor_version_major; - -/** - * raptor_version_minor: - * - * Raptor minor version number. - */ -RAPTOR_API -extern const unsigned int raptor_version_minor; - -/** - * raptor_version_release: - * - * Raptor release version number. - */ -RAPTOR_API -extern const unsigned int raptor_version_release; - -/** - * raptor_version_decimal: - * - * Raptor version as a decimal number. - * - * Format: major * 10000 + minor * 100 + release - */ -RAPTOR_API -extern const unsigned int raptor_version_decimal; - -/** - * raptor_license_string: - * - * Raptor license string. - */ -RAPTOR_API -extern const char * const raptor_license_string; - -/** - * raptor_home_url_string: - * - * Raptor home page URL. - */ -RAPTOR_API -extern const char * const raptor_home_url_string; - -/** - * raptor_xml_namespace_uri: - * - * XML Namespace (xml:) URI string. - */ -RAPTOR_API -extern const unsigned char * const raptor_xml_namespace_uri; - - -/** - * raptor_rdf_namespace_uri: - * - * RDF Namespace (rdf:) URI string. - */ -RAPTOR_API -extern const unsigned char * const raptor_rdf_namespace_uri; - -/** - * raptor_rdf_namespace_uri_len: - * - * Length of #raptor_rdf_namespace_uri string - */ -RAPTOR_API -extern const unsigned int raptor_rdf_namespace_uri_len; - -/** - * raptor_rdf_schema_namespace_uri: - * - * RDF Schema (rdfs:) Namespace URI string. - */ -RAPTOR_API -extern const unsigned char * const raptor_rdf_schema_namespace_uri; - -/** - * raptor_xmlschema_datatypes_namespace_uri: - * - * XML Schema datatypes (xsd:) namespace URI string. - */ -RAPTOR_API -extern const unsigned char * const raptor_xmlschema_datatypes_namespace_uri; - -/** - * raptor_owl_namespace_uri: - * - * OWL (owl:) Namespace URI string. - */ -RAPTOR_API -extern const unsigned char * const raptor_owl_namespace_uri; - -/** - * raptor_xml_literal_datatype_uri_string: - * - * XML Literal datatype (rdf:XMLLiteral) URI string. - */ -RAPTOR_API -extern const unsigned char * const raptor_xml_literal_datatype_uri_string; - -/** - * raptor_xml_literal_datatype_uri_string_len: - * - * Length of #raptor_xml_literal_datatype_uri_string - */ -RAPTOR_API -extern const unsigned int raptor_xml_literal_datatype_uri_string_len; - - -/* Public structure */ -/** - * raptor_world: - * - * Raptor world class. - */ -typedef struct raptor_world_s raptor_world; -/** - * raptor_parser: - * - * Raptor Parser class - */ -typedef struct raptor_parser_s raptor_parser; -/** - * raptor_serializer: - * - * Raptor Serializer class - */ -typedef struct raptor_serializer_s raptor_serializer; - -/** - * raptor_www: - * - * Raptor WWW class - */ -typedef struct raptor_www_s raptor_www; -/** - * raptor_iostream: - * - * Raptor I/O Stream class - */ -typedef struct raptor_iostream_s raptor_iostream; -/** - * raptor_xml_element: - * - * Raptor XML Element class - */ -typedef struct raptor_xml_element_s raptor_xml_element; -/** - * raptor_xml_writer: - * - * Raptor XML Writer class - */ -typedef struct raptor_xml_writer_s raptor_xml_writer; -/** - * raptor_qname: - * - * Raptor XML qname class - */ -typedef struct raptor_qname_s raptor_qname; -/** - * raptor_namespace: - * - * Raptor XML Namespace class - */ -typedef struct raptor_namespace_s raptor_namespace; -/** - * raptor_namespace_stack: - * - * Raptor XML Namespace Stack class - */ -typedef struct raptor_namespace_stack_s raptor_namespace_stack; - -/** - * raptor_sax2: - * - * Raptor SAX2 class - */ -typedef struct raptor_sax2_s raptor_sax2; - - -/** - * raptor_type_q: - * @mime_type: MIME type string - * @mime_type_len: length of @mime_type - * @q: Q value 0-10 standing for decimal 0.0-1.0 - * - * (MIME Type, Q) pair - */ -typedef struct { - const char* mime_type; - size_t mime_type_len; - unsigned char q; -} raptor_type_q; - - -/** - * raptor_syntax_bitflags: - * @RAPTOR_SYNTAX_NEED_BASE_URI: the syntax requires a base URI - * - * Bit flags for #raptor_syntax_description flags field - */ -typedef enum { - RAPTOR_SYNTAX_NEED_BASE_URI = 1 -} raptor_syntax_bitflags; - - -/** - * raptor_syntax_description: - * @names: array of syntax names - the first one (required) is the public name, the rest are aliases. The array is NULL terminated. - * @names_count: size of @names array - * @label: long descriptive label for syntax - * @mime_types: Array of (MIME type, Q) values associated with the syntax (or NULL). If present the array is NULL terminated. - * @mime_types_count: size of @mime_types array - * @uri_strings: array of URIs identifying the syntax (or NULL). The first one if present is the main URI, the rest are aliases. The array is NULL terminated. - * @uri_strings_count: size of @uri_strings array - * @flags: See #raptor_syntax_bitflags for the bits - * - * Description of a syntax or file format. - * - */ -typedef struct { - const char* const* names; - unsigned int names_count; - - const char* label; - - const raptor_type_q* mime_types; - unsigned int mime_types_count; - - const char* const* uri_strings; - unsigned int uri_strings_count; - - unsigned int flags; -} raptor_syntax_description; - - -/** - * raptor_term_type: - * @RAPTOR_TERM_TYPE_URI: RDF URI - * @RAPTOR_TERM_TYPE_LITERAL: RDF literal - * @RAPTOR_TERM_TYPE_BLANK: RDF blank node - * @RAPTOR_TERM_TYPE_UNKNOWN: Internal - * - * Type of term in a #raptor_statement - * - * Node type 3 is unused but exists to preserve numeric compatibility - * with librdf_node_type values. - */ -typedef enum { - RAPTOR_TERM_TYPE_UNKNOWN = 0, - RAPTOR_TERM_TYPE_URI = 1, - RAPTOR_TERM_TYPE_LITERAL = 2, - /* unused type 3 */ - RAPTOR_TERM_TYPE_BLANK = 4 -} raptor_term_type; - - -/** - * raptor_locator: - * @uri: URI of location (or NULL) - * @file: Filename of location (or NULL) - * @line: Line number of location (or <0 for no line) - * @column: Column number of location (or <0 for no column) - * @byte: Byte number of location (or <0 for no byte) - * - * Location information for an error, warning or information message. - */ -typedef struct { - raptor_uri *uri; - const char *file; - int line; - int column; - int byte; -} raptor_locator; - -/** - * raptor_option: - * @RAPTOR_OPTION_SCANNING: If true (default false), the RDF/XML - * parser will look for embedded rdf:RDF elements inside the XML - * content, and not require that the XML start with an rdf:RDF root - * element. - * @RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES: If true (default true) - * then the RDF/XML parser will allow non-XML namespaced attributes - * to be accepted as well as rdf: namespaced ones. For example, - * 'about' and 'ID' will be interpreted as if they were rdf:about - * and rdf:ID respectively. - * @RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES: If true (default true) - * then the RDF/XML parser will allow unknown parsetypes to be - * present and will pass them on to the user. Unimplemented at - * present. - * @RAPTOR_OPTION_ALLOW_BAGID: If true (default true) then the - * RDF/XML parser will support the rdf:bagID attribute that was - * removed from the RDF/XML language when it was revised. This - * support may be removed in future. - * @RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST: If true (default false) - * then the RDF/XML parser will generate the idList rdf:type - * rdf:List triple in the handling of rdf:parseType="Collection". - * This triple was removed during the revising of RDF/XML after - * collections were initially added. - * @RAPTOR_OPTION_NORMALIZE_LANGUAGE: If true (default true) then - * XML language values such as from xml:lang will be normalized to - * lowercase. - * @RAPTOR_OPTION_NON_NFC_FATAL: If true (default false) then - * illegal Unicode Normal Form C in literals will give a fatal - * error, otherwise just a warning. - * @RAPTOR_OPTION_WARN_OTHER_PARSETYPES: If true (default true) then - * the RDF/XML parser will warn about unknown rdf:parseType values. - * @RAPTOR_OPTION_CHECK_RDF_ID: If true (default true) then the - * RDF/XML will check rdf:ID attribute values for duplicates and - * cause an error if any are found. - * @RAPTOR_OPTION_RELATIVE_URIS: If true (default true) then - * relative URIs will be used wherever possible when serializing. - * @RAPTOR_OPTION_WRITER_AUTO_INDENT: Automatically indent elements when - * seriailizing. - * @RAPTOR_OPTION_WRITER_AUTO_EMPTY: Automatically detect and - * abbreviate empty elements when serializing. - * @RAPTOR_OPTION_WRITER_INDENT_WIDTH: Integer number of spaces to use - * for each indent level when serializing with auto indent. - * @RAPTOR_OPTION_WRITER_XML_VERSION: Integer XML version XML 1.0 (10) or XML 1.1 (11) - * @RAPTOR_OPTION_WRITER_XML_DECLARATION: Write XML 1.0 or 1.1 declaration. - * @RAPTOR_OPTION_NO_NET: Deny network requests inside other requests. - * @RAPTOR_OPTION_RESOURCE_BORDER: Border color of resource - * nodes for GraphViz DOT serializer. - * @RAPTOR_OPTION_LITERAL_BORDER: Border color of literal nodes - * for GraphViz DOT serializer. - * @RAPTOR_OPTION_BNODE_BORDER: Border color of blank nodes for - * GraphViz DOT serializer. - * @RAPTOR_OPTION_RESOURCE_FILL: Fill color of resource nodes - * for GraphViz DOT serializer. - * @RAPTOR_OPTION_LITERAL_FILL: Fill color of literal nodes for - * GraphViz DOT serializer. - * @RAPTOR_OPTION_BNODE_FILL: Fill color of blank nodes for - * GraphViz DOT serializer. - * @RAPTOR_OPTION_HTML_TAG_SOUP: Use a lax HTML parser if an XML parser - * fails when read HTML for GRDDL parser. - * @RAPTOR_OPTION_MICROFORMATS: Look for microformats for GRDDL parser. - * @RAPTOR_OPTION_HTML_LINK: Look for head <link> to type rdf/xml - * for GRDDL parser. - * @RAPTOR_OPTION_WWW_TIMEOUT: Set timeout for internal WWW URI requests - * for GRDDL parser. - * @RAPTOR_OPTION_WRITE_BASE_URI: Write @base directive for Turtle/N3. - * @RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL: HTTP Cache-Control: header - * @RAPTOR_OPTION_WWW_HTTP_USER_AGENT: HTTP User-Agent: header - * @RAPTOR_OPTION_JSON_CALLBACK: JSON serializer callback function. - * @RAPTOR_OPTION_JSON_EXTRA_DATA: JSON serializer extra top-level data - * @RAPTOR_OPTION_RSS_TRIPLES: Atom/RSS serializer writes extra RDF triples it finds (none, rdf-xml, atom-triples) - * @RAPTOR_OPTION_ATOM_ENTRY_URI: Atom entry URI. If given, generate an Atom Entry Document with the item having the given URI, otherwise generate an Atom Feed Document with any items found. - * @RAPTOR_OPTION_PREFIX_ELEMENTS: Integer. If set, generate Atom/RSS1.0 documents with prefixed elements, otherwise unprefixed. - * @RAPTOR_OPTION_STRICT: Boolean. If set, operate in strict conformance mode. - * @RAPTOR_OPTION_WWW_CERT_FILENAME: String. SSL client certificate filename - * @RAPTOR_OPTION_WWW_CERT_TYPE: String. SSL client certificate type - * @RAPTOR_OPTION_WWW_CERT_PASSPHRASE: String. SSL client certificate passphrase - * @RAPTOR_OPTION_WWW_SSL_VERIFY_PEER: Integer. SSL verify peer - non-0 to verify peer SSL certificate (default) - * @RAPTOR_OPTION_WWW_SSL_VERIFY_HOST: Integer. SSL verify host - 0 none, 1 CN match, 2 host match (default). Other values are ignored. - * @RAPTOR_OPTION_NO_FILE: Deny file reading requests inside other requests. - * @RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES: When reading XML, load external entities. - * @RAPTOR_OPTION_LAST: Internal - * - * Raptor parser, serializer or XML writer options. - */ -typedef enum { - RAPTOR_OPTION_SCANNING, - RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES, - RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES, - RAPTOR_OPTION_ALLOW_BAGID, - RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST, - RAPTOR_OPTION_NORMALIZE_LANGUAGE, - RAPTOR_OPTION_NON_NFC_FATAL, - RAPTOR_OPTION_WARN_OTHER_PARSETYPES, - RAPTOR_OPTION_CHECK_RDF_ID, - RAPTOR_OPTION_RELATIVE_URIS, - RAPTOR_OPTION_WRITER_AUTO_INDENT, - RAPTOR_OPTION_WRITER_AUTO_EMPTY, - RAPTOR_OPTION_WRITER_INDENT_WIDTH, - RAPTOR_OPTION_WRITER_XML_VERSION, - RAPTOR_OPTION_WRITER_XML_DECLARATION, - RAPTOR_OPTION_NO_NET, - RAPTOR_OPTION_RESOURCE_BORDER, - RAPTOR_OPTION_LITERAL_BORDER, - RAPTOR_OPTION_BNODE_BORDER, - RAPTOR_OPTION_RESOURCE_FILL, - RAPTOR_OPTION_LITERAL_FILL, - RAPTOR_OPTION_BNODE_FILL, - RAPTOR_OPTION_HTML_TAG_SOUP, - RAPTOR_OPTION_MICROFORMATS, - RAPTOR_OPTION_HTML_LINK, - RAPTOR_OPTION_WWW_TIMEOUT, - RAPTOR_OPTION_WRITE_BASE_URI, - RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL, - RAPTOR_OPTION_WWW_HTTP_USER_AGENT, - RAPTOR_OPTION_JSON_CALLBACK, - RAPTOR_OPTION_JSON_EXTRA_DATA, - RAPTOR_OPTION_RSS_TRIPLES, - RAPTOR_OPTION_ATOM_ENTRY_URI, - RAPTOR_OPTION_PREFIX_ELEMENTS, - RAPTOR_OPTION_STRICT, - RAPTOR_OPTION_WWW_CERT_FILENAME, - RAPTOR_OPTION_WWW_CERT_TYPE, - RAPTOR_OPTION_WWW_CERT_PASSPHRASE, - RAPTOR_OPTION_NO_FILE, - RAPTOR_OPTION_WWW_SSL_VERIFY_PEER, - RAPTOR_OPTION_WWW_SSL_VERIFY_HOST, - RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES, - RAPTOR_OPTION_LAST = RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES -} raptor_option; - - -/** - * raptor_term_literal_value: - * @string: literal string - * @string_len: length of string - * @datatype: datatype URI (or NULL) - * @language: literal language (or NULL) - * @language_len: length of language - * - * Literal term value - this typedef exists solely for use in #raptor_term - * - * Either @datatype or @language may be non-NULL but not both. - */ -typedef struct { - unsigned char *string; - unsigned int string_len; - - raptor_uri *datatype; - - unsigned char *language; - unsigned char language_len; -} raptor_term_literal_value; - - -/** - * raptor_term_blank_value: - * @string: literal string - * @string_len: length of string - * - * Blank term value - this typedef exists solely for use in #raptor_term - * - */ -typedef struct { - unsigned char *string; - unsigned int string_len; -} raptor_term_blank_value; - - -/** - * raptor_term_value: - * @uri: uri value when term type is #RAPTOR_TERM_TYPE_URI - * @literal: literal value when term type is #RAPTOR_TERM_TYPE_LITERAL - * @blank: blank value when term type is #RAPTOR_TERM_TYPE_BLANK - * - * Term value - this typedef exists solely for use in #raptor_term - * - **/ -typedef union { - raptor_uri *uri; - - raptor_term_literal_value literal; - - raptor_term_blank_value blank; -} raptor_term_value; - - -/** - * raptor_term: - * @world: world - * @usage: usage reference count (if >0) - * @type: term type - * @value: term values per type - * - * An RDF statement term - * - */ -typedef struct { - raptor_world* world; - - int usage; - - raptor_term_type type; - - raptor_term_value value; - -} raptor_term; - - -/** - * raptor_statement: - * @world: world pointer - * @usage: usage count - * @subject: statement subject - * @predicate: statement predicate - * @object: statement object - * @graph: statement graph name (or NULL if not present) - * - * An RDF triple with optional graph name (quad) - * - * See #raptor_term for a description of how the fields may be used. - * As returned by a parser statement_handler. - */ -typedef struct { - raptor_world* world; - int usage; - raptor_term* subject; - raptor_term* predicate; - raptor_term* object; - raptor_term* graph; -} raptor_statement; - - -/** - * raptor_log_level: - * @RAPTOR_LOG_LEVEL_NONE: Internal - * @RAPTOR_LOG_LEVEL_TRACE: very fine-grained tracing messages information - * @RAPTOR_LOG_LEVEL_DEBUG: fine-grained tracing messages suitable for debugging - * @RAPTOR_LOG_LEVEL_INFO: coarse-grained information messages - * @RAPTOR_LOG_LEVEL_WARN: warning messages of potentially harmful problems - * @RAPTOR_LOG_LEVEL_ERROR: error messages where the application can continue - * @RAPTOR_LOG_LEVEL_FATAL: fatal error message where the application will likely abort - * @RAPTOR_LOG_LEVEL_LAST: Internal - * - * Log levels - */ -typedef enum { - RAPTOR_LOG_LEVEL_NONE, - RAPTOR_LOG_LEVEL_TRACE, - RAPTOR_LOG_LEVEL_DEBUG, - RAPTOR_LOG_LEVEL_INFO, - RAPTOR_LOG_LEVEL_WARN, - RAPTOR_LOG_LEVEL_ERROR, - RAPTOR_LOG_LEVEL_FATAL, - RAPTOR_LOG_LEVEL_LAST = RAPTOR_LOG_LEVEL_FATAL -} raptor_log_level; - - -/** - * raptor_domain: - * @RAPTOR_DOMAIN_IOSTREAM: I/O stream - * @RAPTOR_DOMAIN_NAMESPACE: XML Namespace / namespace stack - * @RAPTOR_DOMAIN_PARSER: RDF Parser - * @RAPTOR_DOMAIN_QNAME: XML QName - * @RAPTOR_DOMAIN_SAX2: XML SAX2 - * @RAPTOR_DOMAIN_SERIALIZER: RDF Serializer - * @RAPTOR_DOMAIN_TERM: RDF Term - * @RAPTOR_DOMAIN_TURTLE_WRITER: Turtle Writer - * @RAPTOR_DOMAIN_URI: RDF Uri - * @RAPTOR_DOMAIN_WORLD: RDF world - * @RAPTOR_DOMAIN_WWW: WWW - * @RAPTOR_DOMAIN_XML_WRITER: XML Writer - * @RAPTOR_DOMAIN_NONE: Internal - * @RAPTOR_DOMAIN_LAST: Internal - * - * Log domain - */ -typedef enum { - RAPTOR_DOMAIN_NONE, - RAPTOR_DOMAIN_IOSTREAM, - RAPTOR_DOMAIN_NAMESPACE, - RAPTOR_DOMAIN_PARSER, - RAPTOR_DOMAIN_QNAME, - RAPTOR_DOMAIN_SAX2, - RAPTOR_DOMAIN_SERIALIZER, - RAPTOR_DOMAIN_TERM, - RAPTOR_DOMAIN_TURTLE_WRITER, - RAPTOR_DOMAIN_URI, - RAPTOR_DOMAIN_WORLD, - RAPTOR_DOMAIN_WWW, - RAPTOR_DOMAIN_XML_WRITER, - RAPTOR_DOMAIN_LAST = RAPTOR_DOMAIN_XML_WRITER -} raptor_domain; - - -/** - * raptor_log_message: - * @code: error code or < 0 if not used or known - * @domain: message domain or #RAPTOR_DOMAIN_NONE if not used or known - * @level: log message level - * @locator: location associated with message or NULL if not known - * @text: message string - * - * Log message. - */ -typedef struct { - int code; - raptor_domain domain; - raptor_log_level level; - raptor_locator *locator; - const char *text; -} raptor_log_message; - - -/** - * raptor_log_handler: - * @user_data: user data - * @message: log message - * - * Handler function for log messages with location - * - * Used during parsing and serializing for errors and warnings that - * may include location information. Handlers may be set - * by raptor_world_set_log_handler(). - * - */ -typedef void (*raptor_log_handler)(void *user_data, raptor_log_message *message); - - -/** - * raptor_statement_handler: - * @user_data: user data - * @statement: statement to report - * - * Statement (triple) reporting handler function. - * - * This handler function set with - * raptor_parser_set_statement_handler() on a parser receives - * statements as the parsing proceeds. The @statement argument to the - * handler is shared and must be copied by the caller with - * raptor_statement_copy(). - */ -typedef void (*raptor_statement_handler)(void *user_data, raptor_statement *statement); - -/** - * raptor_graph_mark_flags: - * @RAPTOR_GRAPH_MARK_START: mark is start of graph (otherwise is end) - * @RAPTOR_GRAPH_MARK_DECLARED: mark was declared in syntax rather than implict - * - * Graph mark handler bitmask flags - */ -typedef enum { - RAPTOR_GRAPH_MARK_START = 1, - RAPTOR_GRAPH_MARK_DECLARED = 2 -} raptor_graph_mark_flags; - - -/** - * raptor_graph_mark_handler: - * @user_data: user data - * @graph: graph to report, NULL for the default graph - * @flags: bitmask of #raptor_graph_mark_flags flags - * - * Graph start/end mark handler function. - * - * Records start and end of graphs happening in a stream of generated - * #raptor_statement via the statement handler. The callback starts a - * graph when @flags has #RAPTOR_GRAPH_MARK_START bit set. - * - * The start and ends may be either declared in the syntax via some - * keyword or mechanism such as TRiG {} syntax when @flags has bit - * #RAPTOR_GRAPH_MARK_DECLARED set, or be implied by the start/end of - * the data in other syntaxes, and the bit will be unset. - */ -typedef void (*raptor_graph_mark_handler)(void *user_data, raptor_uri *graph, int flags); - -/** - * raptor_generate_bnodeid_handler: - * @user_data: user data - * @user_bnodeid: a user-specified ID or NULL if none available. - * - * Generate a blank node identifier handler function. - * - * Return value: new blank node ID to use - */ -typedef unsigned char* (*raptor_generate_bnodeid_handler)(void *user_data, unsigned char* user_bnodeid); - -/** - * raptor_namespace_handler: - * @user_data: user data - * @nspace: #raptor_namespace declared - * - * XML Namespace declaration reporting handler set by - * raptor_parser_set_namespace_handler(). - */ -typedef void (*raptor_namespace_handler)(void* user_data, raptor_namespace *nspace); - - -/** - * raptor_www_write_bytes_handler: - * @www: WWW object - * @userdata: user data - * @ptr: data pointer - * @size: size of individual item - * @nmemb: number of items - * - * Receiving bytes of data from WWW retrieval handler. - * - * Set by raptor_www_set_write_bytes_handler(). - */ -typedef void (*raptor_www_write_bytes_handler)(raptor_www* www, void *userdata, const void *ptr, size_t size, size_t nmemb); - -/** - * raptor_www_content_type_handler: - * @www: WWW object - * @userdata: user data - * @content_type: content type seen - * - * Receiving Content-Type: header from WWW retrieval handler. - * - * Set by raptor_www_set_content_type_handler(). - */ -typedef void (*raptor_www_content_type_handler)(raptor_www* www, void *userdata, const char *content_type); - -/** - * raptor_www_final_uri_handler: - * @www: WWW object - * @userdata: user data - * @final_uri: final URI seen - * - * Receiving the final resolved URI from a WWW retrieval - * - * Set by raptor_www_set_final_uri_handler(). - */ -typedef void (*raptor_www_final_uri_handler)(raptor_www* www, void *userdata, raptor_uri *final_uri); - -/** - * raptor_uri_filter_func: - * @user_data: user data - * @uri: #raptor_uri URI to check - * - * Callback function for #raptor_www_set_uri_filter - * - * Return value: non-0 to filter the URI - */ -typedef int (*raptor_uri_filter_func)(void *user_data, raptor_uri* uri); - - -/** - * raptor_world_flag: - * @RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE: if set (non-0 value) - save/restore the libxml generic error handler when raptor library initializes (default set) - * @RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE: if set (non-0 value) - save/restore the libxml structured error handler when raptor library terminates (default set) - * @RAPTOR_WORLD_FLAG_URI_INTERNING: if set (non-0 value) - each URI is saved interned in-memory and reused (default set) - * @RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH: if set (non-0 value) the raptor will neither initialise or terminate the lower level WWW library. Usually in raptor initialising either curl_global_init (for libcurl) are called and in raptor cleanup, curl_global_cleanup is called. This flag allows the application finer control over these libraries such as setting other global options or potentially calling and terminating raptor several times. It does mean that applications which use this call must do their own extra work in order to allocate and free all resources to the system. - * - * Raptor world flags - * - * These are used by raptor_world_set_flags() to control raptor-wide - * options across classes. These must be set before - * raptor_world_open() is called explicitly or implicitly (by - * creating a raptor object). There is no enumeration function for - * these flags because they are not user options and must be set - * before the library is initialised. For similar reasons, there is - * no get function. - * - * If any libxml handler saving/restoring is enabled, any existing - * handler and context is saved before parsing and restored - * afterwards. Otherwise, no saving/restoring is performed. - * - */ -typedef enum { - RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE = 1, - RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE = 2, - RAPTOR_WORLD_FLAG_URI_INTERNING = 3, - RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH = 4 -} raptor_world_flag; - - -/** - * raptor_data_compare_arg_handler: - * @data1: first object - * @data2: second object - * @user_data: user data argument - * - * Function to compare two data objects with a user data argument - * - * Designed to be used with raptor_sort_r() and compatible functions - * such as raptor_sequence_sort_r() which uses it. - * - * Return value: compare value <0 if @data1 is before @data2, =0 if equal, >0 if @data1 is after @data2 - */ -typedef int (*raptor_data_compare_arg_handler)(const void *data1, const void *data2, void *user_data); - - -/** - * raptor_data_compare_handler: - * @data1: first data object - * @data2: second data object - * - * Function to compare two data objects - signature like strcmp() and function pssed to qsort() - * - * Designed to be passed into generic data structure constructors - * like raptor_new_avltree(). - * - * Return value: compare value <0 if @data1 is before @data2, =0 if equal, >0 if @data1 is after @data2 - */ -typedef int (*raptor_data_compare_handler)(const void* data1, const void* data2); - - -/** - * raptor_data_malloc_handler: - * @size: data size - * - * Typedef for a function to allocate memory - signature like malloc() - * - * Designed to be passed into constructors - * like raptor_www_fetch_to_string - * - * Return value: pointer to newly allocated memory or NULL on failure - */ -typedef void* (*raptor_data_malloc_handler)(size_t size); - - -/** - * raptor_data_free_handler: - * @data: data object or NULL - * - * Typedef for function to free a data object - signature like free() - * - * Designed to be passed into generic data structure constructors - * like raptor_new_avltree(). If @data is NULL, nothing should be done. - */ -typedef void (*raptor_data_free_handler)(void* data); - - -/** - * raptor_data_context_free_handler: - * @context: context data for the free function - * @object: object to free - * - * Handler function for freeing a sequence item with a contextual pointer. - * - * Set by raptor_new_sequence_with_context(). -*/ -typedef void (*raptor_data_context_free_handler)(void* context, void* object); - -/** - * raptor_data_print_handler: - * @object: object to print - * @fh: FILE* to print to - * - * Handler function for printing an object to a stream. - * - * Set by raptor_new_sequence() - * - * Return value: non-0 on failure - */ -typedef int (*raptor_data_print_handler)(void *object, FILE *fh); - -/** - * raptor_data_context_print_handler: - * @context: context data for the print function - * @object: object to print - * @fh: FILE* to print to - * - * Function function for printing an object with data context to a stream. - * - * Set by raptor_new_sequence_with_context() - * - * Return value: non-0 on failure - */ -typedef int (*raptor_data_context_print_handler)(void *context, void *object, FILE *fh); - -/** - * raptor_stringbuffer: - * - * Raptor string buffer class - */ -typedef struct raptor_stringbuffer_s raptor_stringbuffer; - - -/* Public functions */ - -#define raptor_new_world() raptor_new_world_internal(RAPTOR_VERSION) -/* The real target of the raptor_new_world() macro */ -RAPTOR_API -raptor_world *raptor_new_world_internal(unsigned int version_decimal); -RAPTOR_API -int raptor_world_open(raptor_world* world); -RAPTOR_API -void raptor_free_world(raptor_world* world); -RAPTOR_API -int raptor_world_set_libxslt_security_preferences(raptor_world *world, void *security_preferences); -RAPTOR_API -int raptor_world_set_flag(raptor_world *world, raptor_world_flag flag, int value); -RAPTOR_API -int raptor_world_set_log_handler(raptor_world *world, void *user_data, raptor_log_handler handler); -RAPTOR_API -void raptor_world_set_generate_bnodeid_handler(raptor_world* world, void *user_data, raptor_generate_bnodeid_handler handler); -RAPTOR_API -unsigned char* raptor_world_generate_bnodeid(raptor_world *world); -RAPTOR_API -void raptor_world_set_generate_bnodeid_parameters(raptor_world* world, char *prefix, int base); -RAPTOR_API -const char* raptor_log_level_get_label(raptor_log_level level); -RAPTOR_API -const char* raptor_domain_get_label(raptor_domain domain); - -/* Names */ -RAPTOR_API -int raptor_world_is_parser_name(raptor_world* world, const char *name); -RAPTOR_API -const char* raptor_world_guess_parser_name(raptor_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier); -RAPTOR_API -int raptor_world_is_serializer_name(raptor_world* world, const char *name); - -/* Syntax descriptions */ -RAPTOR_API -int raptor_world_get_parsers_count(raptor_world* world); -RAPTOR_API -int raptor_world_get_serializers_count(raptor_world* world); -RAPTOR_API -const raptor_syntax_description* raptor_world_get_parser_description(raptor_world* world, unsigned int counter); -RAPTOR_API -const raptor_syntax_description* raptor_world_get_serializer_description(raptor_world* world, unsigned int counter); -RAPTOR_API -int raptor_syntax_description_validate(raptor_syntax_description* desc); - -RAPTOR_API -raptor_option raptor_world_get_option_from_uri(raptor_world* world, raptor_uri *uri); - - -/* Term Class */ -RAPTOR_API -raptor_term* raptor_new_term_from_uri(raptor_world* world, raptor_uri* uri); -RAPTOR_API -raptor_term* raptor_new_term_from_counted_uri_string(raptor_world* world, const unsigned char *uri_string, size_t length); -RAPTOR_API -raptor_term* raptor_new_term_from_uri_string(raptor_world* world, const unsigned char *uri_string); -RAPTOR_API -raptor_term* raptor_new_term_from_literal(raptor_world* world, const unsigned char* literal, raptor_uri* datatype, const unsigned char* language); -RAPTOR_API -raptor_term* raptor_new_term_from_counted_literal(raptor_world* world, const unsigned char* literal, size_t literal_len, raptor_uri* datatype, const unsigned char* language, unsigned char language_len); -RAPTOR_API -raptor_term* raptor_new_term_from_blank(raptor_world* world, const unsigned char* blank); -RAPTOR_API -raptor_term* raptor_new_term_from_counted_blank(raptor_world* world, const unsigned char* blank, size_t length); -RAPTOR_API -raptor_term* raptor_new_term_from_counted_string(raptor_world* world, unsigned char* string, size_t length); -RAPTOR_API -raptor_term* raptor_term_copy(raptor_term* term); -RAPTOR_API -int raptor_term_compare(const raptor_term *t1, const raptor_term *t2); -RAPTOR_API -int raptor_term_equals(raptor_term* t1, raptor_term* t2); -RAPTOR_API -void raptor_free_term(raptor_term *term); - -RAPTOR_API -unsigned char* raptor_term_to_counted_string(raptor_term *term, size_t* len_p); -RAPTOR_API -unsigned char* raptor_term_to_string(raptor_term *term); -RAPTOR_API -int raptor_term_escaped_write(const raptor_term *term, unsigned int flags, raptor_iostream* iostr); -RAPTOR_API RAPTOR_DEPRECATED -int raptor_term_ntriples_write(const raptor_term *term, raptor_iostream* iostr); -RAPTOR_API -int raptor_uri_turtle_write(raptor_world *world, raptor_iostream* iostr, raptor_uri* uri, raptor_namespace_stack *nstack, raptor_uri *base_uri); -RAPTOR_API -int raptor_term_turtle_write(raptor_iostream* iostr, raptor_term* term, raptor_namespace_stack *nstack, raptor_uri *base_uri); -RAPTOR_API -unsigned char* raptor_uri_to_turtle_counted_string(raptor_world *world, raptor_uri* uri, raptor_namespace_stack *nstack, raptor_uri *base_uri, size_t *len_p); -RAPTOR_API -unsigned char* raptor_uri_to_turtle_string(raptor_world *world, raptor_uri* uri, raptor_namespace_stack *nstack, raptor_uri *base_uri); -RAPTOR_API -unsigned char* raptor_term_to_turtle_counted_string(raptor_term* term, raptor_namespace_stack *nstack, raptor_uri *base_uri, size_t *len_p); -RAPTOR_API -unsigned char* raptor_term_to_turtle_string(raptor_term* term, raptor_namespace_stack *nstack, raptor_uri *base_uri); - - -/* Statement Class */ -RAPTOR_API -void raptor_statement_init(raptor_statement *statement, raptor_world *world); -RAPTOR_API -void raptor_statement_clear(raptor_statement *statement); -RAPTOR_API -raptor_statement* raptor_new_statement(raptor_world *world); -RAPTOR_API -raptor_statement* raptor_new_statement_from_nodes(raptor_world* world, raptor_term *subject, raptor_term *predicate, raptor_term *object, raptor_term *graph); -RAPTOR_API -raptor_statement* raptor_statement_copy(raptor_statement *statement); -RAPTOR_API -void raptor_free_statement(raptor_statement *statement); - -RAPTOR_API -int raptor_statement_print(const raptor_statement * statement, FILE *stream); -RAPTOR_API -int raptor_statement_print_as_ntriples(const raptor_statement * statement, FILE *stream); -RAPTOR_API -int raptor_statement_compare(const raptor_statement *s1, const raptor_statement *s2); -RAPTOR_API -int raptor_statement_equals(const raptor_statement* s1, const raptor_statement* s2); - - -/* Parser Class */ -RAPTOR_API -raptor_parser* raptor_new_parser(raptor_world* world, const char *name); -RAPTOR_API -raptor_parser* raptor_new_parser_for_content(raptor_world* world, raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier); -RAPTOR_API -void raptor_free_parser(raptor_parser* parser); - -/* methods */ - -/* Handlers */ -RAPTOR_API -void raptor_parser_set_statement_handler(raptor_parser* parser, void *user_data, raptor_statement_handler handler); -RAPTOR_API -void raptor_parser_set_graph_mark_handler(raptor_parser* parser, void *user_data, raptor_graph_mark_handler handler); -RAPTOR_API -void raptor_parser_set_namespace_handler(raptor_parser* parser, void *user_data, raptor_namespace_handler handler); -RAPTOR_API -void raptor_parser_set_uri_filter(raptor_parser* parser, raptor_uri_filter_func filter, void* user_data); -RAPTOR_API -raptor_locator* raptor_parser_get_locator(raptor_parser* rdf_parser); - - -/* Parsing functions */ -RAPTOR_API -int raptor_parser_parse_start(raptor_parser *rdf_parser, raptor_uri *uri); -RAPTOR_API -int raptor_parser_parse_chunk(raptor_parser* rdf_parser, const unsigned char *buffer, size_t len, int is_end); -RAPTOR_API -int raptor_parser_parse_file_stream(raptor_parser* rdf_parser, FILE *stream, const char *filename, raptor_uri *base_uri); -RAPTOR_API -int raptor_parser_parse_file(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri); -RAPTOR_API -int raptor_parser_parse_uri(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri); -RAPTOR_API -int raptor_parser_parse_uri_with_connection(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri, void *connection); -RAPTOR_API -int raptor_parser_parse_iostream(raptor_parser* rdf_parser, raptor_iostream *iostr, raptor_uri *base_uri); -RAPTOR_API -void raptor_parser_parse_abort(raptor_parser* rdf_parser); -RAPTOR_API -const char* raptor_parser_get_name(raptor_parser *rdf_parser); -RAPTOR_API -const raptor_syntax_description* raptor_parser_get_description(raptor_parser *rdf_parser); - -/* parser option methods */ -RAPTOR_API -int raptor_parser_set_option(raptor_parser *parser, raptor_option option, const char* string, int integer); -RAPTOR_API -int raptor_parser_get_option(raptor_parser *parser, raptor_option option, char** string_p, int* integer_p); - -/* parser utility methods */ -RAPTOR_API -const char* raptor_parser_get_accept_header(raptor_parser* rdf_parser); -RAPTOR_API -raptor_world* raptor_parser_get_world(raptor_parser* rdf_parser); -RAPTOR_API -raptor_uri* raptor_parser_get_graph(raptor_parser* rdf_parser); - - -/* Locator Class */ -/* methods */ -RAPTOR_API -int raptor_locator_print(raptor_locator* locator, FILE *stream); -RAPTOR_API -int raptor_locator_format(char *buffer, size_t length, raptor_locator* locator); -RAPTOR_API -int raptor_locator_line(raptor_locator *locator); -RAPTOR_API -int raptor_locator_column(raptor_locator *locator); -RAPTOR_API -int raptor_locator_byte(raptor_locator *locator); -RAPTOR_API -const char* raptor_locator_file(raptor_locator *locator); -RAPTOR_API -const char* raptor_locator_uri(raptor_locator *locator); - - -/* Serializer Class */ -RAPTOR_API -raptor_serializer* raptor_new_serializer(raptor_world* world, const char *name); -RAPTOR_API -void raptor_free_serializer(raptor_serializer* rdf_serializer); - -/* methods */ -RAPTOR_API -int raptor_serializer_start_to_iostream(raptor_serializer *rdf_serializer, raptor_uri *uri, raptor_iostream *iostream); -RAPTOR_API -int raptor_serializer_start_to_filename(raptor_serializer *rdf_serializer, const char *filename); -RAPTOR_API -int raptor_serializer_start_to_string(raptor_serializer *rdf_serializer, raptor_uri *uri, void **string_p, size_t *length_p); -RAPTOR_API -int raptor_serializer_start_to_file_handle(raptor_serializer *rdf_serializer, raptor_uri *uri, FILE *fh); -RAPTOR_API -int raptor_serializer_set_namespace(raptor_serializer* rdf_serializer, raptor_uri *uri, const unsigned char *prefix); -RAPTOR_API -int raptor_serializer_set_namespace_from_namespace(raptor_serializer* rdf_serializer, raptor_namespace *nspace); -RAPTOR_API -int raptor_serializer_serialize_statement(raptor_serializer* rdf_serializer, raptor_statement *statement); -RAPTOR_API -int raptor_serializer_serialize_end(raptor_serializer *rdf_serializer); -RAPTOR_API -raptor_iostream* raptor_serializer_get_iostream(raptor_serializer *serializer); -RAPTOR_API -raptor_locator* raptor_serializer_get_locator(raptor_serializer *rdf_serializer); -RAPTOR_API -int raptor_serializer_flush(raptor_serializer *rdf_serializer); -RAPTOR_API -const raptor_syntax_description* raptor_serializer_get_description(raptor_serializer *rdf_serializer); - -/* serializer option methods */ -RAPTOR_API -int raptor_serializer_set_option(raptor_serializer *serializer, raptor_option option, const char* string, int integer); -RAPTOR_API -int raptor_serializer_get_option(raptor_serializer *serializer, raptor_option option, char** string_p, int* integer_p); - -/* utility methods */ -RAPTOR_API -raptor_world* raptor_serializer_get_world(raptor_serializer* rdf_serializer); - - -/* memory functions */ -RAPTOR_API -void raptor_free_memory(void *ptr); -RAPTOR_API -void* raptor_alloc_memory(size_t size); -RAPTOR_API -void* raptor_calloc_memory(size_t nmemb, size_t size); - - -/* URI Class */ -RAPTOR_API -raptor_uri* raptor_new_uri_from_counted_string(raptor_world* world, const unsigned char *uri_string, size_t length); -RAPTOR_API -raptor_uri* raptor_new_uri(raptor_world* world, const unsigned char *uri_string); -RAPTOR_API -raptor_uri* raptor_new_uri_from_uri_local_name(raptor_world* world, raptor_uri *uri, const unsigned char *local_name); -RAPTOR_API -raptor_uri* raptor_new_uri_relative_to_base(raptor_world* world, raptor_uri *base_uri, const unsigned char *uri_string); -RAPTOR_API -raptor_uri* raptor_new_uri_relative_to_base_counted(raptor_world* world, raptor_uri *base_uri, const unsigned char *uri_string, size_t uri_len); -RAPTOR_API -raptor_uri* raptor_new_uri_from_id(raptor_world* world, raptor_uri *base_uri, const unsigned char *id); -RAPTOR_API -raptor_uri* raptor_new_uri_from_uri_or_file_string(raptor_world* world, raptor_uri* base_uri, const unsigned char* uri_or_file_string); -RAPTOR_API -raptor_uri* raptor_new_uri_for_rdf_concept(raptor_world* world, const unsigned char *name); -RAPTOR_API -raptor_uri* raptor_new_uri_for_xmlbase(raptor_uri* old_uri); -RAPTOR_API -raptor_uri* raptor_new_uri_for_retrieval(raptor_uri* old_uri); -RAPTOR_API -void raptor_free_uri(raptor_uri *uri); - -/* methods */ -RAPTOR_API -int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2); -RAPTOR_API -int raptor_uri_compare(raptor_uri* uri1, raptor_uri* uri2); -RAPTOR_API -raptor_uri* raptor_uri_copy(raptor_uri *uri); -RAPTOR_API -unsigned char* raptor_uri_as_string(raptor_uri *uri); -RAPTOR_API -unsigned char* raptor_uri_as_counted_string(raptor_uri *uri, size_t* len_p); -RAPTOR_API -unsigned char* raptor_uri_to_relative_counted_uri_string(raptor_uri *base_uri, raptor_uri *reference_uri, size_t *length_p); -RAPTOR_API -unsigned char* raptor_uri_to_relative_uri_string(raptor_uri *base_uri, raptor_uri *reference_uri); -RAPTOR_API -int raptor_uri_print(const raptor_uri* uri, FILE *stream); -RAPTOR_API -unsigned char* raptor_uri_to_counted_string(raptor_uri *uri, size_t *len_p); -RAPTOR_API -unsigned char* raptor_uri_to_string(raptor_uri *uri); -RAPTOR_API -raptor_world* raptor_uri_get_world(raptor_uri *uri); -RAPTOR_API -int raptor_uri_file_exists(raptor_uri* uri); -RAPTOR_API -int raptor_uri_escaped_write(raptor_uri* uri, raptor_uri* base_uri, unsigned int flags, raptor_iostream *iostr); - -/* XML utility functions */ -RAPTOR_API -int raptor_xml_escape_string_any(raptor_world* world, const unsigned char *string, size_t len, unsigned char *buffer, size_t length, char quote, int xml_version); -RAPTOR_API -int raptor_xml_escape_string_any_write(const unsigned char *string, size_t len, char quote, int xml_version, raptor_iostream* iostr); -RAPTOR_API -int raptor_xml_escape_string(raptor_world *world, const unsigned char *string, size_t len, unsigned char *buffer, size_t length, char quote); -RAPTOR_API -int raptor_xml_escape_string_write(const unsigned char *string, size_t len, char quote, raptor_iostream* iostr); -RAPTOR_API -int raptor_xml_name_check(const unsigned char *string, size_t length, int xml_version); - - -/* portable vsnprintf utility function */ -RAPTOR_API RAPTOR_DEPRECATED -char* raptor_vsnprintf(const char *format, va_list arguments) RAPTOR_PRINTF_FORMAT(1, 0); -RAPTOR_API -int raptor_vsnprintf2(char *buffer, size_t size, const char *format, va_list arguments) RAPTOR_PRINTF_FORMAT(3, 0); -RAPTOR_API -int raptor_snprintf(char *buffer, size_t size, const char *format, ...) RAPTOR_PRINTF_FORMAT(3, 4); -RAPTOR_API -int raptor_vasprintf(char **ret, const char *format, va_list arguments) RAPTOR_PRINTF_FORMAT(2, 0); - -/* RFC2396 URI resolving functions */ -RAPTOR_API -size_t raptor_uri_resolve_uri_reference(const unsigned char *base_uri, const unsigned char *reference_uri, unsigned char* buffer, size_t length); - -/* URI String utility functions */ -RAPTOR_API -unsigned char* raptor_uri_counted_filename_to_uri_string(const char *filename, size_t filename_len); -RAPTOR_API -unsigned char* raptor_uri_filename_to_uri_string(const char *filename); -RAPTOR_API -int raptor_uri_filename_exists(const unsigned char* path); -RAPTOR_API -char* raptor_uri_uri_string_to_filename(const unsigned char *uri_string); -RAPTOR_API -char* raptor_uri_uri_string_to_filename_fragment(const unsigned char *uri_string, unsigned char **fragment_p); -RAPTOR_API -int raptor_uri_uri_string_is_file_uri(const unsigned char* uri_string); -RAPTOR_API -int raptor_stringbuffer_append_uri_escaped_counted_string(raptor_stringbuffer* sb, const char* string, size_t length, int space_is_plus); -RAPTOR_API -char* raptor_uri_uri_string_to_counted_filename_fragment(const unsigned char *uri_string, size_t* len_p, unsigned char **fragment_p, size_t* fragment_len_p); -RAPTOR_API -int raptor_uri_uri_string_is_absolute(const unsigned char* uri_string); - - -/** - * RAPTOR_RDF_MS_URI: - * - * RDF Namespace URI (rdf:). - * - * Copy with raptor_uri_copy() to use. - */ -#define RAPTOR_RDF_MS_URI raptor_rdf_namespace_uri - -/** - * RAPTOR_RDF_SCHEMA_URI: - * - * RDF Schema Namespace URI (rdfs:). - * - * Copy with raptor_uri_copy() to use. - */ -#define RAPTOR_RDF_SCHEMA_URI raptor_rdf_schema_namespace_uri - -/** - * RAPTOR_XMLSCHEMA_DATATYPES_URI: - * - * XML Schema Datatypes URI (xsd:). - * - * Copy with raptor_uri_copy() to use. - */ -#define RAPTOR_XMLSCHEMA_DATATYPES_URI raptor_xmlschema_datatypes_namespace_uri - -/** - * RAPTOR_OWL_URI: - * - * OWL Namespace URI (owl:). - * - * Copy with raptor_uri_copy() to use. - */ -#define RAPTOR_OWL_URI raptor_owl_namespace_uri - - -/* raptor_www */ -RAPTOR_API -raptor_www* raptor_new_www(raptor_world* world); -RAPTOR_API -raptor_www* raptor_new_www_with_connection(raptor_world* world, void* connection); -RAPTOR_API -void raptor_free_www(raptor_www *www); -RAPTOR_API -int raptor_www_set_ssl_cert_options(raptor_www* www, const char* cert_filename, const char* cert_type, const char* cert_passphrase); -RAPTOR_API -int raptor_www_set_ssl_verify_options(raptor_www* www, int verify_peer, int verify_host); -RAPTOR_API -void raptor_www_set_user_agent(raptor_www *www, const char *user_agent); -RAPTOR_API -void raptor_www_set_proxy(raptor_www *www, const char *proxy); -RAPTOR_API -void raptor_www_set_http_accept(raptor_www *www, const char *value); -RAPTOR_API -void raptor_www_set_write_bytes_handler(raptor_www *www, raptor_www_write_bytes_handler handler, void *user_data); -RAPTOR_API -void raptor_www_set_content_type_handler(raptor_www *www, raptor_www_content_type_handler handler, void *user_data); -RAPTOR_API -void raptor_www_set_final_uri_handler(raptor_www* www, raptor_www_final_uri_handler handler, void *user_data); -RAPTOR_API -void raptor_www_set_uri_filter(raptor_www* www, raptor_uri_filter_func filter, void* user_data); -RAPTOR_API -void raptor_www_set_connection_timeout(raptor_www* www, int timeout); -RAPTOR_API -int raptor_www_set_http_cache_control(raptor_www* www, const char* cache_control); -RAPTOR_API -int raptor_www_fetch(raptor_www *www, raptor_uri *uri); -RAPTOR_API -int raptor_www_fetch_to_string(raptor_www *www, raptor_uri *uri, void **string_p, size_t *length_p, raptor_data_malloc_handler const malloc_handler); -RAPTOR_API -void* raptor_www_get_connection(raptor_www *www); -RAPTOR_API -void raptor_www_abort(raptor_www *www, const char *reason); -RAPTOR_API -raptor_uri* raptor_www_get_final_uri(raptor_www* www); - - -/* XML QNames Class */ -RAPTOR_API -raptor_qname* raptor_new_qname(raptor_namespace_stack *nstack, const unsigned char *name, const unsigned char *value); -RAPTOR_API -raptor_qname* raptor_new_qname_from_namespace_local_name(raptor_world* world, raptor_namespace *ns, const unsigned char *local_name, const unsigned char *value); - -/* methods */ -RAPTOR_API -raptor_qname* raptor_qname_copy(raptor_qname *qname); -RAPTOR_API -void raptor_free_qname(raptor_qname* name); -RAPTOR_API -int raptor_qname_equal(raptor_qname *name1, raptor_qname *name2); -RAPTOR_API -unsigned char* raptor_qname_to_counted_name(raptor_qname *qname, size_t* length_p); -RAPTOR_API -const raptor_namespace* raptor_qname_get_namespace(raptor_qname* name); -RAPTOR_API -const unsigned char* raptor_qname_get_local_name(raptor_qname* name); -RAPTOR_API -const unsigned char* raptor_qname_get_value(raptor_qname* name); -RAPTOR_API -const unsigned char* raptor_qname_get_counted_value(raptor_qname* name, size_t* length_p); -RAPTOR_API -int raptor_qname_write(raptor_qname *qname, raptor_iostream* iostr); - -/* QName String utility functions */ -RAPTOR_API -raptor_uri* raptor_qname_string_to_uri(raptor_namespace_stack *nstack, const unsigned char *name, size_t name_len); -RAPTOR_API -unsigned char* raptor_qname_format_as_xml(const raptor_qname *qname, size_t *length_p); - -/* XML Namespaces Stack class */ -RAPTOR_API -raptor_namespace* raptor_new_namespace_from_uri(raptor_namespace_stack *nstack, const unsigned char *prefix, raptor_uri* ns_uri, int depth); -RAPTOR_API -raptor_namespace_stack* raptor_new_namespaces(raptor_world* world, int defaults); -RAPTOR_API -int raptor_namespaces_init(raptor_world* world, raptor_namespace_stack *nstack, int defaults); -RAPTOR_API -void raptor_namespaces_clear(raptor_namespace_stack *nstack); -RAPTOR_API -void raptor_free_namespaces(raptor_namespace_stack *nstack); - -/* methods */ -RAPTOR_API -void raptor_namespaces_start_namespace(raptor_namespace_stack *nstack, raptor_namespace *nspace); -RAPTOR_API -int raptor_namespaces_start_namespace_full(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *ns_uri_string, int depth); -RAPTOR_API -void raptor_namespaces_end_for_depth(raptor_namespace_stack *nstack, int depth); -RAPTOR_API -raptor_namespace* raptor_namespaces_get_default_namespace(raptor_namespace_stack *nstack); -RAPTOR_API -raptor_namespace* raptor_namespaces_find_namespace(raptor_namespace_stack *nstack, const unsigned char *prefix, int prefix_length); -RAPTOR_API -raptor_namespace* raptor_namespaces_find_namespace_by_uri(raptor_namespace_stack *nstack, raptor_uri *ns_uri); -RAPTOR_API -int raptor_namespaces_namespace_in_scope(raptor_namespace_stack *nstack, const raptor_namespace *nspace); -RAPTOR_API -raptor_qname* raptor_new_qname_from_namespace_uri(raptor_namespace_stack *nstack, raptor_uri *uri, int xml_version); - - -/* XML Namespace Class */ -RAPTOR_API -raptor_namespace* raptor_new_namespace(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *ns_uri_string, int depth); -RAPTOR_API -void raptor_free_namespace(raptor_namespace *ns); -RAPTOR_API -int raptor_namespace_stack_start_namespace(raptor_namespace_stack *nstack, raptor_namespace *ns, int new_depth); -RAPTOR_API -raptor_uri* raptor_namespace_get_uri(const raptor_namespace *ns); -RAPTOR_API -const unsigned char* raptor_namespace_get_prefix(const raptor_namespace *ns); -RAPTOR_API -const unsigned char* raptor_namespace_get_counted_prefix(const raptor_namespace *ns, size_t *length_p); -RAPTOR_API -unsigned char* raptor_namespace_format_as_xml(const raptor_namespace *ns, size_t *length_p); -RAPTOR_API -int raptor_namespace_write(raptor_namespace *ns, raptor_iostream* iostr); - -/* namespace string utility function */ -RAPTOR_API -int raptor_xml_namespace_string_parse(const unsigned char *string, unsigned char **prefix, unsigned char **uri_string); - -/* Sequence class */ -/** - * raptor_sequence: - * - * Raptor sequence class - */ -typedef struct raptor_sequence_s raptor_sequence; - -/* Sequence Class */ -RAPTOR_API -raptor_sequence* raptor_new_sequence(raptor_data_free_handler free_handler, raptor_data_print_handler print_handler); -RAPTOR_API -raptor_sequence* raptor_new_sequence_with_context(raptor_data_context_free_handler free_handler, raptor_data_context_print_handler print_handler, void* handler_context); -RAPTOR_API -void raptor_free_sequence(raptor_sequence* seq); - -/* methods */ -RAPTOR_API -int raptor_sequence_size(raptor_sequence* seq); -RAPTOR_API -int raptor_sequence_set_at(raptor_sequence* seq, int idx, void *data); -RAPTOR_API -int raptor_sequence_push(raptor_sequence* seq, void *data); -RAPTOR_API -int raptor_sequence_shift(raptor_sequence* seq, void *data); -RAPTOR_API -void* raptor_sequence_get_at(raptor_sequence* seq, int idx); -RAPTOR_API -void* raptor_sequence_pop(raptor_sequence* seq); -RAPTOR_API -void* raptor_sequence_unshift(raptor_sequence* seq); -RAPTOR_API -void* raptor_sequence_delete_at(raptor_sequence* seq, int idx); - -RAPTOR_API -void raptor_sequence_sort(raptor_sequence* seq, raptor_data_compare_handler compare); -RAPTOR_API -void raptor_sequence_sort_r(raptor_sequence* seq, raptor_data_compare_arg_handler compare, void* user_data); -RAPTOR_API -int raptor_sequence_swap(raptor_sequence* seq, int i, int j); -RAPTOR_API -int raptor_sequence_reverse(raptor_sequence* seq, int start_index, int length); -RAPTOR_API -int raptor_sequence_next_permutation(raptor_sequence *seq, raptor_data_compare_handler compare); - -/* helper for printing sequences of strings */ -RAPTOR_API -int raptor_sequence_print(raptor_sequence* seq, FILE* fh); -RAPTOR_API -int raptor_sequence_join(raptor_sequence* dest, raptor_sequence *src); - - -/* Unicode and UTF8 */ - -/** - * raptor_unichar: - * - * raptor Unicode codepoint - */ -typedef unsigned long raptor_unichar; -RAPTOR_API -int raptor_unicode_utf8_string_put_char(raptor_unichar c, unsigned char *output, size_t length); -RAPTOR_API -int raptor_unicode_utf8_string_get_char(const unsigned char *input, size_t length, raptor_unichar *output); -RAPTOR_API -int raptor_unicode_is_xml11_namestartchar(raptor_unichar c); -RAPTOR_API -int raptor_unicode_is_xml10_namestartchar(raptor_unichar c); -RAPTOR_API -int raptor_unicode_is_xml11_namechar(raptor_unichar c); -RAPTOR_API -int raptor_unicode_is_xml10_namechar(raptor_unichar c); -RAPTOR_API -int raptor_unicode_check_utf8_string(const unsigned char *string, size_t length); -RAPTOR_API -int raptor_unicode_utf8_strlen(const unsigned char *string, size_t length); -RAPTOR_API -size_t raptor_unicode_utf8_substr(unsigned char* dest, size_t* dest_length_p, const unsigned char* src, size_t src_length, int startingLoc, int length); - -/* Stringbuffer Class */ -RAPTOR_API -raptor_stringbuffer* raptor_new_stringbuffer(void); -RAPTOR_API -void raptor_free_stringbuffer(raptor_stringbuffer *stringbuffer); - -/* methods */ -RAPTOR_API -int raptor_stringbuffer_append_counted_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, size_t length, int do_copy); -RAPTOR_API -int raptor_stringbuffer_append_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, int do_copy); -RAPTOR_API -int raptor_stringbuffer_append_decimal(raptor_stringbuffer* stringbuffer, int integer); -RAPTOR_API -int raptor_stringbuffer_append_hexadecimal(raptor_stringbuffer* stringbuffer, int hex); -RAPTOR_API -int raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer* stringbuffer, raptor_stringbuffer* append); -RAPTOR_API -int raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, size_t length, int do_copy); -RAPTOR_API -int raptor_stringbuffer_prepend_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, int do_copy); -RAPTOR_API -unsigned char* raptor_stringbuffer_as_string(raptor_stringbuffer* stringbuffer); -RAPTOR_API -size_t raptor_stringbuffer_length(raptor_stringbuffer* stringbuffer); -RAPTOR_API -int raptor_stringbuffer_copy_to_string(raptor_stringbuffer* stringbuffer, unsigned char *string, size_t length); - -/** - * raptor_iostream_init_func: - * @context: stream context data - * - * Handler function for #raptor_iostream initialising. - * - * Return value: non-0 on failure. - */ -typedef int (*raptor_iostream_init_func) (void *context); - -/** - * raptor_iostream_finish_func: - * @context: stream context data - * - * Handler function for #raptor_iostream terminating. - * - */ -typedef void (*raptor_iostream_finish_func) (void *context); - -/** - * raptor_iostream_write_byte_func - * @context: stream context data - * @byte: byte to write - * - * Handler function for implementing raptor_iostream_write_byte(). - * - * Return value: non-0 on failure. - */ -typedef int (*raptor_iostream_write_byte_func) (void *context, const int byte); - -/** - * raptor_iostream_write_bytes_func: - * @context: stream context data - * @ptr: pointer to bytes to write - * @size: size of item - * @nmemb: number of items - * - * Handler function for implementing raptor_iostream_write_bytes(). - * - * Return value: non-0 on failure. - */ -typedef int (*raptor_iostream_write_bytes_func) (void *context, const void *ptr, size_t size, size_t nmemb); - -/** - * raptor_iostream_write_end_func: - * @context: stream context data - * - * Handler function for implementing raptor_iostream_write_end(). - * - * Return value: non-0 on failure. - */ -typedef int (*raptor_iostream_write_end_func) (void *context); - -/** - * raptor_iostream_read_bytes_func: - * @context: stream context data - * @ptr: pointer to buffer to read into - * @size: size of buffer - * @nmemb: number of items - * - * Handler function for implementing raptor_iostream_read_bytes(). - * - * Return value: number of items read, 0 or < @size on EOF, <0 on failure - */ -typedef int (*raptor_iostream_read_bytes_func) (void *context, void *ptr, size_t size, size_t nmemb); - -/** - * raptor_iostream_read_eof_func: - * @context: stream context data - * - * Handler function for implementing raptor_iostream_read_eof(). - * - * Return value: non-0 if EOF - */ -typedef int (*raptor_iostream_read_eof_func) (void *context); - -/** - * raptor_iostream_handler: - * @version: interface version. Presently 1 or 2. - * @init: initialisation handler - optional, called at most once (V1) - * @finish: finishing handler - optional, called at most once (V1) - * @write_byte: write byte handler - required (for writing) (V1) - * @write_bytes: write bytes handler - required (for writing) (V1) - * @write_end: write end handler - optional (for writing), called at most once (V1) - * @read_bytes: read bytes handler - required (for reading) (V2) - * @read_eof: read EOF handler - required (for reading) (V2) - * - * I/O stream implementation handler structure. - * - */ -typedef struct { - int version; - - /* V1 functions */ - raptor_iostream_init_func init; - raptor_iostream_finish_func finish; - raptor_iostream_write_byte_func write_byte; - raptor_iostream_write_bytes_func write_bytes; - raptor_iostream_write_end_func write_end; - - /* V2 functions */ - raptor_iostream_read_bytes_func read_bytes; - raptor_iostream_read_eof_func read_eof; -} raptor_iostream_handler; - - -/* I/O Stream Class */ -RAPTOR_API -raptor_iostream* raptor_new_iostream_from_handler(raptor_world* world, void *user_data, const raptor_iostream_handler* const handler); -RAPTOR_API -raptor_iostream* raptor_new_iostream_to_sink(raptor_world* world); -RAPTOR_API -raptor_iostream* raptor_new_iostream_to_filename(raptor_world* world, const char *filename); -RAPTOR_API -raptor_iostream* raptor_new_iostream_to_file_handle(raptor_world* world, FILE *handle); -RAPTOR_API -raptor_iostream* raptor_new_iostream_to_string(raptor_world* world, void **string_p, size_t *length_p, raptor_data_malloc_handler const malloc_handler); -RAPTOR_API -raptor_iostream* raptor_new_iostream_from_sink(raptor_world* world); -RAPTOR_API -raptor_iostream* raptor_new_iostream_from_filename(raptor_world* world, const char *filename); -RAPTOR_API -raptor_iostream* raptor_new_iostream_from_file_handle(raptor_world* world, FILE *handle); -RAPTOR_API -raptor_iostream* raptor_new_iostream_from_string(raptor_world* world, void *string, size_t length); -RAPTOR_API -void raptor_free_iostream(raptor_iostream *iostr); - -RAPTOR_API -int raptor_iostream_write_bytes(const void *ptr, size_t size, size_t nmemb, raptor_iostream *iostr); -RAPTOR_API -int raptor_iostream_write_byte(const int byte, raptor_iostream *iostr); -RAPTOR_API -int raptor_iostream_write_end(raptor_iostream *iostr); -RAPTOR_API -int raptor_iostream_string_write(const void *string, raptor_iostream *iostr); -RAPTOR_API -int raptor_iostream_counted_string_write(const void *string, size_t len, raptor_iostream *iostr); -RAPTOR_API -unsigned long raptor_iostream_tell(raptor_iostream *iostr); -RAPTOR_API -int raptor_iostream_decimal_write(int integer, raptor_iostream* iostr); -RAPTOR_API -int raptor_iostream_hexadecimal_write(unsigned int integer, int width, raptor_iostream* iostr); -RAPTOR_API -int raptor_stringbuffer_write(raptor_stringbuffer *sb, raptor_iostream* iostr); -RAPTOR_API -int raptor_uri_write(raptor_uri *uri, raptor_iostream *iostr); -RAPTOR_API -int raptor_iostream_read_bytes(void *ptr, size_t size, size_t nmemb, raptor_iostream* iostr); -RAPTOR_API -int raptor_iostream_read_eof(raptor_iostream *iostr); - -/* I/O Stream utility functions */ - -/** - * raptor_escaped_write_bitflags: - * @RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_BF : Allow \b \f, - * @RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_TNRU : ALlow \t \n \r \u - * @RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8 : Allow UTF-8 for printable U * - * @RAPTOR_ESCAPED_WRITE_BITFLAG_SPARQL_URI_ESCAPES: Must escape #x00-#x20<>\"{}|^` in URIs - * @RAPTOR_ESCAPED_WRITE_NTRIPLES_LITERAL: N-Triples literal - * @RAPTOR_ESCAPED_WRITE_NTRIPLES_URI: N-Triples URI - * @RAPTOR_ESCAPED_WRITE_SPARQL_LITERAL: SPARQL literal: allows raw UTF8 for printable literals - * @RAPTOR_ESCAPED_WRITE_SPARQL_LONG_LITERAL: SPARQL long literal: no BS-escapes allowed - * @RAPTOR_ESCAPED_WRITE_SPARQL_URI: SPARQL uri: have to escape certain characters - * @RAPTOR_ESCAPED_WRITE_TURTLE_URI: Turtle 2013 URIs (like SPARQL) - * @RAPTOR_ESCAPED_WRITE_TURTLE_LITERAL: Turtle 2013 literals (like SPARQL) - * @RAPTOR_ESCAPED_WRITE_TURTLE_LONG_LITERAL: Turtle 2013 long literals (like SPARQL) - * @RAPTOR_ESCAPED_WRITE_JSON_LITERAL: JSON literals: \b \f \t \r \n and \u \U - * - * Bit flags for raptor_string_escaped_write() and friends. - */ -typedef enum { - RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_BF = 1, - RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_TNRU = 2, - RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8 = 4, - RAPTOR_ESCAPED_WRITE_BITFLAG_SPARQL_URI_ESCAPES = 8, - - /* N-Triples - favour writing \u, \U over UTF8 */ - RAPTOR_ESCAPED_WRITE_NTRIPLES_LITERAL = RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_TNRU | RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_BF, - RAPTOR_ESCAPED_WRITE_NTRIPLES_URI = RAPTOR_ESCAPED_WRITE_BITFLAG_SPARQL_URI_ESCAPES, - - /* SPARQL literal: allows raw UTF8 for printable literals */ - RAPTOR_ESCAPED_WRITE_SPARQL_LITERAL = RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8, - - /* SPARQL long literal: no BS-escapes allowed */ - RAPTOR_ESCAPED_WRITE_SPARQL_LONG_LITERAL = RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8, - - /* SPARQL uri: have to escape certain characters */ - RAPTOR_ESCAPED_WRITE_SPARQL_URI = RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8 | RAPTOR_ESCAPED_WRITE_BITFLAG_SPARQL_URI_ESCAPES, - - /* Turtle (2013) escapes are like SPARQL */ - RAPTOR_ESCAPED_WRITE_TURTLE_URI = RAPTOR_ESCAPED_WRITE_SPARQL_URI, - RAPTOR_ESCAPED_WRITE_TURTLE_LITERAL = RAPTOR_ESCAPED_WRITE_SPARQL_LITERAL, - RAPTOR_ESCAPED_WRITE_TURTLE_LONG_LITERAL = RAPTOR_ESCAPED_WRITE_SPARQL_LONG_LITERAL, - - /* JSON literals: \b \f \t \r \n and \u \U */ - RAPTOR_ESCAPED_WRITE_JSON_LITERAL = RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_TNRU | RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_BF -} raptor_escaped_write_bitflags; - - -RAPTOR_API -int raptor_string_ntriples_write(const unsigned char *string, size_t len, const char delim, raptor_iostream *iostr); -RAPTOR_API -int raptor_bnodeid_ntriples_write(const unsigned char *bnodeid, size_t len, raptor_iostream *iostr); -RAPTOR_API RAPTOR_DEPRECATED -int raptor_string_python_write(const unsigned char *string, size_t len, const char delim, unsigned int mode, raptor_iostream *iostr); -RAPTOR_API -int raptor_statement_ntriples_write(const raptor_statement *statement, raptor_iostream* iostr, int write_graph_term); -RAPTOR_API -int raptor_string_escaped_write(const unsigned char *string, size_t len, const char delim, unsigned int flags, raptor_iostream *iostr); - - -/* Parser and Serializer options */ - -/** - * raptor_option_value_type: - * @RAPTOR_OPTION_VALUE_TYPE_BOOL: Boolean integer value. Non-0 is true - * @RAPTOR_OPTION_VALUE_TYPE_INT: Decimal integer value - * @RAPTOR_OPTION_VALUE_TYPE_STRING: String value - * @RAPTOR_OPTION_VALUE_TYPE_URI: URI String value. - * @RAPTOR_OPTION_VALUE_TYPE_LAST: internal - * - * Option value types. - */ -typedef enum { - RAPTOR_OPTION_VALUE_TYPE_BOOL, - RAPTOR_OPTION_VALUE_TYPE_INT, - RAPTOR_OPTION_VALUE_TYPE_STRING, - RAPTOR_OPTION_VALUE_TYPE_URI, - RAPTOR_OPTION_VALUE_TYPE_LAST = RAPTOR_OPTION_VALUE_TYPE_URI -} raptor_option_value_type; - - -/** - * raptor_option_description: - * @domain: domain ID - * @option: option ID - * @value_type: data type of option value - * @name: short name for option - * @name_len: length of @name - * @label: description of option - * @uri: URI identifying option - * - * Description of an option for a domain. - */ -typedef struct { - raptor_domain domain; - raptor_option option; - raptor_option_value_type value_type; - const char* name; - size_t name_len; - const char* label; - raptor_uri* uri; -} raptor_option_description; - - -RAPTOR_API -unsigned int raptor_option_get_count(void); -RAPTOR_API -const char* raptor_option_get_value_type_label(const raptor_option_value_type type); -RAPTOR_API -void raptor_free_option_description(raptor_option_description* option_description); -RAPTOR_API -raptor_option_description* raptor_world_get_option_description(raptor_world* world, const raptor_domain domain, const raptor_option option); - - -/* SAX2 element Class (raptor_xml_element) */ -RAPTOR_API -raptor_xml_element* raptor_new_xml_element(raptor_qname* name, const unsigned char* xml_language, raptor_uri* xml_base); -RAPTOR_API -raptor_xml_element* raptor_new_xml_element_from_namespace_local_name(raptor_namespace *ns, const unsigned char *name, const unsigned char *xml_language, raptor_uri *xml_base); -RAPTOR_API -void raptor_free_xml_element(raptor_xml_element *element); - -/* methods */ -RAPTOR_API -raptor_qname* raptor_xml_element_get_name(raptor_xml_element *xml_element); -RAPTOR_API -void raptor_xml_element_set_attributes(raptor_xml_element* xml_element, raptor_qname **attributes, int count); -RAPTOR_API -raptor_qname** raptor_xml_element_get_attributes(raptor_xml_element* xml_element); -RAPTOR_API -int raptor_xml_element_get_attributes_count(raptor_xml_element* xml_element); -RAPTOR_API -int raptor_xml_element_declare_namespace(raptor_xml_element* xml_element, raptor_namespace *nspace); -RAPTOR_API -int raptor_xml_element_write(raptor_xml_element *element, raptor_namespace_stack *nstack, int is_empty, int is_end, int depth, raptor_iostream *iostr); -RAPTOR_API -int raptor_xml_element_is_empty(raptor_xml_element* xml_element); -RAPTOR_API -const unsigned char* raptor_xml_element_get_language(raptor_xml_element* xml_element); - - -/* XML Writer Class (raptor_xml_writer) */ -RAPTOR_API -raptor_xml_writer* raptor_new_xml_writer(raptor_world* world, raptor_namespace_stack *nstack, raptor_iostream* iostr); -RAPTOR_API -void raptor_free_xml_writer(raptor_xml_writer* xml_writer); - -/* methods */ -RAPTOR_API -void raptor_xml_writer_empty_element(raptor_xml_writer* xml_writer, raptor_xml_element *element); -RAPTOR_API -void raptor_xml_writer_start_element(raptor_xml_writer* xml_writer, raptor_xml_element *element); -RAPTOR_API -void raptor_xml_writer_end_element(raptor_xml_writer* xml_writer, raptor_xml_element *element); -RAPTOR_API -void raptor_xml_writer_newline(raptor_xml_writer* xml_writer); -RAPTOR_API -void raptor_xml_writer_cdata(raptor_xml_writer* xml_writer, const unsigned char *s); -RAPTOR_API -void raptor_xml_writer_cdata_counted(raptor_xml_writer* xml_writer, const unsigned char *s, unsigned int len); -RAPTOR_API -void raptor_xml_writer_raw(raptor_xml_writer* xml_writer, const unsigned char *s); -RAPTOR_API -void raptor_xml_writer_raw_counted(raptor_xml_writer* xml_writer, const unsigned char *s, unsigned int len); -RAPTOR_API -void raptor_xml_writer_comment(raptor_xml_writer* xml_writer, const unsigned char *s); -RAPTOR_API -void raptor_xml_writer_comment_counted(raptor_xml_writer* xml_writer, const unsigned char *s, unsigned int len); -RAPTOR_API -void raptor_xml_writer_flush(raptor_xml_writer* xml_writer); -RAPTOR_API -int raptor_xml_writer_set_option(raptor_xml_writer *xml_writer, raptor_option option, char* string, int integer); -RAPTOR_API -int raptor_xml_writer_get_option(raptor_xml_writer *xml_writer, raptor_option option, char** string_p, int* integer_p); -RAPTOR_API -int raptor_xml_writer_get_depth(raptor_xml_writer *xml_writer); - -/** - * raptor_sax2_start_element_handler: - * @user_data: user data - * @xml_element: XML element - * - * SAX2 start element handler - */ -typedef void (*raptor_sax2_start_element_handler)(void *user_data, raptor_xml_element *xml_element); - -/** - * raptor_sax2_end_element_handler: - * @user_data: user data - * @xml_element: XML element - * - * SAX2 end element handler - */ -typedef void (*raptor_sax2_end_element_handler)(void *user_data, raptor_xml_element* xml_element); - -/** - * raptor_sax2_characters_handler: - * @user_data: user data - * @xml_element: XML element - * @s: string - * @len: string len - * - * SAX2 characters handler - */ -typedef void (*raptor_sax2_characters_handler)(void *user_data, raptor_xml_element* xml_element, const unsigned char *s, int len); - -/** - * raptor_sax2_cdata_handler: - * @user_data: user data - * @xml_element: XML element - * @s: string - * @len: string len - - * SAX2 CDATA section handler - */ -typedef void (*raptor_sax2_cdata_handler)(void *user_data, raptor_xml_element* xml_element, const unsigned char *s, int len); - -/** - * raptor_sax2_comment_handler: - * @user_data: user data - * @xml_element: XML element - * @s: string - * - * SAX2 XML comment handler - */ -typedef void (*raptor_sax2_comment_handler)(void *user_data, raptor_xml_element* xml_element, const unsigned char *s); - -/** - * raptor_sax2_unparsed_entity_decl_handler: - * @user_data: user data - * @entityName: entity name - * @base: base URI - * @systemId: system ID - * @publicId: public ID - * @notationName: notation name - * - * SAX2 unparsed entity (NDATA) handler - */ -typedef void (*raptor_sax2_unparsed_entity_decl_handler)(void *user_data, const unsigned char* entityName, const unsigned char* base, const unsigned char* systemId, const unsigned char* publicId, const unsigned char* notationName); - -/** - * raptor_sax2_external_entity_ref_handler: - * @user_data: user data - * @context: context - * @base: base URI - * @systemId: system ID - * @publicId: public ID - * - * SAX2 external entity reference handler - * - * Return value: 0 if processing should not continue because of a - * fatal error in the handling of the external entity. - */ -typedef int (*raptor_sax2_external_entity_ref_handler)(void *user_data, const unsigned char* context, const unsigned char* base, const unsigned char* systemId, const unsigned char* publicId); - - -/* SAX2 API */ -RAPTOR_API -raptor_sax2* raptor_new_sax2(raptor_world *world, raptor_locator *locator, void* user_data); -RAPTOR_API -void raptor_free_sax2(raptor_sax2 *sax2); - -/* methods */ -RAPTOR_API -void raptor_sax2_set_start_element_handler(raptor_sax2* sax2, raptor_sax2_start_element_handler handler); -RAPTOR_API -void raptor_sax2_set_end_element_handler(raptor_sax2* sax2, raptor_sax2_end_element_handler handler); -RAPTOR_API -void raptor_sax2_set_characters_handler(raptor_sax2* sax2, raptor_sax2_characters_handler handler); -RAPTOR_API -void raptor_sax2_set_cdata_handler(raptor_sax2* sax2, raptor_sax2_cdata_handler handler); -RAPTOR_API -void raptor_sax2_set_comment_handler(raptor_sax2* sax2, raptor_sax2_comment_handler handler); -RAPTOR_API -void raptor_sax2_set_unparsed_entity_decl_handler(raptor_sax2* sax2, raptor_sax2_unparsed_entity_decl_handler handler); -RAPTOR_API -void raptor_sax2_set_external_entity_ref_handler(raptor_sax2* sax2, raptor_sax2_external_entity_ref_handler handler); -RAPTOR_API -void raptor_sax2_set_namespace_handler(raptor_sax2* sax2, raptor_namespace_handler handler); -RAPTOR_API -void raptor_sax2_set_uri_filter(raptor_sax2* sax2, raptor_uri_filter_func filter, void *user_data); -RAPTOR_API -void raptor_sax2_parse_start(raptor_sax2 *sax2, raptor_uri *base_uri); -RAPTOR_API -int raptor_sax2_parse_chunk(raptor_sax2* sax2, const unsigned char *buffer, size_t len, int is_end); -RAPTOR_API -const unsigned char* raptor_sax2_inscope_xml_language(raptor_sax2* sax2); -RAPTOR_API -raptor_uri* raptor_sax2_inscope_base_uri(raptor_sax2* sax2); - - - -/* AVL Trees */ - -/** - * raptor_avltree: - * - * AVL Tree - */ -typedef struct raptor_avltree_s raptor_avltree; - -/** - * raptor_avltree_iterator: - * - * AVL Tree Iterator as created by raptor_new_avltree_iterator() - */ -typedef struct raptor_avltree_iterator_s raptor_avltree_iterator; - -/** - * raptor_avltree_visit_handler: - * @depth: depth of object in tree - * @data: data object being visited - * @user_data: user data arg to raptor_avltree_visit() - * - * AVL Tree visitor function as given to raptor_avltree_visit() - * - * Return value: non-0 to terminate visit early. - */ -typedef int (*raptor_avltree_visit_handler)(int depth, void* data, void *user_data); - - -/** - * raptor_avltree_bitflags: - * @RAPTOR_AVLTREE_FLAG_REPLACE_DUPLICATES: If set raptor_avltree_add() will replace any duplicate items. If not set, raptor_avltree_add() will not replace them and will return status >0 when adding a duplicate. (Default is not set) - * - * Bit flags for AVL Tree class constructor raptor_new_avltree() - **/ -typedef enum { - RAPTOR_AVLTREE_FLAG_REPLACE_DUPLICATES = 1 -} raptor_avltree_bitflags; - - -RAPTOR_API -raptor_avltree* raptor_new_avltree(raptor_data_compare_handler compare_handler, raptor_data_free_handler free_handler, unsigned int flags); -RAPTOR_API -void raptor_free_avltree(raptor_avltree* tree); - -/* methods */ -RAPTOR_API -int raptor_avltree_add(raptor_avltree* tree, void* p_data); -RAPTOR_API -void* raptor_avltree_remove(raptor_avltree* tree, void* p_data); -RAPTOR_API -int raptor_avltree_delete(raptor_avltree* tree, void* p_data); -RAPTOR_API -void* raptor_avltree_search(raptor_avltree* tree, const void* p_data); -RAPTOR_API -int raptor_avltree_visit(raptor_avltree* tree, raptor_avltree_visit_handler visit_handler, void* user_data); -RAPTOR_API -int raptor_avltree_size(raptor_avltree* tree); -RAPTOR_API -void raptor_avltree_set_print_handler(raptor_avltree* tree, raptor_data_print_handler print_handler); -RAPTOR_API -int raptor_avltree_print(raptor_avltree* tree, FILE* stream); - -RAPTOR_API -raptor_avltree_iterator* raptor_new_avltree_iterator(raptor_avltree* tree, void* range, raptor_data_free_handler range_free_handler, int direction); -RAPTOR_API -void raptor_free_avltree_iterator(raptor_avltree_iterator* iterator); - -RAPTOR_API -int raptor_avltree_iterator_is_end(raptor_avltree_iterator* iterator); -RAPTOR_API -int raptor_avltree_iterator_next(raptor_avltree_iterator* iterator); -RAPTOR_API -void* raptor_avltree_iterator_get(raptor_avltree_iterator* iterator); - -/* utility methods */ -void raptor_sort_r(void *base, size_t nel, size_t width, raptor_data_compare_arg_handler compar, void *user_data); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/source/raptor/linux/raptor2/lib/libraptor2.a b/source/raptor/linux/raptor2/lib/libraptor2.a deleted file mode 100644 index 2c7ff829..00000000 Binary files a/source/raptor/linux/raptor2/lib/libraptor2.a and /dev/null differ diff --git a/source/sequence.h b/source/sequence.h index 856c05b4..9c1cdc62 100644 --- a/source/sequence.h +++ b/source/sequence.h @@ -41,7 +41,7 @@ namespace sbol /// @param elements A string representation of the primary structure of DNA, RNA, protein, or a SMILES string for small molecules. /// @param encoding A URI that describes the representation format used for the elements property. Set to SBOL_ENCODING_IUPAC by default /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string. - Sequence(std::string uri = "example", std::string elements = "", std::string encoding = SBOL_ENCODING_IUPAC, std::string version = "1.0.0") : Sequence(SBOL_SEQUENCE, uri, elements, encoding, version) {}; + Sequence(std::string uri = "example", std::string elements = "", std::string encoding = SBOL_ENCODING_IUPAC, std::string version = VERSION_STRING) : Sequence(SBOL_SEQUENCE, uri, elements, encoding, version) {}; /// Constructor used for defining extension classes /// @param type_uri The RDF type for an extension class derived from this one diff --git a/source/sequenceannotation.h b/source/sequenceannotation.h index 5c5d80f5..411de490 100644 --- a/source/sequenceannotation.h +++ b/source/sequenceannotation.h @@ -42,7 +42,7 @@ namespace sbol /// Construct a ComponentDefinition /// @param uri A full URI including a scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. /// @param version An arbitrary version string. If SBOLCompliance is enabled, this should be a Maven version string of the form "major.minor.patch". - SequenceAnnotation(std::string uri = "example", std::string version = "1.0.0") : SequenceAnnotation(SBOL_SEQUENCE_ANNOTATION, uri, version) {}; + SequenceAnnotation(std::string uri = "example", std::string version = VERSION_STRING) : SequenceAnnotation(SBOL_SEQUENCE_ANNOTATION, uri, version) {}; /// The component property is OPTIONAL and has a data type of URI. This URI MUST refer to a Component that is contained by the same parent ComponentDefinition that contains the SequenceAnnotation. In this way, the properties of the SequenceAnnotation, such as its description and locations, are associated with part of the substructure of its parent ComponentDefinition. ReferencedObject component; diff --git a/source/sequenceconstraint.h b/source/sequenceconstraint.h index a49847a2..02eb0126 100644 --- a/source/sequenceconstraint.h +++ b/source/sequenceconstraint.h @@ -44,7 +44,7 @@ namespace sbol /// @param subject Identity of the Component with this structural constraint /// @param object Identity of the other Component with this structural constraint /// @param restriction Flag indicating the type of structual constraint between the subject and object Components. By default, this is set to SBOL_RESTRICTION_PRECEDES - SequenceConstraint(std::string uri = "example", std::string subject = "", std::string object = "", std::string restriction = SBOL_RESTRICTION_PRECEDES, std::string version = "1.0.0") : + SequenceConstraint(std::string uri = "example", std::string subject = "", std::string object = "", std::string restriction = SBOL_RESTRICTION_PRECEDES, std::string version = VERSION_STRING) : SequenceConstraint(SBOL_SEQUENCE_CONSTRAINT, uri, subject, object, restriction, version) {}; /// The subject property is REQUIRED and MUST contain a URI that refers to a Component contained by the same parent ComponentDefinition that contains the SequenceConstraint. diff --git a/source/toplevel.h b/source/toplevel.h index 1dbc3e74..5e2788b5 100644 --- a/source/toplevel.h +++ b/source/toplevel.h @@ -43,7 +43,7 @@ namespace sbol public: ReferencedObject attachments; - TopLevel(rdf_type type_uri = SBOL_TOP_LEVEL, std::string uri = "example", std::string version = "1.0.0") : + TopLevel(rdf_type type_uri = SBOL_TOP_LEVEL, std::string uri = "example", std::string version = VERSION_STRING) : Identified(type_uri, uri, version), attachments(this, SBOL_ATTACHMENTS, SBOL_ATTACHMENT, '0', '*', ValidationRules({})) { diff --git a/source/validation.cpp b/source/validation.cpp index 52a37a68..4057c908 100644 --- a/source/validation.cpp +++ b/source/validation.cpp @@ -26,7 +26,9 @@ #include "sbol.h" #include +#ifndef SBOL_BUILD_MANYLINUX #include +#endif using namespace sbol; using namespace std; @@ -92,7 +94,7 @@ void sbol::sbol_rule_10202(void *sbol_obj, void *arg) { if (identified_obj->doc->SBOLObjects.find(new_id) != identified_obj->doc->SBOLObjects.end()) // If the new identity is already in the document throw an error { - throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "An object with this URI already exists in the Document. See validation rule sbol-10202."); + throw SBOLError(SBOL_ERROR_URI_NOT_UNIQUE, "Cannot add " + new_id + " to Document. An object with this URI already exists. See validation rule sbol-10202."); } } }; @@ -131,6 +133,7 @@ void sbol::libsbol_rule_1(void *sbol_obj, void *arg) // Validate XSD date-time format void sbol::libsbol_rule_2(void *sbol_obj, void *arg) { +#ifndef SBOL_BUILD_MANYLINUX const char *c_date_time = (const char *)arg; string date_time = string(c_date_time); if (date_time.compare("") != 0) @@ -150,6 +153,7 @@ void sbol::libsbol_rule_2(void *sbol_obj, void *arg) if (!(DATETIME_MATCH_1 || DATETIME_MATCH_2 || DATETIME_MATCH_3)) throw SBOLError(SBOL_ERROR_NONCOMPLIANT_VERSION, "Invalid datetime format. Datetimes are based on XML Schema dateTime datatype. For example 2016-03-16T20:12:00Z"); } +#endif }; // Validate Design.structure and Design.function are compatible @@ -287,80 +291,80 @@ void sbol::libsbol_rule_6(void *sbol_obj, void *arg) // Validate that the Analysis object referenced in Design.characterization is consistent with #learn Usage void sbol::libsbol_rule_7(void *sbol_obj, void *arg) { - Design& design = *(Design*)sbol_obj; - string& analysis_id = *(string*)arg; - if (design.doc && design.wasGeneratedBy.size()) - { - vector< Usage* > learn_usages; - for (auto & activity : design.doc->activities) - if (activity.identity.get() == design.wasGeneratedBy.get()) - for (auto & usage : activity.usages) - if (usage.roles.find(SBOL_LEARN)) - learn_usages.push_back(&usage); - for (auto & usage : learn_usages) - if (analysis_id == usage->entity.get()) - return; - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The characterization property of " + design.identity.get() + " must reference the same Analysis as referenced by the Activity that produced it."); } + // Design& design = *(Design*)sbol_obj; + // string& analysis_id = *(string*)arg; + // if (design.doc && design.wasGeneratedBy.size()) + // { + // vector< Usage* > learn_usages; + // for (auto & activity : design.doc->activities) + // if (activity.identity.get() == design.wasGeneratedBy.get()) + // for (auto & usage : activity.usages) + // if (usage.roles.find(SBOL_LEARN)) + // learn_usages.push_back(&usage); + // for (auto & usage : learn_usages) + // if (analysis_id == usage->entity.get()) + // return; + // throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The characterization property of " + design.identity.get() + " must reference the same Analysis as referenced by the Activity that produced it."); } }; // Validate that the Design object referenced in Build.design is consistent with #design Usage void sbol::libsbol_rule_8(void *sbol_obj, void *arg) { - Build& build = *(Build*)sbol_obj; - string& design_id = *(string*)arg; - if (build.doc && build.wasGeneratedBy.size()) - { - vector< Usage* > design_usages; - for (auto & activity : build.doc->activities) - if (activity.identity.get() == build.wasGeneratedBy.get()) - for (auto & usage : activity.usages) - if (usage.roles.find(SBOL_DESIGN)) - design_usages.push_back(&usage); - for (auto & usage : design_usages) - if (design_id == usage->entity.get()) - return; - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The design property of " + build.identity.get() + " must reference the same Design as referenced by the Activity that produced it."); - } + // Build& build = *(Build*)sbol_obj; + // string& design_id = *(string*)arg; + // if (build.doc && build.wasGeneratedBy.size()) + // { + // vector< Usage* > design_usages; + // for (auto & activity : build.doc->activities) + // if (activity.identity.get() == build.wasGeneratedBy.get()) + // for (auto & usage : activity.usages) + // if (usage.roles.find(SBOL_DESIGN)) + // design_usages.push_back(&usage); + // for (auto & usage : design_usages) + // if (design_id == usage->entity.get()) + // return; + // throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The design property of " + build.identity.get() + " must reference the same Design as referenced by the Activity that produced it."); + // } }; // Validate that the Build objects referenced in Test.samples is consistent with #build Usage void sbol::libsbol_rule_9(void *sbol_obj, void *arg) { - Test& test = *(Test*)sbol_obj; - string& sample_id = *(string*)arg; - if (test.doc && test.wasGeneratedBy.size()) - { - vector< Usage* > build_usages; - for (auto & activity : test.doc->activities) - if (activity.identity.get() == test.wasGeneratedBy.get()) - for (auto & usage : activity.usages) - if (usage.roles.find(SBOL_BUILD)) - build_usages.push_back(&usage); - for (auto & usage : build_usages) - if (sample_id == usage->entity.get()) - return; - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The samples property of " + test.identity.get() + " must reference the same Build objects as referenced by the Activity that produced it."); - } + // Test& test = *(Test*)sbol_obj; + // string& sample_id = *(string*)arg; + // if (test.doc && test.wasGeneratedBy.size()) + // { + // vector< Usage* > build_usages; + // for (auto & activity : test.doc->activities) + // if (activity.identity.get() == test.wasGeneratedBy.get()) + // for (auto & usage : activity.usages) + // if (usage.roles.find(SBOL_BUILD)) + // build_usages.push_back(&usage); + // for (auto & usage : build_usages) + // if (sample_id == usage->entity.get()) + // return; + // throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The samples property of " + test.identity.get() + " must reference the same Build objects as referenced by the Activity that produced it."); + // } }; // Validate that the Test objects referenced in Analysis.rawData is consistent with #test Usage void sbol::libsbol_rule_10(void *sbol_obj, void *arg) { - Analysis& analysis = *(Analysis*)sbol_obj; - string& test_id = *(string*)arg; - if (analysis.doc && analysis.wasGeneratedBy.size()) - { - vector< Usage* > test_usages; - for (auto & activity : analysis.doc->activities) - if (activity.identity.get() == analysis.wasGeneratedBy.get()) - for (auto & usage : activity.usages) - if (usage.roles.find(SBOL_TEST)) - test_usages.push_back(&usage); - for (auto & usage : test_usages) - if (test_id == usage->entity.get()) - return; - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The rawData property of " + analysis.identity.get() + " must reference the same Test object as referenced by the Activity that produced it."); - } + // Analysis& analysis = *(Analysis*)sbol_obj; + // string& test_id = *(string*)arg; + // if (analysis.doc && analysis.wasGeneratedBy.size()) + // { + // vector< Usage* > test_usages; + // for (auto & activity : analysis.doc->activities) + // if (activity.identity.get() == analysis.wasGeneratedBy.get()) + // for (auto & usage : activity.usages) + // if (usage.roles.find(SBOL_TEST)) + // test_usages.push_back(&usage); + // for (auto & usage : test_usages) + // if (test_id == usage->entity.get()) + // return; + // throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "The rawData property of " + analysis.identity.get() + " must reference the same Test object as referenced by the Activity that produced it."); + // } }; void sbol::libsbol_rule_11(void *sbol_obj, void *arg) @@ -457,4 +461,80 @@ void sbol::libsbol_rule_18(void *sbol_obj, void *arg) void sbol::libsbol_rule_19(void *sbol_obj, void *arg) { throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot modify property value. It is read-only."); -}; \ No newline at end of file +}; + +void sbol::libsbol_rule_20(void *sbol_obj, void *arg) +{ + ComponentDefinition& cd = *(ComponentDefinition*)sbol_obj; + Sequence& seq = *(Sequence*)arg; + vector seq_ids = cd.sequences.getAll(); + if (std::find(seq_ids.begin(), seq_ids.end(), seq.identity.get()) == seq_ids.end()) + { + cd.sequences.clear(); + cd.sequences.set(seq.identity.get()); + } +}; + +void sbol::libsbol_rule_21(void *sbol_obj, void *arg) +{ + ComponentDefinition& cd = *(ComponentDefinition*)sbol_obj; + string& seq_id = *(string*)arg; + if (cd.sequence.size() && seq_id != cd.sequence.get().identity.get()) + { + cd.sequence.remove(); + if (cd.doc && cd.sequences.find(seq_id)) + { + cd.sequence.set(cd.doc->get(seq_id)); + } + } +}; + +void sbol::libsbol_rule_22(void *sbol_obj, void *arg) +{ + Activity& activity = *(Activity*)sbol_obj; + Agent& agent = *(Agent*)arg; + + if (activity.associations.size() > 1) + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add Agent. This Activity already has an Association that specifies an Agent"); + + if (activity.associations.size() == 1) { + Association &asc = activity.associations.get(); + asc.agent.set(agent.identity.get()); + + } else { + std::string id; + if (Config::getOption("sbol_compliant_uris") == "True") + id = activity.displayId.get(); + else + id = activity.identity.get(); + Association& asc = activity.associations.create(id + "_generation_association"); + asc.agent.set(agent.identity.get()); + if (activity.plan.size()) + asc.plan.set(activity.plan.get().identity.get()); + } +}; + +void sbol::libsbol_rule_24(void *sbol_obj, void *arg) +{ + Activity& activity = *(Activity*)sbol_obj; + Plan& plan = *(Plan*)arg; + + if (activity.associations.size() > 1) + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add Plan. This Activity already has an Association that specifies a Plan"); + + if (activity.associations.size() == 1) { + Association &asc = activity.associations.get(); + asc.plan.set(plan.identity.get()); + + } else { + std::string id; + if (Config::getOption("sbol_compliant_uris") == "True") + id = activity.displayId.get(); + else + id = activity.identity.get(); + Association& asc = activity.associations.create(id + "_generation_association"); + asc.plan.set(plan.identity.get()); + if (activity.agent.size()) + asc.agent.set(activity.agent.get().identity.get()); + } +}; diff --git a/source/validation.h b/source/validation.h index fe0c79bd..4a6f5827 100644 --- a/source/validation.h +++ b/source/validation.h @@ -90,6 +90,19 @@ namespace sbol // Property is read-only SBOL_DECLSPEC void libsbol_rule_19(void *sbol_obj, void *arg); + // ComponentDefinition sequence and sequences property are synced + SBOL_DECLSPEC void libsbol_rule_20(void *sbol_obj, void *arg); + + // ComponentDefinition sequence and sequences property are synced + SBOL_DECLSPEC void libsbol_rule_21(void *sbol_obj, void *arg); + + // Activity::agent is synced with Association::agent + SBOL_DECLSPEC void libsbol_rule_22(void *sbol_obj, void *arg); + + // Activity::plan is synced with Association::plan + SBOL_DECLSPEC void libsbol_rule_24(void *sbol_obj, void *arg); + + bool is_alphanumeric_or_underscore(char c); bool is_not_alphanumeric_or_underscore(char c); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d51dd71c..d796347b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,17 +20,21 @@ elseif(TARGET sbol64-shared) add_library(sbol ALIAS sbol64-shared) endif() -#temporary fix -IF (SBOL_BUILD_PYTHON3) -find_package( PythonLibs 3 ) -ADD_DEFINITIONS(-DSBOL_BUILD_PYTHON3) -include_directories( ${PYTHON_INCLUDE_DIR} ) -ELSEIF(SBOL_BUILD_PYTHON2) -find_package( PythonLibs 2 ) -ADD_DEFINITIONS(-DSBOL_BUILD_PYTHON2) -include_directories( ${PYTHON_INCLUDE_DIR} ) -ENDIF() -message( "FOUND PYTHON = ${PYTHON_LIBRARIES}") +# pass definitions to compiler for conditional compilation +if (SBOL_BUILD_PYTHON3) + find_package( PythonLibs 3 ) + ADD_DEFINITIONS(-DSBOL_BUILD_PYTHON3) + include_directories( ${PYTHON_INCLUDE_DIR} ) +elseif(SBOL_BUILD_PYTHON2) + find_package( PythonLibs 2 ) + ADD_DEFINITIONS(-DSBOL_BUILD_PYTHON2) + include_directories( ${PYTHON_INCLUDE_DIR} ) +endif() +if( SBOL_BUILD_MANYLINUX ) + add_definitions(-DSBOL_BUILD_MANYLINUX) +endif() + + IF ( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) # build test executable @@ -56,16 +60,21 @@ ELSE () # build test executable add_executable( sbol_test ${APPLICATION_FILES} ) set_target_properties(sbol_test PROPERTIES LINKER_LANGUAGE CXX) + + if( RASQAL_LIBRARY ) + SET(RASQAL_LDFLAGS ${RASQAL_LIBRARY}) + endif() target_link_libraries( sbol_test sbol - ${PYTHON_LIBRARIES} #temporary fix + #${PYTHON_LIBRARIES} #temporary fix ${RAPTOR_LIBRARY} + ${RASQAL_LDFLAGS} ${CURL_LIBRARY} ${LIBXSLT_LIBRARIES} ${JsonCpp_LIBRARY} ) file(MAKE_DIRECTORY "${SBOL_RELEASE_DIR}/test") - add_custom_command(TARGET sbol_test PRE_BUILD COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/SBOLTestSuite/SBOL2 ${SBOL_RELEASE_DIR}/test/roundtrip) + add_custom_command(TARGET sbol_test PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/SBOLTestSuite/SBOL2 ${SBOL_RELEASE_DIR}/test/roundtrip) set_target_properties(sbol_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SBOL_RELEASE_DIR}/test") ENDIF () diff --git a/test/SBOLTestSuite b/test/SBOLTestSuite index d709bcb9..d7b83104 160000 --- a/test/SBOLTestSuite +++ b/test/SBOLTestSuite @@ -1 +1 @@ -Subproject commit d709bcb942ae1b44cc905e0d8ae65e2fedbd8e5b +Subproject commit d7b83104f81a9891ffb8229b0621b17a98cb152c diff --git a/test/test.cpp b/test/test.cpp index 1df3979a..4a696216 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -10,6 +10,7 @@ #include #include +#include using namespace std; using namespace sbol; @@ -21,30 +22,60 @@ bool roundtrip(string path, string filename) Document& doc2 = *new Document(); std::cout << "Testing " << filename << std::endl; - doc.read(path + "/" + filename); - std::cout << "Writing " << filename << std::endl; - doc.write(path + "/" + "new_" + filename); - std::cout << "Reading " << filename << std::endl; - doc2.read(path + "/" + "new_" + filename); + try + { + doc.read(path + "/" + filename); + } + catch(const std::exception &e) + { + cerr << e.what() << endl; + std::cout << "FAIL" << std::endl; + return false; + } + try + { + std::cout << "Writing " << filename << std::endl; + doc.write(path + "/" + "new_" + filename); + } + catch(const std::exception &e) + { + cerr << e.what() << endl; + std::cout << "FAIL" << std::endl; + return false; + } + try + { + std::cout << "Reading " << filename << std::endl; + doc2.read(path + "/" + "new_" + filename); + remove(string(path + "/" + "new_" + filename).c_str()); + } + catch(const std::exception &e) + { + cerr << e.what() << endl; + std::cout << "FAIL" << std::endl; + return false; + } int is_equal_to = doc.compare(&doc2); if (is_equal_to) { - std::cout << "=== " << filename << " passed ===" << std::endl; + std::cout << "PASS" << std::endl; return true; } else { - std::cout << "XXX " << filename << " failed XXX" << std::endl; + std::cout << "FAIL" << std::endl; return false; } } int main(int argc, char* argv[]) -{ +{ + Config::setOption("validate", false); string path = "roundtrip"; int passed = 0; int failed = 0; - + int expected = 0; + if (argc > 1) { if (roundtrip(path, string(argv[1]))) @@ -56,20 +87,47 @@ int main(int argc, char* argv[]) { DIR* valid = opendir(path.c_str()); struct dirent * file = readdir(valid); + int test_case = 0; + vector expected_fail_cases = { "SBOL1and2Test.xml", + "BBa_T9002_orig.xml", + "pIKE_pTAK_toggle_switches_orig.xml", + "partial_pIKE_left_cassette_orig.xml", + "partial_pIKE_right_casette_orig.xml", + "partial_pIKE_right_cassette_orig.xml", + "partial_pTAK_left_cassette_orig.xml", + "partial_pTAK_right_cassette_orig.xml", + "new_partial_pIKE_left_cassette_orig.xml", + "new_partial_pTAK_right_cassette_orig.xml" }; + while (file) { if (file->d_name[0] != '.') { + std::cout << "================" << std::endl; + std::cout << "TEST CASE " << test_case << " : " << file->d_name << std::endl; + std::cout << "================" << std::endl; if (roundtrip(path, file->d_name)) passed++; else - failed++; + { + if (std::find(expected_fail_cases.begin(), expected_fail_cases.end(), file->d_name) == expected_fail_cases.end()) + failed++; + else + expected++; + } + test_case++; } file = readdir(valid); } } cout << "Passed: " << passed << endl; + cout << "Expected Failures: " << expected << endl; cout << "FAILED: " << failed << endl; - + + if(failed > 0) { + return 1; + } + + return 0; } diff --git a/wrapper/CMakeLists.txt b/wrapper/CMakeLists.txt index 72b56dcb..46c1d710 100755 --- a/wrapper/CMakeLists.txt +++ b/wrapper/CMakeLists.txt @@ -17,12 +17,17 @@ IF( SWIG_FOUND ) add_definitions(-DLIBXML_STATIC -DLIBXSLT_STATIC -DCURL_STATICLIB -DCURL_STATIC) endif() + # pass definition to compiler for conditional compilation of code + if( SBOL_BUILD_MANYLINUX ) + add_definitions(-DSBOL_BUILD_MANYLINUX) + endif() + include_directories( ${SBOL_SOURCE_DIR} ${RAPTOR_INCLUDE_DIR} ${CURL_INCLUDE_DIR} ${JsonCpp_INCLUDE_DIR} - + ${OPENSSL_INCLUDE_DIR} # ${LIBXSLT_INCLUDE_DIR} # ${LIBXML2_INCLUDE_DIR} # ${LIBZ_INCLUDE_DIR} @@ -61,10 +66,16 @@ IF (SBOL_BUILD_PYTHON3) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32") # build the SWIG wrapper - SWIG_ADD_LIBRARY( libsbol32_3 - LANGUAGE python - SOURCES libsbol.i ) - + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol32_3 + python + libsbol.i ) + else () + SWIG_ADD_LIBRARY( libsbol32_3 + LANGUAGE python + SOURCES libsbol.i ) + endif() + # Do not link in the Python libraries on MacOSX.... if(SBOL_BUILD_SHARED) swig_link_libraries( libsbol32_3 @@ -111,9 +122,15 @@ IF (SBOL_BUILD_PYTHON3) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m64") # build the SWIG wrapper - SWIG_ADD_LIBRARY( libsbol64_3 - LANGUAGE python - SOURCES libsbol.i ) + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol64_3 + python + libsbol.i ) + else () + SWIG_ADD_LIBRARY( libsbol64_3 + LANGUAGE python + SOURCES libsbol.i ) + endif() # Do not link in the Python libraries on MacOSX.... if(SBOL_BUILD_SHARED) @@ -157,13 +174,19 @@ IF (SBOL_BUILD_PYTHON3) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") ##### Python 3 for Linux 32x ##### if (SBOL_BUILD_32) - set(PYSBOL_TARGET_DIR "sbol") + set(PYSBOL_TARGET_DIR "Linux_32_3/sbol") # target directory is synced with target directory for setup.py script set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32") # build the SWIG wrapper - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol + LANGUAGE python + SOURCES libsbol.i ) + endif() if(SBOL_BUILD_SHARED) swig_link_libraries( libsbol @@ -177,40 +200,50 @@ IF (SBOL_BUILD_PYTHON3) ${PYTHON_LIBRARIES} ${RAPTOR_LIBRARY} ${CURL_LIBRARY} + ${OPENSSL_LIBRARY} # linux only + ${CRYPTO_LIBRARY} # linux only ${LIBXSLT_LIBRARIES} sbol32) ENDIF() # Move target to a new directory and rename it, so the SWIG libraries can be directly copied into the pySBOL project - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) set_target_properties(_libsbol PROPERTIES OUTPUT_NAME "_libsbol") add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol POST_BUILD + COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND mv ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND mv ${CMAKE_SWIG_OUTDIR}/libsbol* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) endif() ##### Python 3 for Linux 64x ##### if(SBOL_BUILD_64) - set(PYSBOL_TARGET_DIR "sbol") + set(PYSBOL_TARGET_DIR "Linux_64_3/sbol") # target directory is synced with target directory for setup.py script set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m64") # build the SWIG wrapper - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol + LANGUAGE python + SOURCES libsbol.i ) + endif() if(SBOL_BUILD_SHARED) swig_link_libraries( libsbol @@ -224,41 +257,53 @@ IF (SBOL_BUILD_PYTHON3) ${PYTHON_LIBRARIES} ${RAPTOR_LIBRARY} ${CURL_LIBRARY} + ${OPENSSL_LIBRARY} # linux only + ${CRYPTO_LIBRARY} # linux only ${LIBXSLT_LIBRARIES} sbol64) ENDIF() - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) set_target_properties(_libsbol PROPERTIES OUTPUT_NAME "_libsbol") add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND mv ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol POST_BUILD + COMMAND mv ${CMAKE_SWIG_OUTDIR}/libsbol* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) endif() else() ##### Python 3 for Windows 32x ##### include_directories( ${JSONCPP_INCLUDE_DIR}/..) include_directories( ${CURL_INCLUDE_DIR}/..) if (SBOL_BUILD_32) - set(PYSBOL_TARGET_DIR "Win_32_3") + set(PYSBOL_TARGET_DIR "Win_32_3/sbol") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) - swig_link_libraries( libsbol + + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol32_3 + LANGUAGE python + SOURCES libsbol.i ) + endif() + + swig_link_libraries( libsbol32_3 ${raptor2} ${PYTHON_LIBRARIES} ${curl} @@ -268,33 +313,48 @@ IF (SBOL_BUILD_PYTHON3) ${jsoncpp} ${LIBXSLT_LIBRARIES} sbol32) - file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}") - set_target_properties(_libsbol PROPERTIES OUTPUT_NAME "${PYSBOL_TARGET_DIR}/sbol/_libsbol") - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/__init__.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/sbol.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/CRISPR_example.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/crispr_example.xml) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/unit_tests.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/test) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/libsbol.py) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/_libsbol.pyd) + set_target_properties(_libsbol32_3 PROPERTIES OUTPUT_NAME "_libsbol") + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol32_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol32_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbol.py) + add_custom_command(TARGET _libsbol32_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbolPYTHON_wrap.cxx) + add_custom_command(TARGET _libsbol32_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SWIG_OUTDIR}/Release) endif() ##### Python 3 for Windows 64x ##### if (SBOL_BUILD_64) - set(PYSBOL_TARGET_DIR "Win_64_3") + set(PYSBOL_TARGET_DIR "Win_64_3/sbol") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) - swig_link_libraries( libsbol + + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol64_3 + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol64_3 + LANGUAGE python + SOURCES libsbol.i ) + endif() + + swig_link_libraries( libsbol64_3 ${raptor2} ${PYTHON_LIBRARIES} ${curl} @@ -304,24 +364,32 @@ IF (SBOL_BUILD_PYTHON3) ${jsoncpp} ${LIBXSLT_LIBRARIES} sbol64) - file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}") - set_target_properties(_libsbol PROPERTIES OUTPUT_NAME "${PYSBOL_TARGET_DIR}/sbol/_libsbol") - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/__init__.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/sbol.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/CRISPR_example.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/crispr_example.xml) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/unit_tests.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/test) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/libsbol.py) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/_libsbol.pyd) + + set_target_properties(_libsbol64_3 PROPERTIES OUTPUT_NAME "_libsbol") + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol64_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol64_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbol.py) + add_custom_command(TARGET _libsbol64_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbolPYTHON_wrap.cxx) + add_custom_command(TARGET _libsbol64_3 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SWIG_OUTDIR}/Release) endif() endif() endif() @@ -340,7 +408,7 @@ endif() #unset(PYTHON_INCLUDE_PATH ) IF (SBOL_BUILD_PYTHON2) - find_package( PythonLibs 2 EXACT) + find_package( PythonLibs 2) message( "FOUND PYTHON = ${PYTHONLIBS_FOUND} at ${PYTHON_LIBRARIES}") message( "PYTHON INCLUDE DIRS = ${PYTHON_INCLUDE_DIRS}") @@ -356,9 +424,15 @@ IF (SBOL_BUILD_PYTHON2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32") # build the SWIG wrapper - SWIG_ADD_LIBRARY( libsbol32_2 - LANGUAGE python - SOURCES libsbol.i ) + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol32_2 + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol32_2 + LANGUAGE python + SOURCES libsbol.i ) + endif() # Do not link in the Python libraries on MacOSX.... if(SBOL_BUILD_SHARED) @@ -406,9 +480,15 @@ IF (SBOL_BUILD_PYTHON2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m64") # build the SWIG wrapper - SWIG_ADD_LIBRARY( libsbol64_2 - LANGUAGE python - SOURCES libsbol.i ) + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol64_2 + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol64_2 + LANGUAGE python + SOURCES libsbol.i ) + endif() # Do not link in the Python libraries on MacOSX.... if(SBOL_BUILD_SHARED) @@ -452,11 +532,19 @@ IF (SBOL_BUILD_PYTHON2) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") ##### Python 2 for Linux 32x ###### if (SBOL_BUILD_32) - set(PYSBOL_TARGET_DIR "sbol") + set(PYSBOL_TARGET_DIR "Linux_32_2/sbol") # target directory is synced with target directory for setup.py script set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32") - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) + + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol + LANGUAGE python + SOURCES libsbol.i ) + endif() + if(SBOL_BUILD_SHARED) swig_link_libraries( libsbol ${PYTHON_LIBRARIES} @@ -469,37 +557,49 @@ IF (SBOL_BUILD_PYTHON2) ${PYTHON_LIBRARIES} ${RAPTOR_LIBRARY} ${CURL_LIBRARY} + ${OPENSSL_LIBRARY} # linux only + ${CRYPTO_LIBRARY} # linux only ${LIBXSLT_LIBRARIES} sbol32) ENDIF() - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) set_target_properties(_libsbol PROPERTIES OUTPUT_NAME "_libsbol") add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol POST_BUILD + COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND mv ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND mv ${CMAKE_SWIG_OUTDIR}/libsbol* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) endif() ##### Python 2 for Linux 64x ###### if (SBOL_BUILD_64) - set(PYSBOL_TARGET_DIR "sbol") + set(PYSBOL_TARGET_DIR "Linux_64_2/sbol") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m64") - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) + + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol + LANGUAGE python + SOURCES libsbol.i ) + endif() + if(SBOL_BUILD_SHARED) swig_link_libraries( libsbol ${PYTHON_LIBRARIES} @@ -512,41 +612,53 @@ IF (SBOL_BUILD_PYTHON2) ${PYTHON_LIBRARIES} ${RAPTOR_LIBRARY} ${CURL_LIBRARY} + ${OPENSSL_LIBRARY} # linux only + ${CRYPTO_LIBRARY} # linux only ${LIBXSLT_LIBRARIES} sbol64) ENDIF() - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) set_target_properties(_libsbol PROPERTIES OUTPUT_NAME "_libsbol") add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/test) + COMMAND cp -r ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite/* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol POST_BUILD + COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND mv ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) add_custom_command(TARGET _libsbol POST_BUILD - COMMAND cp -r ${CMAKE_SWIG_OUTDIR}/_libsbol.so ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) + COMMAND mv ${CMAKE_SWIG_OUTDIR}/libsbol* ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) endif() else() ##### Python 2 for Win 32x ###### include_directories( ${JSONCPP_INCLUDE_DIR}/..) include_directories( ${CURL_INCLUDE_DIR}/..) if (SBOL_BUILD_32) - set(PYSBOL_TARGET_DIR "Win_32_2") + set(PYSBOL_TARGET_DIR "Win_32_2/sbol") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) - swig_link_libraries( libsbol + + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol32_2 + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol32_2 + LANGUAGE python + SOURCES libsbol.i ) + endif() + + swig_link_libraries( libsbol32_2 ${raptor2} ${PYTHON_LIBRARIES} ${curl} @@ -556,32 +668,49 @@ IF (SBOL_BUILD_PYTHON2) ${jsoncpp} ${LIBXSLT_LIBRARIES} sbol32) - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/__init__.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/sbol.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/CRISPR_example.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/crispr_example.xml) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/unit_tests.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/test) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/libsbol.py) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/_libsbol.pyd) - endif() + + set_target_properties(_libsbol32_2 PROPERTIES OUTPUT_NAME "_libsbol") + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol32_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol32_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol32_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbol.py) + add_custom_command(TARGET _libsbol32_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbolPYTHON_wrap.cxx) + add_custom_command(TARGET _libsbol32_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SWIG_OUTDIR}/Release) + endif() ##### Python 2 for Win 64x ###### if (SBOL_BUILD_64) - set(PYSBOL_TARGET_DIR "Win_64_2") + set(PYSBOL_TARGET_DIR "Win_64_2/sbol") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - SWIG_ADD_LIBRARY( libsbol - LANGUAGE python - SOURCES libsbol.i ) - swig_link_libraries( libsbol + + if (${CMAKE_VERSION} VERSION_LESS "3.8.0") + swig_add_module( libsbol64_2 + python + libsbol.i ) + else() + SWIG_ADD_LIBRARY( libsbol64_2 + LANGUAGE python + SOURCES libsbol.i ) + endif() + + swig_link_libraries( libsbol64_2 ${raptor2} ${PYTHON_LIBRARIES} ${curl} @@ -591,25 +720,37 @@ IF (SBOL_BUILD_PYTHON2) ${jsoncpp} ${LIBXSLT_LIBRARIES} sbol64) - file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/__init__.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/sbol.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/CRISPR_example.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/crispr_example.xml) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/unit_tests.py) - add_custom_command(TARGET _libsbol PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/test) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/libsbol.py) - add_custom_command(TARGET _libsbol POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_INSTALL_PREFIX}/wrapper/${PYSBOL_TARGET_DIR}/sbol/_libsbol.pyd) + + set_target_properties(_libsbol64_2 PROPERTIES OUTPUT_NAME "_libsbol") + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol64_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CRISPR_example.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crispr_example.xml ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test/SBOLTestSuite ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}/test) + add_custom_command(TARGET _libsbol64_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/libsbol.py ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SWIG_OUTDIR}/Release/_libsbol.pyd ${CMAKE_SWIG_OUTDIR}/${PYSBOL_TARGET_DIR}) + add_custom_command(TARGET _libsbol64_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbol.py) + add_custom_command(TARGET _libsbol64_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SWIG_OUTDIR}/libsbolPYTHON_wrap.cxx) + add_custom_command(TARGET _libsbol64_2 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SWIG_OUTDIR}/Release) endif() endif() + if(SBOL_BUILD_MANYLINUX) + set_target_properties(_libsbol PROPERTIES LINK_FLAGS "-Wl,-lrt") + endif(SBOL_BUILD_MANYLINUX) endif() diff --git a/wrapper/__init__.py b/wrapper/__init__.py index be5b7123..5249eb0d 100644 --- a/wrapper/__init__.py +++ b/wrapper/__init__.py @@ -1,6 +1,7 @@ from __future__ import absolute_import -__version__ = '2.3.0' +__version__ = '2.3.1' +__commit__ = 'a336cfebcf174dbf875452098e46bc6f8b78888a' -from sbol.libsbol import * +from sbol.sbol import * import sbol.unit_tests diff --git a/wrapper/assembly_example.py b/wrapper/assembly_example.py new file mode 100644 index 00000000..9c3bc5f4 --- /dev/null +++ b/wrapper/assembly_example.py @@ -0,0 +1,43 @@ +from sbol import * + +setHomespace('http://sys-bio.org') +doc = Document() + +gene = ComponentDefinition('gene_example') +promoter = ComponentDefinition('R0010') +CDS = ComponentDefinition('B0032') +RBS = ComponentDefinition('E0040') +terminator = ComponentDefinition('B0012') + +promoter.roles = SO_PROMOTER +CDS.roles = SO_CDS +RBS.roles = SO_RBS +terminator.roles = SO_TERMINATOR + +doc.addComponentDefinition(gene) +doc.addComponentDefinition([promoter, CDS, RBS, terminator]) + +gene.assemblePrimaryStructure([ promoter, RBS, CDS, terminator ]) + +first = gene.getFirstComponent() +print(first.identity) +last = gene.getLastComponent() +print(last.identity) + +promoter.sequence = Sequence('R0010', 'ggctgca') +CDS.sequence = Sequence('B0032', 'aattatataaa') +RBS.sequence = Sequence('E0040', 'atgtaa') +terminator.sequence = Sequence('B0012', 'attcga') +gene.sequence = Sequence('BB001') + +gene_seq = doc.sequences['BB001'] +gene_seq.compile() + +print(doc.sequences['R0010'].elements) +print(doc.sequences['B0032'].elements) +print(doc.sequences['E0040'].elements) +print(doc.sequences['B0012'].elements) +print(gene_seq.elements) + +result = doc.write('gene_cassette.xml') +print(result) diff --git a/wrapper/libsbol.i b/wrapper/libsbol.i index 392dab23..d759c5eb 100644 --- a/wrapper/libsbol.i +++ b/wrapper/libsbol.i @@ -1,126 +1,128 @@ %module libsbol %{ - #define SWIG_FILE_WITH_INIT - - // Headers are listed in strict order of dependency - #include "constants.h" - #include "sbolerror.h" - #include "config.h" - #include "validation.h" - #include "property.h" - #include "properties.h" - #include "object.h" - #include "identified.h" - #include "toplevel.h" - #include "sequenceannotation.h" - #include "component.h" - #include "componentdefinition.h" - #include "sequence.h" - #include "document.h" - #include "interaction.h" - #include "participation.h" - #include "location.h" - #include "sequenceconstraint.h" - #include "moduledefinition.h" - #include "module.h" - - #include "mapsto.h" - #include "model.h" - #include "collection.h" - #include "provo.h" - #include "partshop.h" - #include "combinatorialderivation.h" - #include "dbtl.h" - #include "attachment.h" - #include "implementation.h" - #include "sbol.h" - - #include - #include - #include - - using namespace sbol; - using namespace std; - + #define SWIG_FILE_WITH_INIT + + // Headers are listed in strict order of dependency + #include "constants.h" + #include "sbolerror.h" + #include "config.h" + #include "validation.h" + #include "property.h" + #include "properties.h" + #include "object.h" + #include "identified.h" + #include "toplevel.h" + #include "sequenceannotation.h" + #include "component.h" + #include "componentdefinition.h" + #include "sequence.h" + #include "document.h" + #include "interaction.h" + #include "participation.h" + #include "location.h" + #include "sequenceconstraint.h" + #include "moduledefinition.h" + #include "module.h" + + #include "mapsto.h" + #include "model.h" + #include "collection.h" + #include "provo.h" + #include "partshop.h" + #include "combinatorialderivation.h" + #include "dbtl.h" + #include "attachment.h" + #include "implementation.h" + #include "sbol.h" + + #include + #include + #include + + using namespace sbol; + using namespace std; + %} %include "python_docs.i" #ifdef SWIGWIN - %include + %include #endif // I was never successful in getting typemap(in) to convert a Python list argument into C++ types, so I hacked these helper functions to perform the conversion %{ - std::vector convert_list_to_string_vector(PyObject *list) - { - if (!PyList_Check(list)) - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "First argument must be a List of ComponentDefinition objects or Strings containing their displayIds"); - if (PyList_Size(list) == 0) - return {}; - PyObject *obj = PyList_GetItem(list, 0); - std::vector list_of_cpp_strings; - if (PyUnicode_Check(obj)) - { - // Convert Python 3 strings - for (int i = 0; i < PyList_Size(list); ++i) - { - obj = PyList_GetItem(list, i); - PyObject* bytes = PyUnicode_AsUTF8String(obj); - std::string cpp_string = PyBytes_AsString(bytes); - list_of_cpp_strings.push_back(cpp_string); - } - } - else if (PyBytes_Check(obj)) - { - // Convert Python 2 strings - for (int i = 0; i < PyList_Size(list); ++i) - { - obj = PyList_GetItem(list, i); - std::string cpp_string = PyBytes_AsString(obj); - list_of_cpp_strings.push_back(cpp_string); - } - } - return list_of_cpp_strings; - } - - std::vector convert_list_to_cdef_vector(PyObject *list) - { - if (!PyList_Check(list)) - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "First argument must be a List of ComponentDefinition objects or Strings containing their displayIds"); - if (PyList_Size(list) == 0) - return {}; - PyObject *obj; - std::vector list_of_cdefs = {}; - sbol::ComponentDefinition* cd; - for (int i = 0; i < PyList_Size(list); ++i) - { - obj = PyList_GetItem(list, i); - if ((SWIG_ConvertPtr(obj,(void **) &cd, SWIG_TypeQuery("sbol::ComponentDefinition*"),1)) == -1) break; - list_of_cdefs.push_back(cd); - } - return list_of_cdefs; - } - - std::vector convert_list_to_identified_vector(PyObject *list) - { - if (!PyList_Check(list)) - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "First argument must be a List of ComponentDefinition objects or Strings containing their displayIds"); - if (PyList_Size(list) == 0) - return {}; - PyObject *py_obj = PyList_GetItem(list, 0); - std::vector identified_vector = {}; - sbol::Identified* sbol_obj; - if (SWIG_IsOK(SWIG_ConvertPtr(py_obj,(void **) &sbol_obj, SWIG_TypeQuery("sbol::Identified*"),1))) - { - for (int i = 0; i < PyList_Size(list); ++i) - { - py_obj = PyList_GetItem(list, i); - if ((SWIG_ConvertPtr(py_obj,(void **) &sbol_obj, SWIG_TypeQuery("sbol::Identified*"),1)) == -1) throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Usages must be a valid SBOL object");; - identified_vector.push_back(sbol_obj); - } - } - return identified_vector; - } + std::vector convert_list_to_string_vector(PyObject *list) + { + if (!PyList_Check(list)) + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "First argument must be a List of ComponentDefinition objects or Strings containing their displayIds"); + if (PyList_Size(list) == 0) + return {}; + PyObject *obj = PyList_GetItem(list, 0); + std::vector list_of_cpp_strings; + if (PyUnicode_Check(obj)) + { + // Convert Python 3 strings + for (int i = 0; i < PyList_Size(list); ++i) + { + obj = PyList_GetItem(list, i); + PyObject* bytes = PyUnicode_AsUTF8String(obj); + std::string cpp_string = PyBytes_AsString(bytes); + list_of_cpp_strings.push_back(cpp_string); + } + } + else if (PyBytes_Check(obj)) + { + // Convert Python 2 strings + for (int i = 0; i < PyList_Size(list); ++i) + { + obj = PyList_GetItem(list, i); + std::string cpp_string = PyBytes_AsString(obj); + list_of_cpp_strings.push_back(cpp_string); + } + } + return list_of_cpp_strings; + } + + std::vector convert_list_to_cdef_vector(PyObject *list) + { + if (!PyList_Check(list)) + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "First argument must be a List of ComponentDefinition objects or Strings containing their displayIds"); + if (PyList_Size(list) == 0) + return {}; + PyObject *obj; + std::vector list_of_cdefs = {}; + sbol::ComponentDefinition* cd; + for (int i = 0; i < PyList_Size(list); ++i) + { + obj = PyList_GetItem(list, i); + if ((SWIG_ConvertPtr(obj,(void **) &cd, SWIG_TypeQuery("sbol::ComponentDefinition*"),1)) == -1) break; + list_of_cdefs.push_back(cd); + } + return list_of_cdefs; + } + + std::vector convert_list_to_identified_vector(PyObject *list) + { + if (!PyList_Check(list)) + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "First argument must be a List of ComponentDefinition objects or Strings containing their displayIds"); + if (PyList_Size(list) == 0) + return {}; + PyObject *py_obj = PyList_GetItem(list, 0); + std::vector identified_vector = {}; + sbol::Identified* sbol_obj; + if (SWIG_IsOK(SWIG_ConvertPtr(py_obj,(void **) &sbol_obj, SWIG_TypeQuery("sbol::Identified*"),1))) + { + for (int i = 0; i < PyList_Size(list); ++i) + { + py_obj = PyList_GetItem(list, i); + if ((SWIG_ConvertPtr(py_obj,(void **) &sbol_obj, SWIG_TypeQuery("sbol::Identified*"),1)) == -1) + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Usages must be a valid SBOL object");; + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + identified_vector.push_back(sbol_obj); + } + } + return identified_vector; + } %} @@ -129,66 +131,66 @@ // General error handling and mapping of libSBOL exception types to Python exception types %exception { - try - { - $function - } - catch(SBOLError e) - { - if (e.error_code() == SBOL_ERROR_NOT_FOUND) - { - PyErr_SetString(PyExc_LookupError, e.what()); - } - else if (e.error_code() == SBOL_ERROR_INVALID_ARGUMENT || e.error_code() == SBOL_ERROR_MISSING_DOCUMENT) - { - PyErr_SetString(PyExc_ValueError, e.what()); - } - else if (e.error_code() == SBOL_ERROR_TYPE_MISMATCH) - { - PyErr_SetString(PyExc_TypeError, e.what()); - } - else if (e.error_code() == SBOL_ERROR_FILE_NOT_FOUND) - { - PyErr_SetString(PyExc_IOError, e.what()); - } - else - { - PyErr_SetString(PyExc_RuntimeError, e.what()); - } - return NULL; - } - catch(...) - { - PyErr_SetString(PyExc_RuntimeError, "An error of unspecified type occurred"); - } + try + { + $function + } + catch(SBOLError e) + { + if (e.error_code() == SBOL_ERROR_NOT_FOUND) + { + PyErr_SetString(PyExc_LookupError, e.what()); + } + else if (e.error_code() == SBOL_ERROR_INVALID_ARGUMENT || e.error_code() == SBOL_ERROR_MISSING_DOCUMENT) + { + PyErr_SetString(PyExc_ValueError, e.what()); + } + else if (e.error_code() == SBOL_ERROR_TYPE_MISMATCH) + { + PyErr_SetString(PyExc_TypeError, e.what()); + } + else if (e.error_code() == SBOL_ERROR_FILE_NOT_FOUND) + { + PyErr_SetString(PyExc_IOError, e.what()); + } + else + { + PyErr_SetString(PyExc_RuntimeError, e.what()); + } + return NULL; + } + catch(...) + { + PyErr_SetString(PyExc_RuntimeError, "An error of unspecified type occurred"); + } } // Catch the signal from the Python interpreter indicating that iteration has reached end of list. For Python 2 %exception next { - try - { - $action - } - catch(SBOLError e) - { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } + try + { + $action + } + catch(SBOLError e) + { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } } // Catch the signal from the Python interpreter indicating that iteration has reached end of list. For Python 3 %exception __next__ { - try - { - $action - } - catch(SBOLError e) - { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } + try + { + $action + } + catch(SBOLError e) + { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } } // Hide these methods in the Python API @@ -218,46 +220,49 @@ %ignore sbol::ComponentDefinition::assemble(std::vector list_of_uris, Document& doc); // Use variant signature defined in this interface file %ignore sbol::ComponentDefinition::assemble(std::vector list_of_uris); // Use variant signature defined in this interface file %ignore sbol::ComponentDefinition::linearize(std::vector list_of_uris); // Use variant signature defined in this interface file +%ignore sbol::ComponentDefinition::assemblePrimaryStructure(std::vector primary_structure); +%ignore sbol::ComponentDefinition::assemblePrimaryStructure(std::vector primary_structure, Document& doc); +%ignore sbol::ComponentDefinition::assemblePrimaryStructure(std::vector primary_structure); %ignore sbol::TopLevel::addToDocument; // Instantiate STL templates %include "std_string.i" %include "std_vector.i" %include "std_map.i" - +#include // This typemap is here in order to convert the return type of ComponentDefinition::getPrimaryStructure into a Python list. (The typemaps defined later in this file work on other methods, but did not work on this method specifically) %typemap(out) std::vector < sbol::ComponentDefinition* > { - int len = $1.size(); - PyObject* list = PyList_New(0); - for(auto i_elem = $1.begin(); i_elem != $1.end(); i_elem++) - { - ComponentDefinition* cd = *i_elem; - PyObject *elem = SWIG_NewPointerObj(SWIG_as_voidptr(*i_elem), $descriptor(sbol::ComponentDefinition*), 0 | 0 ); - PyList_Append(list, elem); - } - $result = list; - $1.clear(); - PyErr_Clear(); + int len = $1.size(); + PyObject* list = PyList_New(0); + for(auto i_elem = $1.begin(); i_elem != $1.end(); i_elem++) + { + ComponentDefinition* cd = *i_elem; + PyObject *elem = SWIG_NewPointerObj(SWIG_as_voidptr(*i_elem), $descriptor(sbol::ComponentDefinition*), 0 | 0 ); + PyList_Append(list, elem); + } + $result = list; + $1.clear(); + PyErr_Clear(); } // Typemap the hash table returned by Analysis::report methods %typemap(out) std::unordered_map < std::string, std::tuple < int, int, float > > { - int len = $1.size(); - PyObject* dict = PyDict_New(); - for(auto & i_elem : $1) - { - std::tuple < int, int, float > vals = i_elem.second; - int range_start = std::get<0>(vals); - int range_end = std::get<1>(vals); - float qc_stat = std::get<2>(vals); - PyObject* py_vals = Py_BuildValue("iif", range_start, range_end, qc_stat); - PyDict_SetItemString(dict, i_elem.first.c_str(), py_vals); - } - $result = dict; - $1.clear(); - + int len = $1.size(); + PyObject* dict = PyDict_New(); + for(auto & i_elem : $1) + { + std::tuple < int, int, float > vals = i_elem.second; + int range_start = std::get<0>(vals); + int range_end = std::get<1>(vals); + float qc_stat = std::get<2>(vals); + PyObject* py_vals = Py_BuildValue("iif", range_start, range_end, qc_stat); + PyDict_SetItemString(dict, i_elem.first.c_str(), py_vals); + } + $result = dict; + $1.clear(); + } %template(_IntVector) std::vector; @@ -280,39 +285,39 @@ %pythonappend add %{ - try: - sbol_obj.thisown = False - except NameError: - try: - if not type(args[0]) == str: - args[0].thisown = False - except NameError: - pass + try: + sbol_obj.thisown = False + except NameError: + try: + if not type(args[0]) == str: + args[0].thisown = False + except NameError: + pass %} %pythonappend set %{ - try: - sbol_obj.thisown = False - except NameError: - try: - if not type(args[0]) == str: - args[0].thisown = False - except NameError: - pass + try: + sbol_obj.thisown = False + except NameError: + try: + if not type(args[0]) == str: + args[0].thisown = False + except NameError: + pass %} - + %pythonappend create %{ - val.thisown = False + val.thisown = False %} - + // verifyTarget acts like a setter %pythonappend verifyTarget %{ - consensus_sequence.thisown = False + consensus_sequence.thisown = False %} - + /* @TODO remove methods should change thisown flag back to True */ /* Currently this causes an exception (probably need a call to Py_INCREF */ //%pythonprepend remove @@ -321,10 +326,10 @@ // obj = self.get(args[0]) // obj.thisown = True //%} - + %pythonappend getAll %{ - val = list(val) + val = list(val) %} //%pythonappend addToDocument @@ -332,8 +337,8 @@ // print("Adding to Document") // arg2.thisown = False //%} - - + + %include "properties.h" %include "object.h" %include "identified.h" @@ -356,45 +361,26 @@ %include "attachment.h" %include "implementation.h" %include "dbtl.h" +%include "experiment.h" -// Converts json-formatted text into Python data structures, eg, lists, dictionaries -%pythonappend sbol::PartShop::search -%{ - if val[0] == '[' : - exec('val = ' + val) - return val - else : - return val -%} -// -//// Converts json-formatted text into Python data structures, eg, lists, dictionaries -%pythonappend sbol::PartShop::submit -%{ - if val[0] == '[' : - exec('val = ' + val) - return val - else : - return val -%} %pythonappend sbol::PartShop::searchRootCollections %{ - true = True - false = False - exec('val = ' + val) - return val + return json.loads(val) %} %pythonappend sbol::PartShop::searchSubCollections %{ - true = True - false = False - exec('val = ' + val) - return val + return json.loads(val) %} - + +%pythonappend sbol::PartShop::sparqlQuery +%{ + return json.loads(val) +%} + %include "partshop.h" - + %include "document.h" typedef std::string sbol::sbol_type; @@ -402,104 +388,113 @@ typedef std::string sbol::sbol_type; /* This macro is used to instantiate container properties (OwnedObjects) that can contain more than one type of object, eg, SequenceAnnotation::locations */ %define TEMPLATE_MACRO_0(SBOLClass) // %template(add ## SBOLClass) sbol::OwnedObject::add; - %template(create ## SBOLClass) sbol::OwnedObject::create; - %template(get ## SBOLClass) sbol::OwnedObject::get; - + %template(create ## SBOLClass) sbol::OwnedObject::create; + %template(get ## SBOLClass) sbol::OwnedObject::get; + %enddef /* This macro is used to instantiate container properties (OwnedObjects) that can contain a single type of object, eg, ComponentDefinition::sequenceAnnotations */ %define TEMPLATE_MACRO_1(SBOLClass) - - /* Convert C++ vector of pointers --> Python list */ - %typemap(out) std::vector { - int len = $1.size(); - PyObject* list = PyList_New(0); - for(auto i_elem = $1.begin(); i_elem != $1.end(); i_elem++) - { - PyObject *elem = SWIG_NewPointerObj(SWIG_as_voidptr(*i_elem), $descriptor(sbol::SBOLClass*), 0 | 0 ); - PyList_Append(list, elem); - } - $result = list; - $1.clear(); - } - - %extend sbol::OwnedObject - { - PyObject* __getitem__(const int nIndex) - { - SBOLClass& obj = $self->operator[](nIndex); - PyObject *py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::SBOLClass*), 0 | 0 ); - return py_obj; - } - - PyObject* __getitem__(const std::string uri) - { - SBOLClass& obj = $self->operator[](uri); - PyObject *py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::SBOLClass*), 0 | 0 ); - return py_obj; - } - - void __setitem__(const std::string uri, PyObject* py_obj) - { - sbol:: SBOLClass* obj; - if ((SWIG_ConvertPtr(py_obj,(void **) &obj, $descriptor(sbol:: SBOLClass *),1)) == -1) throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Invalid object type for this property"); - $self->add(*obj); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - if (uri == obj->identity.get() || uri == obj->displayId.get()) - return; - else - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add " + parseClassName(obj->type) + ". The given URIs do not match"); - } - } - - /* Instantiate templates */ - %template(SBOLClass ## Vector) std::vector; - %template(SBOLClass ## Property) sbol::Property; - %template(Owned ## SBOLClass) sbol::OwnedObject; + + /* Convert C++ vector of pointers --> Python list */ + %typemap(out) std::vector { + int len = $1.size(); + PyObject* list = PyList_New(0); + for(auto i_elem = $1.begin(); i_elem != $1.end(); i_elem++) + { + PyObject *elem = SWIG_NewPointerObj(SWIG_as_voidptr(*i_elem), $descriptor(sbol::SBOLClass*), 0 | 0 ); + PyList_Append(list, elem); + } + $result = list; + $1.clear(); + } + + %extend sbol::OwnedObject + { + PyObject* __getitem__(const int nIndex) + { + SBOLClass& obj = $self->operator[](nIndex); + PyObject *py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::SBOLClass*), 0 | 0 ); + return py_obj; + } + + PyObject* __getitem__(const std::string uri) + { + SBOLClass& obj = $self->operator[](uri); + PyObject *py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::SBOLClass*), 0 | 0 ); + return py_obj; + } + + void __setitem__(const std::string uri, PyObject* py_obj) + { + sbol:: SBOLClass* obj; + if ((SWIG_ConvertPtr(py_obj,(void **) &obj, $descriptor(sbol:: SBOLClass *),1)) == -1) throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Invalid object type for this property"); + $self->add(*obj); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + if (uri == obj->identity.get() || uri == obj->displayId.get()) + return; + else + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add " + parseClassName(obj->type) + ". The given URIs do not match"); + } + + bool __contains__(const std::string uri) + { + if ($self->find(uri)) + return true; + else + return false; + } + + } + + /* Instantiate templates */ + %template(SBOLClass ## Vector) std::vector; + %template(SBOLClass ## Property) sbol::Property; + %template(Owned ## SBOLClass) sbol::OwnedObject; %enddef /* This macro is used to instantiate special adders and getters for the Document class */ %define TEMPLATE_MACRO_2(SBOLClass) - %extend sbol::SBOLClass - { - SBOLClass& copy(Document* target_doc = NULL, std::string ns = "", std::string version = "") - { - return $self->copy < SBOLClass >(target_doc, ns, version); - } - } - - %pythonappend add ## SBOLClass - %{ - if type(args[0]) is list: - for obj in args[0]: - obj.thisown = False - else: - args[0].thisown = False - %} - - %template(add ## SBOLClass) sbol::Document::add; - %template(get ## SBOLClass) sbol::Document::get; - %extend sbol::Document - { - void add ## SBOLClass(PyObject *list) - { - std::vector list_of_cds = {}; - if (PyList_Check(list)) - { - for (int i = 0; i < PyList_Size(list); ++i) - { - PyObject *obj = PyList_GetItem(list, i); - sbol:: SBOLClass * cd; - if ((SWIG_ConvertPtr(obj,(void **) &cd, $descriptor(sbol:: SBOLClass *),1)) == -1) throw; - list_of_cds.push_back(cd); - } - $self->add(list_of_cds); - }; - } - } - + %extend sbol::SBOLClass + { + SBOLClass& copy(Document* target_doc = NULL, std::string ns = "", std::string version = "") + { + return $self->copy < SBOLClass >(target_doc, ns, version); + } + } + + %pythonappend add ## SBOLClass + %{ + if type(args[0]) is list: + for obj in args[0]: + obj.thisown = False + else: + args[0].thisown = False + %} + + %template(add ## SBOLClass) sbol::Document::add; + %template(get ## SBOLClass) sbol::Document::get; + %extend sbol::Document + { + void add ## SBOLClass(PyObject *list) + { + std::vector list_of_cds = {}; + if (PyList_Check(list)) + { + for (int i = 0; i < PyList_Size(list); ++i) + { + PyObject *obj = PyList_GetItem(list, i); + sbol:: SBOLClass * cd; + if ((SWIG_ConvertPtr(obj,(void **) &cd, $descriptor(sbol:: SBOLClass *),1)) == -1) throw; + list_of_cds.push_back(cd); + } + $self->add(list_of_cds); + }; + } + } + %enddef /* This macro is used to create a Pythonic interface to object attributes */ @@ -508,198 +503,206 @@ typedef std::string sbol::sbol_type; %pythoncode { - def __getattribute__(self,name): - if name in object.__getattribute__(self, '__swig_getmethods__').keys(): - sbol_attribute = object.__getattribute__(self, name) - if not 'Owned' in sbol_attribute.__class__.__name__: - if sbol_attribute.getUpperBound() != '1': - return sbol_attribute.getAll() - else: - try: - return sbol_attribute.get() - except LookupError: - return None - return None - elif sbol_attribute.getUpperBound() == '1': - try: - return sbol_attribute.get() - except: - return None - return object.__getattribute__(self, name) - - __setattribute__ = __setattr__ - - def __setattr__(self,name, value): - if name in object.__getattribute__(self, '__swig_setmethods__').keys(): - sbol_attribute = object.__getattribute__(self, name) - if not 'Owned' in sbol_attribute.__class__.__name__: - if value == None: - sbol_attribute.clear() - elif type(value) == list: - if sbol_attribute.getUpperBound() == '1': - raise TypeError('The ' + sbol_attribute.getTypeURI() + ' property does not accept list arguments') - sbol_attribute.clear() - for val in value: - sbol_attribute.add(val) - else: - sbol_attribute.set(value) - elif sbol_attribute.getUpperBound() == '1': - if len(sbol_attribute) > 0: - sbol_obj = sbol_attribute.get() - doc = sbol_obj.doc - sbol_attribute.remove() - if not doc: - sbol_obj.thisown = True - elif not doc.find(sbol_obj.identity): - sbol_obj.thisown = True - if not value == None: - sbol_attribute.set(value) - value.thisown = False - else: - self.__class__.__setattribute__(self, name, value) - - def __repr__(self): - return self.__class__.__name__ - + def __getattribute__(self,name): + sbol_attribute = None + if is_swig_property(self, name): + sbol_attribute = object.__getattribute__(self, name) + elif is_extension_property(self, name): + sbol_attribute = object.__getattribute__(self, '__dict__')[name] + if sbol_attribute != None: + if not 'Owned' in sbol_attribute.__class__.__name__: + if sbol_attribute.getUpperBound() != '1': + return sbol_attribute.getAll() + else: + try: + return sbol_attribute.get() + except LookupError: + return None + return None + elif sbol_attribute.getUpperBound() == '1': + try: + return sbol_attribute.get() + except: + return None + return object.__getattribute__(self, name) + + __setattribute__ = __setattr__ + + def __setattr__(self,name, value): + sbol_attribute = None + if is_swig_property(self, name): + sbol_attribute = object.__getattribute__(self, name) + elif is_extension_property(self, name): + sbol_attribute = object.__getattribute__(self, '__dict__')[name] + if sbol_attribute != None: + if not 'Owned' in sbol_attribute.__class__.__name__: + if value == None: + sbol_attribute.clear() + elif type(value) == list: + if sbol_attribute.getUpperBound() == '1': + raise TypeError('The ' + sbol_attribute.getTypeURI() + ' property does not accept list arguments') + sbol_attribute.clear() + for val in value: + sbol_attribute.add(val) + else: + sbol_attribute.set(value) + elif sbol_attribute.getUpperBound() == '1': + if len(sbol_attribute) > 0: + sbol_obj = sbol_attribute.get() + doc = sbol_obj.doc + sbol_attribute.remove() + if not doc: + sbol_obj.thisown = True + elif not doc.find(sbol_obj.identity): + sbol_obj.thisown = True + if not value == None: + sbol_attribute.set(value) + value.thisown = False + else: + self.__class__.__setattribute__(self, name, value) + + def __repr__(self): + return self.__class__.__name__ + } } %enddef - + // Dynamically type Locations %extend sbol::OwnedObject { - PyObject* __getitem__(const std::string uri) - { - Location& obj = (Location&)$self->operator[](uri); - PyObject* py_obj; - if (obj.type == SBOL_RANGE) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::Range*), 0 | 0 ); - else if (obj.type == SBOL_CUT) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::Cut*), 0 | 0 ); - else if (obj.type == SBOL_GENERIC_LOCATION) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::GenericLocation*), 0 | 0 ); - else - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::Location*), 0 | 0 ); - return py_obj; - } - - void __setitem__(const std::string uri, PyObject* py_obj) - { - Range* range; - Cut* cut; - GenericLocation* genericlocation; - Location* location; - Identified* obj; - - if ((SWIG_ConvertPtr(py_obj,(void **) &range, $descriptor(sbol::Range *),1)) != -1) - { - $self->add((Location&)*range); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)range; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &cut, $descriptor(sbol::Cut *),1)) != -1) - { - $self->add((Location&)*cut); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)cut; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &genericlocation, $descriptor(sbol::GenericLocation *),1)) != -1) - { - $self->add((Location&)*genericlocation); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)genericlocation; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &location, $descriptor(sbol::Location *),1)) != -1) - { - $self->add(*location); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)location; - } - else - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Invalid object type for this property"); - if (uri == obj->identity.get() || uri == obj->displayId.get()) - return; - else - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add " + parseClassName(obj->type) + ". The given URIs do not match"); - } + PyObject* __getitem__(const std::string uri) + { + Location& obj = (Location&)$self->operator[](uri); + PyObject* py_obj; + if (obj.type == SBOL_RANGE) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::Range*), 0 | 0 ); + else if (obj.type == SBOL_CUT) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::Cut*), 0 | 0 ); + else if (obj.type == SBOL_GENERIC_LOCATION) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::GenericLocation*), 0 | 0 ); + else + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(&obj), $descriptor(sbol::Location*), 0 | 0 ); + return py_obj; + } + + void __setitem__(const std::string uri, PyObject* py_obj) + { + Range* range; + Cut* cut; + GenericLocation* genericlocation; + Location* location; + Identified* obj; + + if ((SWIG_ConvertPtr(py_obj,(void **) &range, $descriptor(sbol::Range *),1)) != -1) + { + $self->add((Location&)*range); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)range; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &cut, $descriptor(sbol::Cut *),1)) != -1) + { + $self->add((Location&)*cut); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)cut; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &genericlocation, $descriptor(sbol::GenericLocation *),1)) != -1) + { + $self->add((Location&)*genericlocation); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)genericlocation; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &location, $descriptor(sbol::Location *),1)) != -1) + { + $self->add(*location); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)location; + } + else + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Invalid object type for this property"); + if (uri == obj->identity.get() || uri == obj->displayId.get()) + return; + else + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add " + parseClassName(obj->type) + ". The given URIs do not match"); + } } - + // Dynamically type Interactions %extend sbol::OwnedObject { - PyObject* __getitem__(const std::string uri) - { - Interaction* obj = &($self->operator[](uri)); - PyObject* py_obj; - if (dynamic_cast(obj)) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::TranscriptionalRepressionInteraction*), 0 | 0 ); - else if (dynamic_cast(obj)) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::SmallMoleculeInhibitionInteraction*), 0 | 0 ); - else if (dynamic_cast(obj)) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::GeneProductionInteraction*), 0 | 0 ); - else if (dynamic_cast(obj)) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::TranscriptionalActivationInteraction*), 0 | 0 ); - else if (dynamic_cast(obj)) - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::SmallMoleculeActivationInteraction*), 0 | 0 ); - else - py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::Interaction*), 0 | 0 ); - return py_obj; - } - - void __setitem__(const std::string uri, PyObject* py_obj) - { - TranscriptionalRepressionInteraction* transcriptionalrepressioninteraction; - SmallMoleculeInhibitionInteraction* smallmoleculeinhibitioninteraction; - GeneProductionInteraction* geneproductioninteraction; - TranscriptionalActivationInteraction* transcriptionalactivationinteraction; - SmallMoleculeActivationInteraction* smallmoleculeactivationinteraction; - Interaction* interaction; - Identified* obj; - if ((SWIG_ConvertPtr(py_obj,(void **) &transcriptionalrepressioninteraction, $descriptor(sbol::TranscriptionalRepressionInteraction *),1)) != -1) - { - $self->add((Interaction&)*transcriptionalrepressioninteraction); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)transcriptionalrepressioninteraction; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &smallmoleculeinhibitioninteraction, $descriptor(sbol::SmallMoleculeInhibitionInteraction *),1)) != -1) - { - $self->add((Interaction&)*smallmoleculeinhibitioninteraction); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)smallmoleculeinhibitioninteraction; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &geneproductioninteraction, $descriptor(sbol::GeneProductionInteraction *),1)) != -1) - { - $self->add((Interaction&)*geneproductioninteraction); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)geneproductioninteraction; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &transcriptionalactivationinteraction, $descriptor(sbol::TranscriptionalActivationInteraction *),1)) != -1) - { - $self->add((Interaction&)*transcriptionalactivationinteraction); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)transcriptionalactivationinteraction; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &smallmoleculeactivationinteraction, $descriptor(sbol::SmallMoleculeActivationInteraction *),1)) != -1) - { - $self->add((Interaction&)*smallmoleculeactivationinteraction); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)smallmoleculeactivationinteraction; - } - else if ((SWIG_ConvertPtr(py_obj,(void **) &interaction, $descriptor(sbol::Interaction *),1)) != -1) - { - $self->add((Interaction&)*interaction); - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - obj = (Identified*)interaction; - } - else - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Invalid object type for this property"); - if (uri == obj->identity.get() || uri == obj->displayId.get()) - return; - else - throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add " + parseClassName(obj->type) + ". The given URIs do not match"); - } + PyObject* __getitem__(const std::string uri) + { + Interaction* obj = &($self->operator[](uri)); + PyObject* py_obj; + if (dynamic_cast(obj)) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::TranscriptionalRepressionInteraction*), 0 | 0 ); + else if (dynamic_cast(obj)) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::SmallMoleculeInhibitionInteraction*), 0 | 0 ); + else if (dynamic_cast(obj)) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::GeneProductionInteraction*), 0 | 0 ); + else if (dynamic_cast(obj)) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::TranscriptionalActivationInteraction*), 0 | 0 ); + else if (dynamic_cast(obj)) + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::SmallMoleculeActivationInteraction*), 0 | 0 ); + else + py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::Interaction*), 0 | 0 ); + return py_obj; + } + + void __setitem__(const std::string uri, PyObject* py_obj) + { + TranscriptionalRepressionInteraction* transcriptionalrepressioninteraction; + SmallMoleculeInhibitionInteraction* smallmoleculeinhibitioninteraction; + GeneProductionInteraction* geneproductioninteraction; + TranscriptionalActivationInteraction* transcriptionalactivationinteraction; + SmallMoleculeActivationInteraction* smallmoleculeactivationinteraction; + Interaction* interaction; + Identified* obj; + if ((SWIG_ConvertPtr(py_obj,(void **) &transcriptionalrepressioninteraction, $descriptor(sbol::TranscriptionalRepressionInteraction *),1)) != -1) + { + $self->add((Interaction&)*transcriptionalrepressioninteraction); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)transcriptionalrepressioninteraction; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &smallmoleculeinhibitioninteraction, $descriptor(sbol::SmallMoleculeInhibitionInteraction *),1)) != -1) + { + $self->add((Interaction&)*smallmoleculeinhibitioninteraction); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)smallmoleculeinhibitioninteraction; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &geneproductioninteraction, $descriptor(sbol::GeneProductionInteraction *),1)) != -1) + { + $self->add((Interaction&)*geneproductioninteraction); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)geneproductioninteraction; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &transcriptionalactivationinteraction, $descriptor(sbol::TranscriptionalActivationInteraction *),1)) != -1) + { + $self->add((Interaction&)*transcriptionalactivationinteraction); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)transcriptionalactivationinteraction; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &smallmoleculeactivationinteraction, $descriptor(sbol::SmallMoleculeActivationInteraction *),1)) != -1) + { + $self->add((Interaction&)*smallmoleculeactivationinteraction); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)smallmoleculeactivationinteraction; + } + else if ((SWIG_ConvertPtr(py_obj,(void **) &interaction, $descriptor(sbol::Interaction *),1)) != -1) + { + $self->add((Interaction&)*interaction); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + obj = (Identified*)interaction; + } + else + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Invalid object type for this property"); + if (uri == obj->identity.get() || uri == obj->displayId.get()) + return; + else + throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, "Cannot add " + parseClassName(obj->type) + ". The given URIs do not match"); + } } - + // Templates used by subclasses of Location: Range, Cut, and Generic Location TEMPLATE_MACRO_0(Range); TEMPLATE_MACRO_0(Cut); @@ -707,10 +710,10 @@ TEMPLATE_MACRO_0(GenericLocation); // Templates used in SequenceAnnotation class TEMPLATE_MACRO_1(Location); - + // Templates used in Component class TEMPLATE_MACRO_1(MapsTo); - + // Templates used in ComponentDefinition class TEMPLATE_MACRO_1(SequenceConstraint); TEMPLATE_MACRO_1(SequenceAnnotation); @@ -721,12 +724,12 @@ TEMPLATE_MACRO_1(Component); // Templates used in Interaction class TEMPLATE_MACRO_1(Participation); - + // ModuleDefinition templates TEMPLATE_MACRO_1(Module); TEMPLATE_MACRO_1(Interaction); TEMPLATE_MACRO_1(FunctionalComponent); - + // Templates used in Activity class TEMPLATE_MACRO_1(Association); TEMPLATE_MACRO_1(Usage); @@ -751,7 +754,10 @@ TEMPLATE_MACRO_1(Build); TEMPLATE_MACRO_1(Test); TEMPLATE_MACRO_1(Analysis); TEMPLATE_MACRO_1(SampleRoster); +TEMPLATE_MACRO_1(Experiment); +TEMPLATE_MACRO_1(ExperimentalData); +TEMPLATE_MACRO_2(TopLevel) TEMPLATE_MACRO_2(ComponentDefinition) TEMPLATE_MACRO_2(ModuleDefinition) TEMPLATE_MACRO_2(Sequence) @@ -768,9 +774,12 @@ TEMPLATE_MACRO_2(Build); TEMPLATE_MACRO_2(Test); TEMPLATE_MACRO_2(Analysis); TEMPLATE_MACRO_2(SampleRoster); - +TEMPLATE_MACRO_2(Experiment); +TEMPLATE_MACRO_2(ExperimentalData); + TEMPLATE_MACRO_3(SBOLObject) TEMPLATE_MACRO_3(Identified) +TEMPLATE_MACRO_3(TopLevel) TEMPLATE_MACRO_3(ComponentDefinition) TEMPLATE_MACRO_3(SequenceAnnotation) TEMPLATE_MACRO_3(SequenceConstraint) @@ -790,10 +799,12 @@ TEMPLATE_MACRO_3(Collection) TEMPLATE_MACRO_3(Attachment) TEMPLATE_MACRO_3(Implementation) TEMPLATE_MACRO_3(CombinatorialDerivation) -TEMPLATE_MACRO_3(Activity) +TEMPLATE_MACRO_3(VariableComponent) TEMPLATE_MACRO_3(Agent) TEMPLATE_MACRO_3(Plan) +TEMPLATE_MACRO_3(Association); TEMPLATE_MACRO_3(Usage) +TEMPLATE_MACRO_3(Activity) TEMPLATE_MACRO_3(Design) TEMPLATE_MACRO_3(Build) TEMPLATE_MACRO_3(Test) @@ -806,8 +817,10 @@ TEMPLATE_MACRO_3(GeneProductionInteraction); TEMPLATE_MACRO_3(TranscriptionalActivationInteraction); TEMPLATE_MACRO_3(SmallMoleculeActivationInteraction); TEMPLATE_MACRO_3(EnzymeCatalysisInteraction); +TEMPLATE_MACRO_3(Experiment); +TEMPLATE_MACRO_3(ExperimentalData); TEMPLATE_MACRO_3(Document); - + // Template functions used by PartShop //%template(pullComponentDefinitionFromCollection) sbol::PartShop::pull < ComponentDefinition > (sbol::Collection& collection); %template(pullComponentDefinition) sbol::PartShop::pull < ComponentDefinition >; @@ -820,489 +833,815 @@ TEMPLATE_MACRO_3(Document); // Used to create alias properties for FunctionalComponents used in the design-build-test-learn module %template(AliasedOwnedFunctionalComponent) sbol::AliasedProperty; - + %include "assembly.h" - + %extend sbol::ComponentDefinition { - - void assemble(PyObject *list, PyObject *doc) - { - sbol::Document* cpp_doc; - if ((SWIG_ConvertPtr(doc,(void **) &cpp_doc, $descriptor(sbol::Document*),1)) == -1) - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Second argument must be a valid Document"); - std::vector list_of_cdefs = convert_list_to_cdef_vector(list); - if (list_of_cdefs.size()) - { - $self->assemble(list_of_cdefs, *cpp_doc); - return; - } - return; - }; - - void assemble(PyObject *list) - { - std::vector list_of_display_ids = convert_list_to_string_vector(list); - if (list_of_display_ids.size()) - { - $self->assemble(list_of_display_ids); - return; - } - std::vector list_of_cdefs = convert_list_to_cdef_vector(list); - if (list_of_cdefs.size()) - { - $self->assemble(list_of_cdefs); - return; - } - return; - } - - void assemblePrimaryStructure(PyObject *list, PyObject *doc) - { - sbol::Document* cpp_doc; - if ((SWIG_ConvertPtr(doc,(void **) &cpp_doc, $descriptor(sbol::Document*),1)) == -1) - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Second argument must be a valid Document"); - std::vector list_of_cdefs = convert_list_to_cdef_vector(list); - if (list_of_cdefs.size()) - { - $self->assemblePrimaryStructure(list_of_cdefs, *cpp_doc); - return; - } - return; - } - - void assemblePrimaryStructure(PyObject *list) - { - std::vector list_of_display_ids = convert_list_to_string_vector(list); - if (list_of_display_ids.size()) - { - $self->assemblePrimaryStructure(list_of_display_ids); - return; - } - std::vector list_of_cdefs = convert_list_to_cdef_vector(list); - if (list_of_cdefs.size()) - { - $self->assemblePrimaryStructure(list_of_cdefs); - return; - } - return; - } - - void linearize(PyObject *list) - { - std::vector list_of_display_ids = convert_list_to_string_vector(list); - if (list_of_display_ids.size()) - { - $self->linearize(list_of_display_ids); - return; - } - std::vector list_of_cdefs = convert_list_to_cdef_vector(list); - if (list_of_cdefs.size()) - { - $self->linearize(list_of_cdefs); - return; - } - return; - } - - - bool isRegular(PyObject* py_string) - { - std::string msg; - bool IS_REGULAR; - IS_REGULAR = $self->isRegular(msg); - py_string = PyUnicode_FromString(msg.c_str()); - return IS_REGULAR; - }; + + void assemble(PyObject *list, PyObject *doc) + { + sbol::Document* cpp_doc; + if ((SWIG_ConvertPtr(doc,(void **) &cpp_doc, $descriptor(sbol::Document*),1)) == -1) + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Second argument must be a valid Document"); + std::vector list_of_cdefs = convert_list_to_cdef_vector(list); + if (list_of_cdefs.size()) + { + $self->assemble(list_of_cdefs, *cpp_doc); + return; + } + return; + }; + + void assemble(PyObject *list) + { + std::vector list_of_display_ids = convert_list_to_string_vector(list); + if (list_of_display_ids.size()) + { + $self->assemble(list_of_display_ids); + return; + } + std::vector list_of_cdefs = convert_list_to_cdef_vector(list); + if (list_of_cdefs.size()) + { + $self->assemble(list_of_cdefs); + return; + } + return; + } + + void assemblePrimaryStructure(PyObject *list, std::string assembly_standard = "") + { + std::vector list_of_display_ids = convert_list_to_string_vector(list); + if (list_of_display_ids.size()) + { + $self->assemblePrimaryStructure(list_of_display_ids, assembly_standard); + return; + } + std::vector list_of_cdefs = convert_list_to_cdef_vector(list); + if (list_of_cdefs.size()) + { + $self->assemblePrimaryStructure(list_of_cdefs, assembly_standard); + return; + } + return; + } + + + void assemblePrimaryStructure(PyObject *list, PyObject *doc) + { + sbol::Document* cpp_doc; + if ((SWIG_ConvertPtr(doc,(void **) &cpp_doc, $descriptor(sbol::Document*),1)) == -1) + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Second argument must be a valid Document"); + std::vector list_of_cdefs = convert_list_to_cdef_vector(list); + if (list_of_cdefs.size()) + { + $self->assemblePrimaryStructure(list_of_cdefs, *cpp_doc); + return; + } + return; + } + + void linearize(PyObject *list) + { + std::vector list_of_display_ids = convert_list_to_string_vector(list); + if (list_of_display_ids.size()) + { + $self->linearize(list_of_display_ids); + return; + } + std::vector list_of_cdefs = convert_list_to_cdef_vector(list); + if (list_of_cdefs.size()) + { + $self->linearize(list_of_cdefs); + return; + } + return; + } + + + bool isRegular(PyObject* py_string) + { + std::string msg; + bool IS_REGULAR; + IS_REGULAR = $self->isRegular(msg); + py_string = PyUnicode_FromString(msg.c_str()); + return IS_REGULAR; + }; } - + %extend sbol::Document { - PyObject* getExtensionObject(std::string id) - { - // Search the Document's object store for the uri - if ($self->PythonObjects.find(id) != $self->PythonObjects.end()) - { - PyObject* py_obj = $self->PythonObjects[id]; - Py_INCREF(py_obj); - return py_obj; - } - throw SBOLError(NOT_FOUND_ERROR, "Object " + id + " not found"); - } - - void addExtensionObject(PyObject* py_obj) - { - typedef struct { - PyObject_HEAD - void *ptr; // This is the pointer to the actual C++ instance - void *ty; // swig_type_info originally, but shouldn't matter - int own; - PyObject *next; - } SwigPyObject; - - // Get pointer to wrapped object - SwigPyObject* swig_py_object = (SwigPyObject*)PyObject_GetAttr(py_obj, PyUnicode_FromString("this")); - if (swig_py_object) - { - SBOLObject* sbol_obj = (SBOLObject *)swig_py_object->ptr; - TopLevel* tl = dynamic_cast(sbol_obj); - if (tl) - { - tl->doc = $self; - tl->parent = $self; - $self->SBOLObjects[$self->identity.get()] = tl; - $self->PythonObjects[sbol_obj->identity.get()] = py_obj; - int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); - } - // Call the add method to recursively add child objects and set their back-pointer to this Document - for (auto i_store = sbol_obj->owned_objects.begin(); i_store != sbol_obj->owned_objects.end(); ++i_store) - { - std::vector& object_store = i_store->second; - for (auto i_obj = object_store.begin(); i_obj != object_store.end(); ++i_obj) - { - $self->add(**i_obj); - } - } - } - else - throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Not a valid SBOL object"); - } - - Document* __iter__() - { - $self->python_iter = Document::iterator($self->SBOLObjects.begin()); - return $self; - } - - SBOLObject* next() - { - if ($self->python_iter != $self->end()) - { - SBOLObject& obj = *self->python_iter; - $self->python_iter++; - if ($self->python_iter == $self->end()) - { - PyErr_SetNone(PyExc_StopIteration); - } - return &obj; - } - throw SBOLError(END_OF_LIST, ""); - return NULL; - } - - SBOLObject* __next__() - { - if ($self->python_iter != $self->end()) - { - - SBOLObject& obj = *$self->python_iter; - $self->python_iter++; - return &obj; - } - - throw SBOLError(END_OF_LIST, "");; - return NULL; - } - - int __len__() - { - return $self->size(); - } - + PyObject* getExtensionObject(std::string id) + { + // Search the Document's object store for the uri + if ($self->PythonObjects.find(id) != $self->PythonObjects.end()) + { + PyObject* py_obj = $self->PythonObjects[id]; + Py_INCREF(py_obj); + return py_obj; + } + else if ($self->SBOLObjects.find(id) != $self->SBOLObjects.end()) + { + SBOLObject* obj = $self->SBOLObjects[id]; + PyObject *py_obj = SWIG_NewPointerObj(SWIG_as_voidptr(obj), $descriptor(sbol::TopLevel*), 0 | 0 ); + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + Py_INCREF(py_obj); + return py_obj; + } + throw SBOLError(NOT_FOUND_ERROR, "Object " + id + " not found"); + } + + void addExtensionObject(PyObject* py_obj) + { + typedef struct { + PyObject_HEAD + void *ptr; // This is the pointer to the actual C++ instance + void *ty; // swig_type_info originally, but shouldn't matter + int own; + PyObject *next; + } SwigPyObject; + + // Get pointer to wrapped object + SwigPyObject* swig_py_object = (SwigPyObject*)PyObject_GetAttr(py_obj, PyUnicode_FromString("this")); + if (swig_py_object) + { + SBOLObject* sbol_obj = (SBOLObject *)swig_py_object->ptr; + TopLevel* tl = dynamic_cast(sbol_obj); + if (tl) + { + tl->doc = $self; + tl->parent = $self; + $self->SBOLObjects[sbol_obj->identity.get()] = tl; + $self->PythonObjects[sbol_obj->identity.get()] = py_obj; + int check = PyObject_SetAttr(py_obj, PyUnicode_FromString("thisown"), Py_False); + Py_INCREF(py_obj); + } + // Call the add method to recursively add child objects and set their back-pointer to this Document + for (auto i_store = sbol_obj->owned_objects.begin(); i_store != sbol_obj->owned_objects.end(); ++i_store) + { + std::vector& object_store = i_store->second; + for (auto i_obj = object_store.begin(); i_obj != object_store.end(); ++i_obj) + { + $self->add(**i_obj); + } + } + } + else + throw SBOLError(SBOL_ERROR_TYPE_MISMATCH, "Not a valid SBOL object"); + } + + Document* __iter__() + { + $self->python_iter = Document::iterator($self->SBOLObjects.begin()); + return $self; + } + + TopLevel* next() + { + if ($self->python_iter != $self->end()) + { + TopLevel& obj = *self->python_iter; + $self->python_iter++; + if ($self->python_iter == $self->end()) + { + PyErr_SetNone(PyExc_StopIteration); + } + return &obj; + } + throw SBOLError(END_OF_LIST, ""); + return NULL; + } + + TopLevel* __next__() + { + if ($self->python_iter != $self->end()) + { + + TopLevel& obj = *$self->python_iter; + $self->python_iter++; + return &obj; + } + + throw SBOLError(END_OF_LIST, "");; + return NULL; + } + + int __len__() + { + return $self->size(); + } + + void readString(char * str) + { + string s = string(str); + $self->readString(s); + } + } - + %extend sbol::ModuleDefinition { - void assemble(PyObject *list) - { - std::vector list_of_mdefs = {}; - if (PyList_Check(list)) - { - for (int i = 0; i < PyList_Size(list); ++i) - { - PyObject *obj = PyList_GetItem(list, i); - sbol::ModuleDefinition* md; - if ((SWIG_ConvertPtr(obj,(void **) &md, $descriptor(sbol::ModuleDefinition*),1)) == -1) throw; - list_of_mdefs.push_back(md); - } - $self->assemble(list_of_mdefs); - }; - } + void assemble(PyObject *list) + { + std::vector list_of_mdefs = {}; + if (PyList_Check(list)) + { + for (int i = 0; i < PyList_Size(list); ++i) + { + PyObject *obj = PyList_GetItem(list, i); + sbol::ModuleDefinition* md; + if ((SWIG_ConvertPtr(obj,(void **) &md, $descriptor(sbol::ModuleDefinition*),1)) == -1) throw; + list_of_mdefs.push_back(md); + } + $self->assemble(list_of_mdefs); + }; + } } %extend sbol::SearchQuery { - sbol::TextProperty __getitem__(std::string uri) - { - return $self->operator[](uri); - } - + sbol::TextProperty __getitem__(std::string uri) + { + return $self->operator[](uri); + } + } %extend sbol::SearchResponse { - sbol::Identified& __getitem__(int i) - { - return $self->operator[](i); - } - - int __len__() - { - return $self->size(); - } - - SearchResponse* __iter__() - { - $self->python_iter = SearchResponse::iterator($self->begin()); - return $self; - } - - Identified* next() - { - if ($self->python_iter != $self->end()) - { - Identified* obj = *$self->python_iter; - $self->python_iter++; - if ($self->python_iter == $self->end()) - { - PyErr_SetNone(PyExc_StopIteration); - } - return obj; - } - throw SBOLError(END_OF_LIST, ""); - return NULL; - } - - Identified* __next__() - { - if ($self->python_iter != $self->end()) - { - - Identified* obj = *$self->python_iter; - $self->python_iter++; - - return obj; - } - - throw SBOLError(END_OF_LIST, "");; - return NULL; - } + sbol::Identified& __getitem__(int i) + { + return $self->operator[](i); + } + + int __len__() + { + return $self->size(); + } + + SearchResponse* __iter__() + { + $self->python_iter = SearchResponse::iterator($self->begin()); + return $self; + } + + Identified* next() + { + if ($self->size() == 0) + throw SBOLError(END_OF_LIST, ""); + if ($self->python_iter != $self->end()) + { + Identified* obj = *$self->python_iter; + $self->python_iter++; + + return obj; + } + if ($self->python_iter == $self->end()) + { + PyErr_SetNone(PyExc_StopIteration); + } + throw SBOLError(END_OF_LIST, ""); + return NULL; + } + + Identified* __next__() + { + if ($self->python_iter != $self->end()) + { + + Identified* obj = *$self->python_iter; + $self->python_iter++; + + return obj; + } + + throw SBOLError(END_OF_LIST, "");; + return NULL; + } } - -%extend sbol::TopLevel -{ - PyObject* generateDesign(std::string uri, Agent& agent, Plan& plan, PyObject* usage_list) - { - std::vector < Identified* > usage_vector = convert_list_to_identified_vector(usage_list); - Design& design = $self->generate(uri, agent, plan, usage_vector); - return SWIG_NewPointerObj(SWIG_as_voidptr(&design), $descriptor(sbol::Design*), 0 | 0 ); - } - - PyObject* generateBuild(std::string uri, Agent& agent, Plan& plan, PyObject* usage_list) - { - std::vector < Identified* > usage_vector = convert_list_to_identified_vector(usage_list); - Build& build = $self->generate(uri, agent, plan, usage_vector); - return SWIG_NewPointerObj(SWIG_as_voidptr(&build), $descriptor(sbol::Build*), 0 | 0 ); - } - - PyObject* generateTest(std::string uri, Agent& agent, Plan& plan, PyObject* usage_list) - { - std::vector < Identified* > usage_vector = convert_list_to_identified_vector(usage_list); - Test& test = $self->generate(uri, agent, plan, usage_vector); - return SWIG_NewPointerObj(SWIG_as_voidptr(&test), $descriptor(sbol::Test*), 0 | 0 ); - } - - PyObject* generateAnalysis(std::string uri, Agent& agent, Plan& plan, PyObject* usage_list) - { - std::vector < Identified* > usage_vector = convert_list_to_identified_vector(usage_list); - Analysis& analysis = $self->generate(uri, agent, plan, usage_vector); - return SWIG_NewPointerObj(SWIG_as_voidptr(&analysis), $descriptor(sbol::Analysis*), 0 | 0 ); - } -} - -%extend sbol::EnzymeCatalysisInteraction -{ - EnzymeCatalysisInteraction(std::string uri, ComponentDefinition& enzyme, PyObject* substrates, PyObject* products) - { - std::vector substrate_v = convert_list_to_cdef_vector(substrates); - std::vector product_v = convert_list_to_cdef_vector(products); - EnzymeCatalysisInteraction(uri, enzyme, substrate_v, product_v, {}, {}); - } - - - EnzymeCatalysisInteraction(std::string uri, ComponentDefinition& enzyme, PyObject* substrates, PyObject* products, PyObject* cofactors, PyObject* sideproducts) - { - std::vector substrate_v = convert_list_to_cdef_vector(substrates); - std::vector product_v = convert_list_to_cdef_vector(products); - std::vector cofactor_v = convert_list_to_cdef_vector(cofactors); - std::vector sideproduct_v = convert_list_to_cdef_vector(sideproducts); - EnzymeCatalysisInteraction(uri, enzyme, substrate_v, product_v, cofactor_v, sideproduct_v); - } -} - -%template(generateDesign) sbol::TopLevel::generate; -%template(generateBuild) sbol::TopLevel::generate; -%template(generateTest) sbol::TopLevel::generate; -%template(generateAnalysis) sbol::TopLevel::generate; +%extend sbol::Activity { + %pythoncode %{ + + def generateDesign(self, uris, analysis_usages, design_usages = None): + """ + + + Generate one or more Design objects + + Parameters + ---------- + * `uris` : + One or more identifiers for the new Design object(s). If the + `sbol_compliant_uris` option configuration is enabled, then the user + should specify simple identifiers for the objects. Otherwise the user + must provide full URIs each consisting of a scheme, namespace, and identifier. + * `analysis_usages` : + A singleton Analysis object, list of Analysis objects, or None. Analysis usages + represent a prediction or forward-specification of the new Design's intended + structure or function. + * `design_usages` : + A singleton Design object, list of Design objects, or None. Design usages may + represent previous Designs that are being tranformed or composed into + the new Design. + + Returns + ------- + A singleton Design or list of Designs depending on whether the user specifies + a single URI or list of URIs. + + """ + + self.__validate_activity__(SBOL_DESIGN) + if type(uris) != list: + uris = [ uris ] + for uri in uris: + if type(uri) != str: + raise TypeError('Cannot generate Design. The first argument must be a string or list of strings') + if len(uris) != len(set(uris)): + raise ValueError('Cannot generate Design. The first argument cannot contain duplicate values') + + try: + analysis_usages = self.__validate_usages__(analysis_usages, Analysis) + except TypeError: + raise TypeError('Cannot generate Design. The second argument must be an Analysis or list of Analyses') + + try: + design_usages = self.__validate_usages__(design_usages, Design) + except TypeError: + raise TypeError('Cannot generate Design. The third argument must be a Design or list of Designs') + + if not len(analysis_usages) and not len(design_usages): + raise ValueError('Cannot generate Design. User must specify usages of either Analysis or Design type') + + new_designs = [] + for uri in uris: + new_design = self.doc.designs.create(uri) + new_design.wasGeneratedBy = self.identity + if len(analysis_usages): + new_design.specification = analysis_usages[0] + new_designs.append(new_design) + + self.__create_usages__(analysis_usages) + self.__create_usages__(design_usages) + + if len(new_designs) > 1: + return new_designs + else: + return new_designs[0] + + def generateBuild(self, uris, design_usages, build_usages = None): + """ + + + Generate one or more Build objects + + Parameters + ---------- + * `uris` : + One or more identifiers for the new Build object(s). If the + `sbol_compliant_uris` option configuration is enabled, then the user + should specify simple identifiers for the objects. Otherwise the user + must provide full URIs each consisting of a scheme, namespace, and identifier. + * `design_usages` : + A singleton Design object, list of Design objects, or None. Design usages represent + the engineer's intent or "blueprint" for the Build target. + * `build_usages` : + A singleton Build object, list of Build objects, or None. Build usages + represent physical components, such as laboratory samples, that are assembled + into the target Build. + + Returns + ------- + A singleton Build or list of Builds depending on whether the user specifies + a single URI or list of URIs. + + """ + self.__validate_activity__(SBOL_BUILD) + if type(uris) != list: + uris = [ uris ] + + for uri in uris: + if type(uri) != str: + raise TypeError('Cannot generate Build. The first argument must be a string or list of strings') + if len(uris) != len(set(uris)): + raise ValueError('Cannot generate Build. The first argument cannot contain duplicate values') + + try: + design_usages = self.__validate_usages__(design_usages, Design) + except TypeError: + raise TypeError('Cannot generate Build. The second argument must be a Design or list of Designs') + + try: + build_usages = self.__validate_usages__(build_usages, Build) + except TypeError: + raise TypeError('Cannot generate Build. The third argument must be a Design or list of Designs') + + if not len(design_usages) and not len(build_usages): + raise ValueError('Cannot generate Build. User must specify usages of either Design or Build type') + + new_builds = [] + for uri in uris: + new_build = self.doc.builds.create(uri) + new_build.wasGeneratedBy = self.identity + if len(design_usages): + new_build.design = design_usages[0] + new_builds.append(new_build) + + self.__create_usages__(design_usages) + self.__create_usages__(build_usages) + + if len(new_builds) > 1: + return new_builds + else: + return new_builds[0] + + + def generateTest(self, uris, build_usages, test_usages = None): + """ + + + Generate one or more Test objects + + Parameters + ---------- + * `uris` : + One or more identifiers for the new Test object(s). If the + `sbol_compliant_uris` option configuration is enabled, then the user + should specify simple identifiers for the objects. Otherwise the user + must provide full URIs each consisting of a scheme, namespace, and identifier. + * `build_usages` : + A singleton Build object, list of Build objects, or None. Build usages represent + samples or analytes used in an experimental measurement. + * `test_usages` : + A singleton Test object, list of Test objects, or None. Test usages + represent other measurements or raw data that the user wants to integrate into + a single data set. + + Returns + ------- + A singleton Test or list of Tests depending on whether the user specifies + a single URI or list of URIs. + + """ + self.__validate_activity__(SBOL_TEST) + + if type(uris) != list: + uris = [ uris ] + for uri in uris: + if type(uri) != str: + raise TypeError('Cannot generate Test. The first argument must be a string or list of strings') + if len(uris) != len(set(uris)): + raise ValueError('Cannot generate Test. The first argument cannot contain duplicate values') + + if type(build_usages) == SampleRoster: + build_usages = [ build_usages ] + else: + try: + build_usages = self.__validate_usages__(build_usages, Build) + except TypeError: + raise TypeError('Cannot generate Build. The second argument must be a Design or list of Designs') + + try: + test_usages = self.__validate_usages__(test_usages, Test) + except TypeError: + raise TypeError('Cannot generate Build. The third argument must be a Design or list of Designs') + + if not len(build_usages) and not len(test_usages): + raise ValueError('Cannot generate Build. User must specify usages of either Design or Build type') + + new_tests = [] + for uri in uris: + new_test = self.doc.tests.create(uri) + new_test.wasGeneratedBy = self.identity + if len(build_usages): + new_test.samples = build_usages + new_tests.append(new_test) + + self.__create_usages__(build_usages) + self.__create_usages__(test_usages) + if len(new_tests) > 1: + return new_tests + else: + return new_tests[0] + + def generateAnalysis(self, uris, test_usages, analysis_usages = None): + """ + + + Generate one or more Analysis objects. + + Parameters + ---------- + * `uris` : + One or more identifiers for the new Analysis object(s). If the + `sbol_compliant_uris` option configuration is enabled, then the user + should specify simple identifiers for the objects. Otherwise the user + must provide full URIs each consisting of a scheme, namespace, and identifier. + * `test_usages` : + A singleton Test object, list of Test objects, or None. Test usages represent + raw experimental data used to generate an Analysis. + * `analysis_usages` : + A singleton Analysis object, list of Analysis objects, or None. Analysis usages + represent other analyses that the user wants to integrate into + a single data set or data sheet. + + Returns + ------- + A singleton Analysis or list of Analyses depending on whether the user specifies + a single URI or list of URIs. + + """ + self.__validate_activity__(SBOL_TEST) + + if type(uris) != list: + uris = [ uris ] + for uri in uris: + if type(uri) != str: + raise TypeError('Cannot generate Analysis. The first argument must be a string or list of strings') + if len(uris) != len(set(uris)): + raise ValueError('Cannot generate Analysis. The first argument cannot contain duplicate values') + + try: + test_usages = self.__validate_usages__(test_usages, Test) + except TypeError: + raise TypeError('Cannot generate Build. The second argument must be a Design or list of Designs') + + try: + analysis_usages = self.__validate_usages__(analysis_usages, Analysis) + except TypeError: + raise TypeError('Cannot generate Build. The third argument must be a Design or list of Designs') + + if not len(test_usages) and not len(analysis_usages): + raise ValueError('Cannot generate Build. User must specify usages of either Design or Build type') + + new_analyses = [] + for uri in uris: + new_analysis = self.doc.analyses.create(uri) + new_analysis.wasGeneratedBy = self.identity + if len(test_usages): + new_analysis.rawData = test_usages[0] + new_analyses.append(new_analysis) + + self.__create_usages__(test_usages) + self.__create_usages__(analysis_usages) + if len(new_analyses) > 1: + return new_analyses + else: + return new_analyses[0] + + def __validate_activity__(self, activity_type): + if not self.doc : raise ValueError('Failed to generate. This Activity must first be added to a Document') + if len(self.associations): + for a in self.associations: + if not a.agent: + raise ValueError('Failed to generate. This Activity does not specify an Agent') + if not a.plan: + raise ValueError('Failed to generate. This Activity does not specify a Plan') + for a in self.associations: + a.roles = activity_type + else: + raise ValueError('Failed to generate. This Activity does not specify an Agent or Plan') + + def __validate_usages__(self, usage_list, UsageType): + if usage_list == None: + usage_list = [] + elif type(usage_list) != list: + usage_list = [ usage_list ] + for u in usage_list: + if not type(u) == UsageType: + raise TypeError() + return usage_list + + def __create_usages__(self, usage_list): + + usage_map = \ + { + Design : SBOL_URI + "#design", + Build : SBOL_URI + "#build", + Test : SBOL_URI + "#test", + Analysis : SBOL_URI + "#learn", + SampleRoster : SBOL_URI + "#build" + } + + for u in usage_list: + if not u.doc: + if type(u == Design): + self.doc.addDesign(u) + if type(u == Build): + self.doc.addBuild(u) + elif type(u == Test): + self.doc.addTest(u) + elif type(u == Analysis): + self.doc.addAnalsis(u) + elif type(u == SampleRoster): + self.doc.addTest(u) + if Config.getOption('sbol_compliant_uris') == 'True': + id = u.displayId + else: + id = u.identity + U = self.usages.create(id + '_usage'); + U.entity = u.identity + U.roles = usage_map[type(u)] + %} +}; + - %pythonbegin %{ from __future__ import absolute_import +import json %} - + %pythoncode %{ - def applyToComponentHierarchy(self, callback_fn, user_data): - # Assumes parent_component is an SBOL data structure of the general form ComponentDefinition(->Component->ComponentDefinition)n where n+1 is an integer describing how many hierarchical levels are in the SBOL structure - # Look at each of the ComponentDef's SequenceAnnotations, is the target base there? - if not self.doc: - raise Exception('Cannot traverse Component hierarchy without a Document') - - GET_ALL = True - component_nodes = [] - if len(self.components) == 0: - component_nodes.append(self) # Add leaf components - if (callback_fn): - callback_fn(self, user_data) - else: - if GET_ALL: - component_nodes.append(self) # Add components with children - if callback_fn: - callback_fn(self, user_data) - for subc in self.components: - if not self.doc.find(subc.definition.get()): - raise Exception(subc.definition.get() + 'not found') - subcdef = self.doc.getComponentDefinition(subc.definition.get()) - subcomponents = subcdef.applyToComponentHierarchy(callback_fn, user_data) - component_nodes.extend(subcomponents) - return component_nodes - - - ComponentDefinition.applyToComponentHierarchy = applyToComponentHierarchy - - - def testSBOL(): - """ - Function to run test suite for pySBOL - """ - import sbol.unit_tests as unit_tests - unit_tests.runTests() - - def is_extension_property(obj, name): - attribute_dict = object.__getattribute__(obj, '__dict__') - if name in attribute_dict: - if type(attribute_dict[name]) in [ TextProperty, URIProperty, IntProperty, FloatProperty, ReferencedObject, DateTimeProperty, VersionProperty ] : - return True - return False - - def is_swig_property(obj, name): - swig_attribute_dict = object.__getattribute__(obj, '__swig_getmethods__') - if name in swig_attribute_dict: - return True - return False - - class PythonicInterface(object): - - def __getattribute__(self,name): - sbol_attribute = None - if is_swig_property(self, name): - sbol_attribute = object.__getattribute__(self, name) - elif is_extension_property(self, name): - sbol_attribute = object.__getattribute__(self, '__dict__')[name] - if sbol_attribute: - if not 'Owned' in sbol_attribute.__class__.__name__: - if sbol_attribute.getUpperBound() != '1': - return sbol_attribute.getAll() - else: - try: - return sbol_attribute.get() - except LookupError: - return None - return None - elif sbol_attribute.getUpperBound() == '1': - try: - return sbol_attribute.get() - except: - return None - return object.__getattribute__(self, name) - - def __setattr__(self,name, value): - sbol_attribute = None - if is_swig_property(self, name): - sbol_attribute = object.__getattribute__(self, name) - elif is_extension_property(self, name): - sbol_attribute = object.__getattribute__(self, '__dict__')[name] - if sbol_attribute: - if not 'Owned' in sbol_attribute.__class__.__name__: - if value == None: - sbol_attribute.clear() - elif type(value) == list: - if sbol_attribute.getUpperBound() == '1': - raise TypeError('The ' + sbol_attribute.getTypeURI() + ' property does not accept list arguments') - sbol_attribute.clear() - for val in value: - sbol_attribute.add(val) - else: - sbol_attribute.set(value) - elif sbol_attribute.getUpperBound() == '1': - if len(sbol_attribute) > 0: - sbol_obj = sbol_attribute.get() - doc = sbol_obj.doc - sbol_attribute.remove() - if not doc: - sbol_obj.thisown = True - elif not doc.find(sbol_obj.identity): - sbol_obj.thisown = True - if not value == None: - sbol_attribute.set(value) - value.thisown = False - else: - self.__class__.__setattribute__(self, name, value) - - def __repr__(self): - return self.__class__.__name__ + def applyToComponentHierarchy(self, callback_fn, user_data): + # Assumes parent_component is an SBOL data structure of the general form ComponentDefinition(->Component->ComponentDefinition)n where n+1 is an integer describing how many hierarchical levels are in the SBOL structure + # Look at each of the ComponentDef's SequenceAnnotations, is the target base there? + if not self.doc: + raise Exception('Cannot traverse Component hierarchy without a Document') + + GET_ALL = True + component_nodes = [] + if len(self.components) == 0: + component_nodes.append(self) # Add leaf components + if (callback_fn): + callback_fn(self, user_data) + else: + if GET_ALL: + component_nodes.append(self) # Add components with children + if callback_fn: + callback_fn(self, user_data) + for subc in self.components: + if not self.doc.find(subc.definition): + raise Exception(subc.definition + 'not found') + subcdef = self.doc.getComponentDefinition(subc.definition) + subcomponents = subcdef.applyToComponentHierarchy(callback_fn, user_data) + component_nodes.extend(subcomponents) + return component_nodes + + + ComponentDefinition.applyToComponentHierarchy = applyToComponentHierarchy + + def applyToModuleHierarchy(self, callback_fn, user_data): + # Applies the callback to an SBOL data structure of the general form ModuleDefinition(->Module->ModuleDefinition)n where n+1 is an integer describing how many hierarchical levels are in the SBOL structure + if not self.doc: + raise Exception('Cannot traverse Module hierarchy without a Document') + + GET_ALL = True + module_nodes = [] + if len(self.modules) == 0: + module_nodes.append(self) # Add leaf components + if (callback_fn): + callback_fn(self, user_data) + else: + if GET_ALL: + module_nodes.append(self) # Add components with children + if callback_fn: + callback_fn(self, user_data) + for subm in self.modules: + if not self.doc.find(subm.definition): + raise Exception(subm.definition + 'not found') + submdef = self.doc.getModuleDefinition(subm.definition) + submodules = submdef.applyToModuleHierarchy(callback_fn, user_data) + module_nodes.extend(submodules) + return module_nodes + + + ModuleDefinition.applyToModuleHierarchy = applyToModuleHierarchy + + def testSBOL(): + """ + Function to run test suite for pySBOL + """ + import sbol.unit_tests as unit_tests + unit_tests.runTests() + + def is_extension_property(obj, name): + attribute_dict = object.__getattribute__(obj, '__dict__') + if name in attribute_dict: + if type(attribute_dict[name]) in [ TextProperty, URIProperty, IntProperty, FloatProperty, ReferencedObject, DateTimeProperty, VersionProperty ] : + return True + return False + + def is_swig_property(obj, name): + swig_attribute_dict = object.__getattribute__(obj, '__swig_getmethods__') + if name in swig_attribute_dict: + return True + return False + + class PythonicInterface(object): + + def __getattribute__(self,name): + sbol_attribute = None + if is_swig_property(self, name): + sbol_attribute = object.__getattribute__(self, name) + elif is_extension_property(self, name): + sbol_attribute = object.__getattribute__(self, '__dict__')[name] + if sbol_attribute != None: + if not 'Owned' in sbol_attribute.__class__.__name__: + if sbol_attribute.getUpperBound() != '1': + return sbol_attribute.getAll() + else: + try: + return sbol_attribute.get() + except LookupError: + return None + return None + elif sbol_attribute.getUpperBound() == '1': + try: + return sbol_attribute.get() + except: + return None + return object.__getattribute__(self, name) + + def __setattr__(self,name, value): + sbol_attribute = None + if is_swig_property(self, name): + sbol_attribute = object.__getattribute__(self, name) + elif is_extension_property(self, name): + sbol_attribute = object.__getattribute__(self, '__dict__')[name] + if sbol_attribute != None: + if not 'Owned' in sbol_attribute.__class__.__name__: + if value == None: + sbol_attribute.clear() + elif type(value) == list: + if sbol_attribute.getUpperBound() == '1': + raise TypeError('The ' + sbol_attribute.getTypeURI() + ' property does not accept list arguments') + sbol_attribute.clear() + for val in value: + sbol_attribute.add(val) + else: + sbol_attribute.set(value) + elif sbol_attribute.getUpperBound() == '1': + if len(sbol_attribute) > 0: + sbol_obj = sbol_attribute.get() + doc = sbol_obj.doc + sbol_attribute.remove() + if not doc: + sbol_obj.thisown = True + elif not doc.find(sbol_obj.identity): + sbol_obj.thisown = True + if not value == None: + sbol_attribute.set(value) + value.thisown = False + else: + self.__class__.__setattribute__(self, name, value) + + def __repr__(self): + return self.__class__.__name__ %} - - - - //%extend sbol::Document - //{ - // std::string __getitem__(const int nIndex) - // { - // return $self->operator[](nIndex); - // } - // - // ReferencedObject* __iter__() - // { - // $self->python_iter = Document::iterator($self->begin()); - // return $self; - // } - // - // std::string next() - // { - // if ($self->python_iter != $self->end()) - // { - // std::string ref = *$self->python_iter; - // $self->python_iter++; - // if ($self->python_iter == $self->end()) - // { - // PyErr_SetNone(PyExc_StopIteration); - // } - // return ref; - // } - // throw (END_OF_LIST); - // return NULL; - // } - // - // int __len__() - // { - // return $self->size(); - // } - //}; - - + +%extend sbol::EnzymeCatalysisInteraction +{ + EnzymeCatalysisInteraction(std::string uri, ComponentDefinition& enzyme, PyObject* substrates, PyObject* products) + { + return new sbol::EnzymeCatalysisInteraction(uri, enzyme, convert_list_to_cdef_vector(substrates), convert_list_to_cdef_vector(products)); + }; + + EnzymeCatalysisInteraction(std::string uri, ComponentDefinition& enzyme, PyObject* substrates, PyObject* products, PyObject* cofactors, PyObject* sideproducts) + { + return new sbol::EnzymeCatalysisInteraction(uri, enzyme, convert_list_to_cdef_vector(substrates), convert_list_to_cdef_vector(products), convert_list_to_cdef_vector(cofactors), convert_list_to_cdef_vector(sideproducts)); + }; +} + + //%extend sbol::Document + //{ + // std::string __getitem__(const int nIndex) + // { + // return $self->operator[](nIndex); + // } + // + // ReferencedObject* __iter__() + // { + // $self->python_iter = Document::iterator($self->begin()); + // return $self; + // } + // + // std::string next() + // { + // if ($self->python_iter != $self->end()) + // { + // std::string ref = *$self->python_iter; + // $self->python_iter++; + // if ($self->python_iter == $self->end()) + // { + // PyErr_SetNone(PyExc_StopIteration); + // } + // return ref; + // } + // throw (END_OF_LIST); + // return NULL; + // } + // + // int __len__() + // { + // return $self->size(); + // } + //}; + + //// The following code was experimented with for mapping C++ class structure to Python class structure //%pythonappend ComponentDefinition %{ @@ -1322,16 +1661,16 @@ from __future__ import absolute_import // %template(_UnorderedMapVector) unordered_map; // //%template(_UnorderedMapOfStringVector) unordered_map; //} - + //%include "std_function.i" //namespace std { // %template(_ValidationRule) function; // %template(_ValidationRules) vector>;} //} - + //typedef const void(*sbol::ValidationRule)(void *, void *); // %template(_ValidationRules) std::vector; - + //%pythonappend sbol::Config::parse_extension_objects() //%{ // print ("Parsing extension objects") @@ -1343,7 +1682,7 @@ from __future__ import absolute_import // print (args) // self.thisown = args[0] //%} - + //%pythonappend sbol::Config::extension_memory_handler(bool swig_thisown) //%{ // print ("Entering memory handler") diff --git a/wrapper/python_docs.i b/wrapper/python_docs.i index f69da2ef..ab92bc59 100644 --- a/wrapper/python_docs.i +++ b/wrapper/python_docs.i @@ -1,142 +1,302 @@ // File: index.xml -// File: classsbol_1_1_collection.xml +// File: classsbol_1_1_activity.xml -%feature("docstring") sbol::Collection " +%feature("docstring") sbol::Activity " -The Collection class is a class that groups together a set of TopLevel objects -that have something in common. +A generated Entity is linked through a wasGeneratedBy relationship to an +Activity, which is used to describe how different Agents and other entities were +used. An Activity is linked through a qualifiedAssociation to Associations, to +describe the role of agents, and is linked through qualifiedUsage to Usages to +describe the role of other entities used as part of the activity. Moreover, each +Activity includes optional startedAtTime and endedAtTime properties. When using +Activity to capture how an entity was derived, it is expected that any +additional information needed will be attached as annotations. This may include +software settings or textual notes. Activities can also be linked together using +the wasInformedBy relationship to provide dependency without explicitly +specifying start and end times. -Some examples of Collection objects: . Results of a query to find all -ComponentDefinition objects in a repository that function as promoters . A set -of ModuleDefinition objects representing a library of genetic logic gates. . A -ModuleDefinition for a complexdesign, and all of the ModuleDefinition, -ComponentDefinition, Sequence, and Model objects used to provide its full -specification. +Attributes +---------- +* `startedAtTime` : `DateTimeProperty` + +* `endedAtTime` : `DateTimeProperty` + The endedAtTime property is OPTIONAL and contains a dateTime (see section + Section 12.7) value, indicating when the activity ended. + +* `wasInformedBy` : `ReferencedObject` + The wasInformedBy property is OPTIONAL and contains a URI of another + activity. + +* `associations` : `OwnedObject< Association >` + The qualifiedAssociation property is OPTIONAL and MAY contain a set of URIs + that refers to Association. + +* `usages` : `OwnedObject< Usage >` + The qualifiedUsage property is OPTIONAL and MAY contain a set of URIs that + refers to Usage objects. + +* `agent` : `OwnedObject< Agent >` + An Agent object may be specified here, and it will be synced with the + Association::agent property. + +* `plan` : `OwnedObject< Plan >` + A Plan object may be specified here, and it will be synced with the + Association::plan property. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/provo.h +"; + +%feature("docstring") sbol::Activity::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::Collection::addToDocument " +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Add the Collection object to Document +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::Collection::getProperties " +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Design &` +"; -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Build &` +"; -Returns -------- -A vector of URIs that identify the properties contained in this object +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Build &` "; -%feature("docstring") sbol::Collection::find " +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Test &` +"; -Search this object recursively to see if an object with the URI already exists. +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -Parameters ----------- -* `uri` : - The URI to search for. +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Analysis &` +"; -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Analysis &` "; -%feature("docstring") sbol::Collection::getPropertyValues " +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Design &` +"; -Get all values of a custom annotation property by its URI. +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -Parameters ----------- -* `property_uri` : - The URI for the property +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Build &` +"; -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Build &` "; -%feature("docstring") sbol::Collection::Collection " +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Test &` +"; -Construct a Collection. +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Activity::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Activity::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::Activity::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Activity::Activity " +`Activity(uri=\"example\", action_type=\"\", version=VERSION_STRING)` Parameters ---------- * `uri` : - If operating in open-world mode, this should be a full URI including a - scheme, namespace, and identifier. If SBOLCompliance configuration is - enabled, then this argument is simply the displayId for the new object and a - full URI will automatically be constructed. + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. "; -%feature("docstring") sbol::Collection::getTypeURI " +%feature("docstring") sbol::Activity::Activity " +`Activity(type, uri, action_type, version)` -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one "; -%feature("docstring") sbol::Collection::getClassName " +%feature("docstring") sbol::Activity::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Activity::getProperties " +`getProperties() -> std::vector< std::string >` + +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 ------- -Parses a local class name from the RDF-type of this SBOL Object +A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::Collection::copy " - -Copy an object and automatically increment its version. - -If the optional version argument is specified, it will be used instead of -incrementing the copied object's version. An object may also be copied into a -new document and a new namespace, assuming compliant URIs. +%feature("docstring") sbol::Activity::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` -templateparam -------------- -* `SBOLClass` : - The type of SBOL object being copied +Get all values of a custom annotation property by its URI. Parameters ---------- -* `new_doc` : - The new copies will be attached to this Document. NULL by default. -* `ns` : - This namespace will be substituted for the current namespace (as configured - by setHomespace) in all SBOL-compliat URIs. -* `version` : - A new version +* `property_uri` : + The URI for the property Returns ------- -The full URI of the created object. +A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Collection::find_property " +%feature("docstring") sbol::Activity::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Search this object recursively to see if it contains a member property with the -given RDF type. +Get the value of a custom annotation property by its URI. Parameters ---------- -* `uri` : - The RDF type of the property to search for. +* `property_uri` : + The URI for the property Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Collection::getPropertyValue " +%feature("docstring") sbol::Activity::getAnnotation " +`getAnnotation(property_uri) -> std::string` Get the value of a custom annotation property by its URI. +Synonymous with getPropertyValue + Parameters ---------- * `property_uri` : @@ -147,7 +307,8 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Collection::compare " +%feature("docstring") sbol::Activity::compare " +`compare(comparand) -> int` Compare two SBOL objects or Documents. @@ -164,229 +325,297 @@ Returns 1 if the objects are identical, 0 if they are different "; -// File: classsbol_1_1_component.xml +%feature("docstring") sbol::Activity::find " +`find(uri) -> SBOLObject *` +Search this object recursively to see if an object or any child object with URI +already exists. -%feature("docstring") sbol::Component " +Parameters +---------- +* `uri` : + The URI to search for. -The Component class is used to compose ComponentDefinition objects into a -structural hierarchy. For example, the ComponentDefinition of a gene could -contain four Component objects: a promoter, RBS, CDS, and terminator. In turn, -the ComponentDefinition of the promoter Component could contain Component -objects defined as various operator sites. +Returns +------- +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::Component::getClassName " +%feature("docstring") sbol::Activity::getClassName " +`getClassName(type) -> std::string` Returns ------- Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Component::find_property " +%feature("docstring") sbol::Activity::close " +`close()` -Search this object recursively to see if it contains a member property with the -given RDF type. +Use this method to destroy an SBOL object that is not contained by a parent +Document. -Parameters ----------- -* `uri` : - The RDF type of the property to search for. +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; -Returns -------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +%feature("docstring") sbol::Activity::addToDocument " +`addToDocument(arg1)` "; -%feature("docstring") sbol::Component::getPropertyValues " +%feature("docstring") sbol::Activity::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` -Get all values of a custom annotation property by its URI. +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied Parameters ---------- -* `property_uri` : - The URI for the property +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version Returns ------- -A vector of property values or SBOL_ERROR_NOT_FOUND +The copied object. "; -%feature("docstring") sbol::Component::copy " +%feature("docstring") sbol::Activity::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` "; -%feature("docstring") sbol::Component::find " +%feature("docstring") sbol::Activity::~Activity " +`~Activity()` + +The type property is an ontology term that designates an activity or stage in +the synthetic biology workflow, such as codon optimization or DNA assembly. +"; + +%feature("docstring") sbol::Activity::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Activity::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Activity::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Activity::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -Search this object recursively to see if an object with the URI already exists. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- * `uri` : - The URI to search for. + The RDF type of the property to search for. +* `value` : + The property value to match Returns ------- -A pointer to theobject with this URI if it exists, NULL otherwise +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::Component::getProperties " +%feature("docstring") sbol::Activity::setPropertyValue " +`setPropertyValue(property_uri, val)` -Gets URIs for all properties contained by this object. +Set and overwrite the value for a user-defined annotation property. -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +Either a literal or URI value +"; + +%feature("docstring") sbol::Activity::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 Returns ------- -A vector of URIs that identify the properties contained in this object +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::Component::getTypeURI " +%feature("docstring") sbol::Activity::getTypeURI " +`getTypeURI() -> rdf_type` Returns ------- The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Component::compare " - -Compare two SBOL objects or Documents. +%feature("docstring") sbol::Activity::find_property " +`find_property(uri) -> SBOLObject *` -The behavior is currently undefined for objects with custom annotations or -extension classes. +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + The RDF type of the property to search for. Returns ------- -1 if the objects are identical, 0 if they are different +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -%feature("docstring") sbol::Component::Component " - -Construct a Component. +%feature("docstring") sbol::Activity::addPropertyValue " +`addPropertyValue(property_uri, val)` -If operating in SBOL-compliant mode, use ComponentDefinition::components::create -instead. +Append a value to a user-defined annotation property. -Parameters ----------- -* `A` : - full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `definition` : - A URI referring to the ComponentDefinition that defines this instance -* `access` : - Flag indicating whether the Component can be referred to remotely by a - MapsTo -* `version` : - An arbitrary version string. If SBOLCompliance is enabled, this should be a - Maven version string of the form \"major.minor.patch\". +Either a literal or URI value "; -%feature("docstring") sbol::Component::getPropertyValue " +%feature("docstring") sbol::Activity::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` -Get the value of a custom annotation property by its URI. +Copies an object. + +No child objects are copied. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -The value of the property or SBOL_ERROR_NOT_FOUND +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -// File: classsbol_1_1_component_definition.xml +// File: classsbol_1_1_agent.xml -%feature("docstring") sbol::ComponentDefinition " +%feature("docstring") sbol::Agent " -The ComponentDefinition class represents the structural entities of a biological -design. +Examples of agents are person, organisation or software. These agents should be +annotated with additional information, such as software version, needed to be +able to run the same software again. -The primary usage of this class is to represent structural entities with -designed sequences, such as DNA, RNA, and proteins, but it can also be used to -represent any other entity that is part of a design, such as small molecules, -proteins, and complexes -"; +Attributes +---------- +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/provo.h +"; + +%feature("docstring") sbol::Agent::Agent " +`Agent(uri=\"example\", version=VERSION_STRING)` -%feature("docstring") sbol::ComponentDefinition::participate " - -A convenience method that assigns a component to participate in a biochemical -reaction. - -Behind the scenes, it auto-constructs a FunctionalComponent for this -ComponentDefinition and assigns it to a Participation - -Parameters ----------- -* `species` : - A Participation object (ie, participant species in a biochemical - Interaction). -"; - -%feature("docstring") sbol::ComponentDefinition::copy " - -Copy an object and automatically increment its version. - -If the optional version argument is specified, it will be used instead of -incrementing the copied object's version. An object may also be copied into a -new document and a new namespace, assuming compliant URIs. - -templateparam -------------- -* `SBOLClass` : - The type of SBOL object being copied +Constructor. Parameters ---------- -* `new_doc` : - The new copies will be attached to this Document. NULL by default. -* `ns` : - This namespace will be substituted for the current namespace (as configured - by setHomespace) in all SBOL-compliat URIs. -* `version` : - A new version - -Returns -------- -The full URI of the created object. -"; - -%feature("docstring") sbol::ComponentDefinition::getLastComponent " - -Gets the last Component in a linear sequence. - -Returns -------- -The last component in sequential order +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. "; -%feature("docstring") sbol::ComponentDefinition::hasDownstreamComponent " - -Checks if the specified Component has a Component downstream in linear -arrangement on the DNA strand. +%feature("docstring") sbol::Agent::Agent " +`Agent(type, uri, version)` -Checks that the appropriate SequenceConstraint exists. +Constructor used for defining extension classes. Parameters ---------- -* `current_component` : - A Component in this ComponentDefinition - -Returns -------- -1 if found, 0 if not +* `rdf_type` : + The RDF type for an extension class derived from this one "; -%feature("docstring") sbol::ComponentDefinition::getPropertyValue " +%feature("docstring") sbol::Agent::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` Get the value of a custom annotation property by its URI. @@ -400,208 +629,268 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::ComponentDefinition::getUpstreamComponent " +%feature("docstring") sbol::Agent::addPropertyValue " +`addPropertyValue(property_uri, val)` -Get the upstream Component. +Append a value to a user-defined annotation property. -Returns -------- -The upstream component +Either a literal or URI value "; -%feature("docstring") sbol::ComponentDefinition::updateSequence " +%feature("docstring") sbol::Agent::initialize " +`initialize(uri)` +"; -Assemble a parent ComponentDefinition's Sequence from its subcomponent -Sequences. +%feature("docstring") sbol::Agent::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. Parameters ---------- -* `composite_sequence` : - A recursive parameter, use default value +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -The assembled parent sequence +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -%feature("docstring") sbol::ComponentDefinition::find " +%feature("docstring") sbol::Agent::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` -Search this object recursively to see if an object with the URI already exists. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- * `uri` : - The URI to search for. + A URI, either an ontology term or an object reference, to search for Returns ------- -A pointer to theobject with this URI if it exists, NULL otherwise +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::ComponentDefinition::hasUpstreamComponent " - -Checks if the specified Component has a Component upstream in linear arrangement -on the DNA strand. - -Checks that the appropriate SequenceConstraint exists. +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> SBOLClass &` Parameters ---------- -* `current_component` : - A Component in this ComponentDefinition +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -1 if found, 0 if not +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::ComponentDefinition::getPropertyValues " - -Get all values of a custom annotation property by its URI. +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::ComponentDefinition::assemble " +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Design &` +"; -Assembles the provided vector of Components into a structural hierarchy. +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -update SequenceAnnotation starts and ends +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Build &` +"; -Autoconstructs the required Components and SequenceConstraints. The resulting -data structure is a partial design, still lacking a specific DNA (or other) -sequence. To fully realize a design, use Sequence::assemble(). +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Parameters ----------- -* `list_of_components` : - A list of subcomponents that will compose this ComponentDefinition +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Test &` "; -%feature("docstring") sbol::ComponentDefinition::getProperties " +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Analysis &` +"; -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -Returns -------- -A vector of URIs that identify the properties contained in this object +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Design &` "; -%feature("docstring") sbol::ComponentDefinition::find_property " +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -Search this object recursively to see if it contains a member property with the -given RDF type. +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Build &` +"; -Parameters ----------- -* `uri` : - The RDF type of the property to search for. +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Returns -------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Test &` "; -%feature("docstring") sbol::ComponentDefinition::addToDocument " +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -Add the ComponentDefinition object to Document +%feature("docstring") sbol::Agent::generate " +`generate(uri) -> Analysis &` "; -%feature("docstring") sbol::ComponentDefinition::getInSequentialOrder " +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -Orders this ComponentDefinition's member Components into a linear arrangement -based on Sequence Constraints. +%feature("docstring") sbol::Agent::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; -Returns -------- -Primary sequence structure +%feature("docstring") sbol::Agent::generate " +`generate() -> SBOLClass &` "; -%feature("docstring") sbol::ComponentDefinition::getTypeURI " +%feature("docstring") sbol::Agent::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. Returns ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::ComponentDefinition::getClassName " +%feature("docstring") sbol::Agent::getClassName " +`getClassName(type) -> std::string` Returns ------- Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::ComponentDefinition::getDownstreamComponent " +%feature("docstring") sbol::Agent::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -Get the downstream Component. +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 Returns ------- -The downstream component +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::ComponentDefinition::getFirstComponent " - -Gets the first Component in a linear sequence. +%feature("docstring") sbol::Agent::getTypeURI " +`getTypeURI() -> rdf_type` Returns ------- -The first component in sequential order +The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::ComponentDefinition::compare " +%feature("docstring") sbol::Agent::setPropertyValue " +`setPropertyValue(property_uri, val)` -Compare two SBOL objects or Documents. +Set and overwrite the value for a user-defined annotation property. -The behavior is currently undefined for objects with custom annotations or -extension classes. +Either a literal or URI value +"; + +%feature("docstring") sbol::Agent::find " +`find(uri) -> SBOLObject *` + +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + The URI to search for. Returns ------- -1 if the objects are identical, 0 if they are different +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::ComponentDefinition::ComponentDefinition " +%feature("docstring") sbol::Agent::apply " +`apply(callback_fn, user_data)` +"; -Construct a ComponentDefinition. +%feature("docstring") sbol::Agent::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Agent::~Agent " +`~Agent()` +"; + +%feature("docstring") sbol::Agent::find_property " +`find_property(uri) -> SBOLObject *` + +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- * `uri` : - A full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `type` : - A BioPAX ontology term that indicates whether the ComponentDefinition is - DNA, RNA, protein, or some other molecule type. -* `version` : - An arbitrary version string. If SBOLCompliance is enabled, this should be a - Maven version string of the form \"major.minor.patch\". -"; + The RDF type of the property to search for. -// File: classsbol_1_1_component_instance.xml +Returns +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; +%feature("docstring") sbol::Agent::update_uri " +`update_uri()` +"; -%feature("docstring") sbol::ComponentInstance " +%feature("docstring") sbol::Agent::cast " +`cast() -> SBOLClass &` "; -%feature("docstring") sbol::ComponentInstance::getProperties " +%feature("docstring") sbol::Agent::getProperties " +`getProperties() -> std::vector< std::string >` Gets URIs for all properties contained by this object. @@ -613,12 +902,12 @@ Returns A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::ComponentInstance::copy " -"; +%feature("docstring") sbol::Agent::getAnnotation " +`getAnnotation(property_uri) -> std::string` -%feature("docstring") sbol::ComponentInstance::getPropertyValues " +Get the value of a custom annotation property by its URI. -Get all values of a custom annotation property by its URI. +Synonymous with getPropertyValue Parameters ---------- @@ -627,217 +916,407 @@ Parameters Returns ------- -A vector of property values or SBOL_ERROR_NOT_FOUND +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::ComponentInstance::getClassName " +%feature("docstring") sbol::Agent::setAnnotation " +`setAnnotation(property_uri, val)` -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; +%feature("docstring") sbol::Agent::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` -%feature("docstring") sbol::ComponentInstance::compare " +Recursively copies an object. -Compare two SBOL objects or Documents. +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). -The behavior is currently undefined for objects with custom annotations or -extension classes. +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version Returns ------- -1 if the objects are identical, 0 if they are different +The copied object. "; -%feature("docstring") sbol::ComponentInstance::find_property " +%feature("docstring") sbol::Agent::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; -Search this object recursively to see if it contains a member property with the -given RDF type. +%feature("docstring") sbol::Agent::close " +`close()` -Parameters ----------- -* `uri` : - The RDF type of the property to search for. +Use this method to destroy an SBOL object that is not contained by a parent +Document. -Returns -------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. "; -%feature("docstring") sbol::ComponentInstance::find " +%feature("docstring") sbol::Agent::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` -Search this object recursively to see if an object with the URI already exists. +Get all values of a custom annotation property by its URI. Parameters ---------- -* `uri` : - The URI to search for. +* `property_uri` : + The URI for the property Returns ------- -A pointer to theobject with this URI if it exists, NULL otherwise +A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::ComponentInstance::getPropertyValue " +// File: classsbol_1_1_aliased_property.xml -Get the value of a custom annotation property by its URI. -Parameters +%feature("docstring") sbol::AliasedProperty " + +Attributes ---------- -* `property_uri` : - The URI for the property +* `alias` : `rdf_type` -Returns -------- -The value of the property or SBOL_ERROR_NOT_FOUND +* `python_iter` : `std::vector< std::string >::iterator` "; -%feature("docstring") sbol::ComponentInstance::getTypeURI " - -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::AliasedProperty::end " +`end() -> iterator` "; -// File: classsbol_1_1_config.xml - - -%feature("docstring") sbol::Config " - -A class which contains global configuration variables for the libSBOL -environment. Intended to be used like a static class, configuration variables -are accessed through the `Config' object. +%feature("docstring") sbol::AliasedProperty::~AliasedProperty " +`~AliasedProperty()` "; -%feature("docstring") sbol::Config::setOption " +%feature("docstring") sbol::AliasedProperty::getUpperBound " +`getUpperBound() -> char` +"; -Configure options for online validation and conversion -Option +%feature("docstring") sbol::AliasedProperty::begin " +`begin() -> iterator` +"; -Description +%feature("docstring") sbol::AliasedProperty::getLowerBound " +`getLowerBound() -> char` +"; -Values +%feature("docstring") sbol::AliasedProperty::addValidationRule " +`addValidationRule(rule)` +"; -validate +%feature("docstring") sbol::AliasedProperty::add " +`add(sbol_obj)` +"; -Enable validation and conversion requests through the online validator +%feature("docstring") sbol::AliasedProperty::add " +`add(new_value)` -True or False +Appends the new value to a list of values, for properties that allow it. -validatorURL +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; -The http request endpoint for validation +%feature("docstring") sbol::AliasedProperty::find " +`find(uri) -> bool` -A valid URL, set to http://www.async.ece.utah.edu/sbol-validator/endpoint.php -by default +Parameters +---------- +* `uri` : + The full uniform resource identifier of the object to search for in this + property -output +Returns +------- +A boolean indicating whether found or not +"; -File format for conversion +%feature("docstring") sbol::AliasedProperty::create " +`create(uri) -> SBOLClass &` +"; -SBOL2, SBOL1, FASTA, GenBank +%feature("docstring") sbol::AliasedProperty::set " +`set(sbol_obj)` +"; -diff +%feature("docstring") sbol::AliasedProperty::set " +`set(new_value)` -Report differences between two files +Basic setter for SBOL TextProperty and URIProperty. -True or False +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; -noncompliantUrisAllowed +%feature("docstring") sbol::AliasedProperty::set " +`set(new_value)` -If set to false, URIs in the file will not be checked for compliance -with the SBOL specification +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. -True or False +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; -incompleteDocumentsAllowed +%feature("docstring") sbol::AliasedProperty::set " +`set(new_value)` +"; -If set to false, not all referenced objects must be described within -the given main_file +%feature("docstring") sbol::AliasedProperty::set " +`set(new_value)` -True or False +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. -bestPracticesCheck +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; -If set to true, the file is checked for the best practice rules set -in the SBOL specification +%feature("docstring") sbol::AliasedProperty::__len__ " +`__len__() -> int` +"; -True or False +%feature("docstring") sbol::AliasedProperty::validate " +`validate(arg=NULL)` +"; -failOnFirstError +%feature("docstring") sbol::AliasedProperty::clear " +`clear()` -If set to true, the validator will fail at the first error +Remove all children objects from the parent and destroy them. +"; -True or False +%feature("docstring") sbol::AliasedProperty::write " +`write()` +"; -displayFullErrorStackTrace +%feature("docstring") sbol::AliasedProperty::size " +`size() -> int` +"; -If set to true (and failOnFirstError is true) the validator will -provide a stack trace for the first validation error +%feature("docstring") sbol::AliasedProperty::define " +`define(definition_object) -> SBOLClass &` +"; -True or False +%feature("docstring") sbol::AliasedProperty::getOwner " +`getOwner() -> SBOLObject &` +"; -topLevelToConvert +%feature("docstring") sbol::AliasedProperty::get " +`get(uri=\"\") -> SBOLClass &` +"; +%feature("docstring") sbol::AliasedProperty::getAll " +`getAll() -> std::vector< SBOLClass * >` +Get all the objects contained in the property. -uriPrefix +Returns +------- +A vector of pointers to the objects +"; -Required for conversion from FASTA and GenBank to SBOL1 or SBOL2, -used to generate URIs +%feature("docstring") sbol::AliasedProperty::copy " +`copy(target_property)` -True or False +Copy property values to a target object's property fields. +"; -version +%feature("docstring") sbol::AliasedProperty::AliasedProperty " +`AliasedProperty(property_owner, sbol_uri, alias_uri, lower_bound, upper_bound, + validation_rules)` +"; -Adds the version to all URIs and to the document +%feature("docstring") sbol::AliasedProperty::remove " +`remove(uri) -> SBOLClass &` -A valid Maven version string +Remove an object from the list of objects. -wantFileBack +Parameters +---------- +* `uri` : + This can be a displayId of the object or a full URI may be provided. +"; -Whether or not to return the file contents as a string +%feature("docstring") sbol::AliasedProperty::remove " +`remove(index=0)` -True or False +Remove an object from the list of objects and destroy it. Parameters ---------- -* `option` : - The option key -* `value` : - The option value +* `index` : + A numerical index for the object. "; -%feature("docstring") sbol::Config::Config " +%feature("docstring") sbol::AliasedProperty::getTypeURI " +`getTypeURI() -> rdf_type` "; -%feature("docstring") sbol::Config::getOption " +// File: classsbol_1_1_analysis.xml -Get current option value for online validation and conversion. + +%feature("docstring") sbol::Analysis " + +Attributes +---------- +* `rawData` : `ReferencedObject` + A reference to a Test object which contains the raw data for an Analysis. + +* `dataFiles` : `ReferencedObject` + References to file Attachments which contain experimental data sets. + +* `dataSheet` : `ReferencedObject` + A reference to a datasheet file. + +* `consensusSequence` : `OwnedObject< Sequence >` + A sequence object that represents a consensus sequence from DNA sequencing + data. + +* `fittedModel` : `OwnedObject< Model >` + A Model derived from fitting an experimental data set. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. +"; + +%feature("docstring") sbol::Analysis::~Analysis " +`~Analysis()` +"; + +%feature("docstring") sbol::Analysis::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `option` : - The option key +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type "; -// File: classsbol_1_1_cut.xml +%feature("docstring") sbol::Analysis::reportError " +`reportError() -> std::unordered_map< std::string, std::tuple< int, int, float > + >` +"; +%feature("docstring") sbol::Analysis::getProperties " +`getProperties() -> std::vector< std::string >` -%feature("docstring") sbol::Cut " +Gets URIs for all properties contained by this object. -The Cut class specifies a location between two coordinates of a Sequence's -elements. +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 "; -%feature("docstring") sbol::Cut::compare " +%feature("docstring") sbol::Analysis::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Analysis::compare " +`compare(comparand) -> int` Compare two SBOL objects or Documents. @@ -854,395 +1333,529 @@ Returns 1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::Cut::getTypeURI " +%feature("docstring") sbol::Analysis::setPropertyValue " +`setPropertyValue(property_uri, val)` -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value "; -%feature("docstring") sbol::Cut::find_property " +%feature("docstring") sbol::Analysis::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` -Search this object recursively to see if it contains a member property with the -given RDF type. +Copies an object. + +No child objects are copied. Parameters ---------- * `uri` : - The RDF type of the property to search for. + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -%feature("docstring") sbol::Cut::find " +%feature("docstring") sbol::Analysis::initialize " +`initialize(uri)` +"; -Search this object recursively to see if an object with the URI already exists. +%feature("docstring") sbol::Analysis::close " +`close()` -Parameters ----------- -* `uri` : - The URI to search for. +Use this method to destroy an SBOL object that is not contained by a parent +Document. -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. "; -%feature("docstring") sbol::Cut::copy " -"; +%feature("docstring") sbol::Analysis::setAnnotation " +`setAnnotation(property_uri, val)` -%feature("docstring") sbol::Cut::getClassName " +Set the value for a user-defined annotation property. -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::Cut::getPropertyValue " +%feature("docstring") sbol::Analysis::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` -Get the value of a custom annotation property by its URI. +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied Parameters ---------- -* `property_uri` : - The URI for the property +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +The copied object. "; -%feature("docstring") sbol::Cut::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 +%feature("docstring") sbol::Analysis::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` "; -%feature("docstring") sbol::Cut::getPropertyValues " - -Get all values of a custom annotation property by its URI. +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> SBOLClass &` Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::Cut::Cut " - -Construct a Cut. - -If operating in SBOL-compliant mode, use SequenceAnnotation.locations.create instead. +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` Parameters ---------- * `uri` : - If operating in open-world mode, this should be a full URI including a - scheme, namespace, and identifier. If SBOLCompliance configuration is - enabled, then this argument is simply the displayId for the new object and a - full URI will automatically be constructed. -* `at` : - An integer of 0 or greater + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate "; -// File: classsbol_1_1_document.xml +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Design &` +"; +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -%feature("docstring") sbol::Document " +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Build &` +"; -Read and write SBOL using a Document class. The Document is a container for -Components, Modules, and all other SBOLObjects. +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Build &` "; -%feature("docstring") sbol::Document::addComponentDefinition " +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Test &` +"; -Adds a component definition or a list of component definitions to a sbol::Document object. +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -Parameters ----------- -* `componentDefinition` : - ComponentDefinition object or a list of ComponentDefinition objects +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Analysis &` "; -%feature("docstring") sbol::Document::addSequence " +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -Adds a sequence or a list of sequences to a sbol::Document object. +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Design &` +"; -Parameters ----------- -* `sequence` : - Sequence object or a list of Sequence objects +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Design &` "; -%feature("docstring") sbol::Document::addModuleDefinition " +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Build &` +"; -Adds a module definition or a list of module definitions to a sbol::Document object. +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Parameters ----------- -* `moduleDefinition` : - ModuleDefinition object or a list of ModuleDefinition objects +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Test &` "; -%feature("docstring") sbol::Document::request_validation " +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -Submit this Document to the online validator. +%feature("docstring") sbol::Analysis::generate " +`generate(uri) -> Analysis &` +"; -Returns -------- -The validation results +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> Analysis &` "; -%feature("docstring") sbol::Document::find_property " +%feature("docstring") sbol::Analysis::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; -Search this object recursively to see if it contains a member property with the -given RDF type. +%feature("docstring") sbol::Analysis::generate " +`generate() -> SBOLClass &` +"; -Parameters ----------- -* `uri` : - The RDF type of the property to search for. +%feature("docstring") sbol::Analysis::getTypeURI " +`getTypeURI() -> rdf_type` Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Document::Document " +%feature("docstring") sbol::Analysis::reportCoverage " +`reportCoverage() -> std::unordered_map< std::string, std::tuple< int, int, + float > >` +"; -Construct a Document. The Document is a container for Components, Modules, and -all other SBOLObjects. +%feature("docstring") sbol::Analysis::addToDocument " +`addToDocument(arg1)` "; -%feature("docstring") sbol::Document::add " +%feature("docstring") sbol::Analysis::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` -Register an object in the Document. +Get all values of a custom annotation property by its URI. Parameters ---------- -* `sbol_objects` : - A list of pointers to the SBOL objects you want to serialize +* `property_uri` : + The URI for the property -templateparam -------------- -* `SBOLClass` : - The type of SBOL object +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Document::write " +%feature("docstring") sbol::Analysis::addPropertyValue " +`addPropertyValue(property_uri, val)` -Serialize all objects in this Document to an RDF/XML file. +Append a value to a user-defined annotation property. -Parameters ----------- -* `filename` : - The full name of the file you want to write (including file extension) +Either a literal or URI value +"; -Returns -------- -A string with the validation results, or empty string if validation is disabled +%feature("docstring") sbol::Analysis::reportAmbiguity " +`reportAmbiguity() -> std::unordered_map< std::string, std::tuple< int, int, + float > >` "; -%feature("docstring") sbol::Document::getClassName " +%feature("docstring") sbol::Analysis::apply " +`apply(callback_fn, user_data)` +"; -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +%feature("docstring") sbol::Analysis::verifyTarget " +`verifyTarget(consensus_sequence)` + +Compare a consensus Sequence to the target Sequence. "; -%feature("docstring") sbol::Document::getProperties " +%feature("docstring") sbol::Analysis::getAnnotation " +`getAnnotation(property_uri) -> std::string` -Gets URIs for all properties contained by this object. +Get the value of a custom annotation property by its URI. -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +Synonymous with getPropertyValue + +Parameters +---------- +* `property_uri` : + The URI for the property Returns ------- -A vector of URIs that identify the properties contained in this object +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Document::validate " +%feature("docstring") sbol::Analysis::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` -Run validation on this Document. +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 Returns ------- -The validation results +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::Document::read " +%feature("docstring") sbol::Analysis::cast " +`cast() -> SBOLClass &` +"; -Read an RDF/XML file and attach the SBOL objects to this Document. +%feature("docstring") sbol::Analysis::Analysis " +`Analysis(uri=\"example\", version=VERSION_STRING)` -Existing contents of the Document will be wiped. +Construct a new Analysis object. Parameters ---------- -* `filename` : - The full name of the file you want to read (including file extension) +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". "; -%feature("docstring") sbol::Document::addNamespace " +%feature("docstring") sbol::Analysis::find_property " +`find_property(uri) -> SBOLObject *` -Add a new namespace to this Document. +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- -* `ns` : - The namespace, eg. http://sbols.org/v2# -* `prefix` : - The namespace prefix, eg. sbol -"; - -%feature("docstring") sbol::Document::getAll " - -Retrieve a vector of objects from the Document. +* `uri` : + The RDF type of the property to search for. -templateparam -------------- -* `SBOLClass` : - The type of SBOL objects +Returns +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -%feature("docstring") sbol::Document::find " +%feature("docstring") sbol::Analysis::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Search recursively for an SBOLObject in this Document that matches the uri. +Get the value of a custom annotation property by its URI. Parameters ---------- -* `uri` : - The identity of the object to search for +* `property_uri` : + The URI for the property Returns ------- -A pointer to the SBOLObject, or NULL if an object with this identity doesn't -exist +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Document::getTypeURI " +%feature("docstring") sbol::Analysis::getClassName " +`getClassName(type) -> std::string` Returns ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Document::compare " - -Compare two SBOL objects or Documents. +%feature("docstring") sbol::Analysis::find " +`find(uri) -> SBOLObject *` -The behavior is currently undefined for objects with custom annotations or -extension classes. +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + The URI to search for. Returns ------- -1 if the objects are identical, 0 if they are different +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::Document::getNamespaces " - -Returns -------- -A vector of namespaces Get namespaces contained in this Document +%feature("docstring") sbol::Analysis::reportIdentity " +`reportIdentity() -> std::unordered_map< std::string, std::tuple< int, int, + float > >` "; -%feature("docstring") sbol::Document::append " +// File: classsbol_1_1_association.xml -Read an RDF/XML file and attach the SBOL objects to this Document. -New objects will be added to the existing contents of the Document +%feature("docstring") sbol::Association " -Parameters ----------- -* `filename` : - The full name of the file you want to read (including file extension) -"; +An Association is linked to an Agent through the agent relationship. The +Association includes the hadRole property to qualify the role of the Agent in +the Activity. -%feature("docstring") sbol::Document::get " +Attributes +---------- +* `agent` : `ReferencedObject` + The agent property is REQUIRED and MUST contain a URI that refers to an + Agent object. + +* `roles` : `URIProperty` + The hadRole property is REQUIRED and MUST contain a URI that refers to a + particular term describing the usage of the agent. + +* `plan` : `ReferencedObject` + The hadPlan property is OPTIONAL and contains a URI that refers to a Plan. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/provo.h +"; + +%feature("docstring") sbol::Association::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` -Retrieve an object from the Document. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- * `uri` : - The identity of the SBOL object you want to retrieve + A URI, either an ontology term or an object reference, to search for -templateparam -------------- -* `SBOLClass` : - The type of SBOL object +Returns +------- +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::Document::getPropertyValues " +%feature("docstring") sbol::Association::find " +`find(uri) -> SBOLObject *` -Get all values of a custom annotation property by its URI. +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + The URI to search for. Returns ------- -A vector of property values or SBOL_ERROR_NOT_FOUND +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::Document::getPropertyValue " +%feature("docstring") sbol::Association::apply " +`apply(callback_fn, user_data)` +"; -Get the value of a custom annotation property by its URI. +%feature("docstring") sbol::Association::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +A vector containing all objects found that contain a member property with the +specified RDF type "; -// File: classsbol_1_1_functional_component.xml +%feature("docstring") sbol::Association::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; +%feature("docstring") sbol::Association::setAnnotation " +`setAnnotation(property_uri, val)` -%feature("docstring") sbol::FunctionalComponent " +Set the value for a user-defined annotation property. -The FunctionalComponent class is used to specify the functional usage of a -ComponentDefinition inside a ModuleDefinition. The ModuleDefinition describes -how the that describes how the FunctionalComponent interacts with others and -summarizes their aggregate function. +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::FunctionalComponent::isMasked " - -Used to tell if a FunctionalComponent is linked to an equivalent -FunctionalComponent in another ModuleDefinition. +%feature("docstring") sbol::Association::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; -Returns -------- -1 if the FunctionalComponent has been over-rided by another FunctionalComponent, -0 if it hasn't. +%feature("docstring") sbol::Association::generate " +`generate() -> SBOLClass &` "; -%feature("docstring") sbol::FunctionalComponent::getPropertyValues " +%feature("docstring") sbol::Association::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` Get all values of a custom annotation property by its URI. @@ -1256,17 +1869,8 @@ Returns A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::FunctionalComponent::getClassName " - -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object -"; - -%feature("docstring") sbol::FunctionalComponent::copy " -"; - -%feature("docstring") sbol::FunctionalComponent::compare " +%feature("docstring") sbol::Association::compare " +`compare(comparand) -> int` Compare two SBOL objects or Documents. @@ -1283,301 +1887,454 @@ Returns 1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::FunctionalComponent::connect " - -This method connects module inputs and outputs. +%feature("docstring") sbol::Association::setPropertyValue " +`setPropertyValue(property_uri, val)` -This convenience method auto-constructs a MapsTo object. See Biosystem Design -for an example +Set and overwrite the value for a user-defined annotation property. -Parameters ----------- -* `interface_component` : - An input or output component from another ModuleDefinition that corresponds - with this component. +Either a literal or URI value "; -%feature("docstring") sbol::FunctionalComponent::find_property " +%feature("docstring") sbol::Association::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Search this object recursively to see if it contains a member property with the -given RDF type. +Get the value of a custom annotation property by its URI. Parameters ---------- -* `uri` : - The RDF type of the property to search for. +* `property_uri` : + The URI for the property Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::FunctionalComponent::find " +%feature("docstring") sbol::Association::Association " +`Association(uri=\"example\", agent=\"\", role=\"\", version=VERSION_STRING)` -Search this object recursively to see if an object with the URI already exists. +Constructor. Parameters ---------- * `uri` : - The URI to search for. - -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. "; -%feature("docstring") sbol::FunctionalComponent::FunctionalComponent " - -Construct a FunctionalComponent. +%feature("docstring") sbol::Association::Association " +`Association(type, uri, agent, role, version)` -If operating in SBOL-compliant mode, use -ModuleDefinition::functionalComponents::create instead. +Constructor used for defining extension classes. Parameters ---------- -* `A` : - full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `definition` : - A URI referring to the ComponentDefinition that defines this instance -* `access` : - Flag indicating whether the FunctionalComponent can be referred to remotely - by a MapsTo -* `direction` : - The direction property specifies whether a FunctionalComponent serves as an - input, output, both, or neither for its parent ModuleDefinition object -* `version` : - An arbitrary version string. If SBOLCompliance is enabled, this should be a - Maven version string of the form \"major.minor.patch\". +* `rdf_type` : + The RDF type for an extension class derived from this one "; -%feature("docstring") sbol::FunctionalComponent::getTypeURI " +%feature("docstring") sbol::Association::addPropertyValue " +`addPropertyValue(property_uri, val)` -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +Append a value to a user-defined annotation property. + +Either a literal or URI value "; -%feature("docstring") sbol::FunctionalComponent::getProperties " +%feature("docstring") sbol::Association::cast " +`cast() -> SBOLClass &` +"; -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::Association::getAnnotation " +`getAnnotation(property_uri) -> std::string` -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +Get the value of a custom annotation property by its URI. + +Synonymous with getPropertyValue + +Parameters +---------- +* `property_uri` : + The URI for the property Returns ------- -A vector of URIs that identify the properties contained in this object +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::FunctionalComponent::mask " - -This method is used to state that FunctionalComponents in separate -ModuleDefinitions are functionally equivalent. +%feature("docstring") sbol::Association::close " +`close()` -Using this method will override the FunctionalComponent in the argument with the -FunctionalComponent calling the method. This is useful for overriding a generic, -template component with an explicitly defined component. This convenience method -auto-constructs a MapsTo object. See Biosystem Design for an example +Use this method to destroy an SBOL object that is not contained by a parent +Document. -Parameters ----------- -* `masked_component` : - The FunctionalComponent that is being masked (over-ridden) +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. "; -%feature("docstring") sbol::FunctionalComponent::getPropertyValue " +%feature("docstring") sbol::Association::find_property " +`find_property(uri) -> SBOLObject *` -Get the value of a custom annotation property by its URI. +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + The RDF type of the property to search for. Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -// File: classsbol_1_1_generic_location.xml +%feature("docstring") sbol::Association::update_uri " +`update_uri()` +"; +%feature("docstring") sbol::Association::getProperties " +`getProperties() -> std::vector< std::string >` -%feature("docstring") sbol::GenericLocation " +Gets URIs for all properties contained by this object. -the GenericLocation class is included as a starting point for specifying regions -on Sequence objects with encoding properties other than IUPAC and potentially -nonlinear structure. This class can also be used to set the orientation of a -SequenceAnnotation and any associated Component when their parent -ComponentDefinition is a partial design that lacks a Sequence. +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 "; -%feature("docstring") sbol::GenericLocation::getClassName " +%feature("docstring") sbol::Association::getClassName " +`getClassName(type) -> std::string` Returns ------- Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::GenericLocation::getPropertyValues " +%feature("docstring") sbol::Association::~Association " +`~Association()` +"; -Get all values of a custom annotation property by its URI. +// File: classsbol_1_1_attachment.xml -Parameters + +%feature("docstring") sbol::Attachment " + +The Attachment class is a general container for data files, especially +experimental data files. Attachment is a TopLevel object, and any other TopLevel +object can refer to a list of attachments. + +Attributes ---------- -* `property_uri` : - The URI for the property +* `source` : `URIProperty` + The source is a link to the external file and is REQUIRED. -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +* `format` : `URIProperty` + +* `size` : `IntProperty` + +* `hash` : `TextProperty` + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/attachment.h "; -%feature("docstring") sbol::GenericLocation::compare " +%feature("docstring") sbol::Attachment::addPropertyValue " +`addPropertyValue(property_uri, val)` -Compare two SBOL objects or Documents. +Append a value to a user-defined annotation property. -The behavior is currently undefined for objects with custom annotations or -extension classes. +Either a literal or URI value +"; -Parameters ----------- -* `comparand` : - A pointer to the object being compared to this one. +%feature("docstring") sbol::Attachment::~Attachment " +`~Attachment()` +"; -Returns -------- -1 if the objects are identical, 0 if they are different +%feature("docstring") sbol::Attachment::initialize " +`initialize(uri)` "; -%feature("docstring") sbol::GenericLocation::find_property " +%feature("docstring") sbol::Attachment::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Attachment::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` Search this object recursively to see if it contains a member property with the -given RDF type. +given RDF type and indicated property value. Parameters ---------- * `uri` : The RDF type of the property to search for. +* `value` : + The property value to match Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::GenericLocation::getPropertyValue " +%feature("docstring") sbol::Attachment::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` -Get the value of a custom annotation property by its URI. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + A URI, either an ontology term or an object reference, to search for Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::GenericLocation::find " +%feature("docstring") sbol::Attachment::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. -Search this object recursively to see if an object with the URI already exists. +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied Parameters ---------- -* `uri` : - The URI to search for. +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version Returns ------- -A pointer to theobject with this URI if it exists, NULL otherwise +The copied object. "; -%feature("docstring") sbol::GenericLocation::copy " +%feature("docstring") sbol::Attachment::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` "; -%feature("docstring") sbol::GenericLocation::GenericLocation " +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> SBOLClass &` -Construct a GenericLocation. +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; -If operating in SBOL-compliant mode, use SequenceAnnotation.locations.create instead. +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` Parameters ---------- * `uri` : - If operating in open-world mode, this should be a full URI including a - scheme, namespace, and identifier. If SBOLCompliance configuration is - enabled, then this argument is simply the displayId for the new object and a - full URI will automatically be constructed. + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::GenericLocation::getProperties " +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Design &` +"; -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Build &` +"; -Returns -------- -A vector of URIs that identify the properties contained in this object +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Build &` "; -%feature("docstring") sbol::GenericLocation::getTypeURI " +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Test &` +"; -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Test &` "; -// File: classsbol_1_1_identified.xml +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Analysis &` +"; +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -%feature("docstring") sbol::Identified " +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Design &` +"; -All SBOL-defined classes are directly or indirectly derived from the Identified -abstract class. +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -An Identified object is identified using a Uniform Resource Identifier (URI), a -unique string that identifies and refers to a specific object in an SBOL -document or in an online resource such as a DNA repository. +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Build &` "; -%feature("docstring") sbol::Identified::getPropertyValues " +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Get all values of a custom annotation property by its URI. +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Test &` +"; -Parameters ----------- -* `property_uri` : - The URI for the property +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +%feature("docstring") sbol::Attachment::generate " +`generate(uri) -> Analysis &` "; -%feature("docstring") sbol::Identified::getClassName " +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +%feature("docstring") sbol::Attachment::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` "; -%feature("docstring") sbol::Identified::getTypeURI " +%feature("docstring") sbol::Attachment::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Attachment::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Attachment::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Attachment::getClassName " +`getClassName(type) -> std::string` Returns ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Identified::copy " +%feature("docstring") sbol::Attachment::addToDocument " +`addToDocument(arg1)` "; -%feature("docstring") sbol::Identified::find_property " +%feature("docstring") sbol::Attachment::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Attachment::find_property " +`find_property(uri) -> SBOLObject *` Search this object recursively to see if it contains a member property with the given RDF type. @@ -1593,7 +2350,38 @@ A pointer to the object that contains a member property with the specified RDF type, NULL otherwise "; -%feature("docstring") sbol::Identified::getProperties " +%feature("docstring") sbol::Attachment::Attachment " +`Attachment(uri=\"example\", source=\"\", version=VERSION_STRING)` + +Construct an Attachment. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `source` : + A file URI +"; + +%feature("docstring") sbol::Attachment::Attachment " +`Attachment(type, uri, source, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Attachment::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Attachment::getProperties " +`getProperties() -> std::vector< std::string >` Gets URIs for all properties contained by this object. @@ -1605,24 +2393,31 @@ Returns A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::Identified::find " +%feature("docstring") sbol::Attachment::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. -Search this object recursively to see if an object with the URI already exists. +No child objects are copied. Parameters ---------- * `uri` : - The URI to search for. + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -%feature("docstring") sbol::Identified::getPropertyValue " +%feature("docstring") sbol::Attachment::getAnnotation " +`getAnnotation(property_uri) -> std::string` Get the value of a custom annotation property by its URI. +Synonymous with getPropertyValue + Parameters ---------- * `property_uri` : @@ -1633,75 +2428,189 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Identified::compare " +%feature("docstring") sbol::Attachment::setPropertyValue " +`setPropertyValue(property_uri, val)` -Compare two SBOL objects or Documents. +Set and overwrite the value for a user-defined annotation property. -The behavior is currently undefined for objects with custom annotations or -extension classes. +Either a literal or URI value +"; + +%feature("docstring") sbol::Attachment::find " +`find(uri) -> SBOLObject *` + +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + The URI to search for. Returns ------- -1 if the objects are identical, 0 if they are different +A pointer to theobject with this URI if it exists, NULL otherwise "; -// File: classsbol_1_1_interaction.xml - - -%feature("docstring") sbol::Interaction " +%feature("docstring") sbol::Attachment::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -The Interaction class provides more detailed descriptionof how the -FunctionalComponents are intended to work together. For example, this class can -be used to represent different forms of genetic regulation (e.g., -transcriptional activation or repression), processes from the central dogma of -biology (e.g. transcription and translation), and other basic molecular -interactions (e.g., non-covalent binding or enzymatic phosphorylation). -"; +Get the value of a custom annotation property by its URI. -%feature("docstring") sbol::Interaction::getClassName " +Parameters +---------- +* `property_uri` : + The URI for the property Returns ------- -Parses a local class name from the RDF-type of this SBOL Object +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Interaction::find " +%feature("docstring") sbol::Attachment::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` -Search this object recursively to see if an object with the URI already exists. +Get all values of a custom annotation property by its URI. Parameters ---------- -* `uri` : - The URI to search for. +* `property_uri` : + The URI for the property Returns ------- -A pointer to theobject with this URI if it exists, NULL otherwise +A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Interaction::copy " +%feature("docstring") sbol::Attachment::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Interaction::Interaction " +%feature("docstring") sbol::Attachment::compare " +`compare(comparand) -> int` -Construct an Interaction. +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. Parameters ---------- -* `uri` : - A full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `interaction_type` : - A Systems Biology Ontology term that describes a biochemical interaction +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::Interaction::getProperties " +// File: classsbol_1_1_build.xml + + +%feature("docstring") sbol::Build " + +A Build is a realization of a Design. For practical purposes, a Build can +represent a biological clone, a plasmid, or other laboratory sample. For a given +Design, there may be multiple Builds realized in the lab. A Build represents the +second step in libSBOL's formalized Design-Build-Test-Analyze workflow. + +Attributes +---------- +* `design` : `ReferencedObject` + A reference to a Design object which represents the intended structure and + function for this Build. + +* `structure` : `OwnedObject< ComponentDefinition >` + The experimentally verified structure of the construct as verified by DNA + sequencing or other analysis. + +* `behavior` : `OwnedObject< ModuleDefinition >` + The observed behavior of the constructed system. + +* `sysbio_type` : `URIProperty` + +* `_structure` : `ReferencedObject` + +* `_behavior` : `ReferencedObject` + +* `built` : `URIProperty` + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/dbtl.h +"; + +%feature("docstring") sbol::Build::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Build::getProperties " +`getProperties() -> std::vector< std::string >` Gets URIs for all properties contained by this object. @@ -1713,7 +2622,8 @@ Returns A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::Interaction::compare " +%feature("docstring") sbol::Build::compare " +`compare(comparand) -> int` Compare two SBOL objects or Documents. @@ -1730,44 +2640,64 @@ Returns 1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::Interaction::find_property " +%feature("docstring") sbol::Build::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Build::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` Search this object recursively to see if it contains a member property with the -given RDF type. +given RDF type and indicated property value. Parameters ---------- * `uri` : - The RDF type of the property to search for. + A URI, either an ontology term or an object reference, to search for Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::Interaction::getPropertyValue " +%feature("docstring") sbol::Build::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` -Get the value of a custom annotation property by its URI. +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied Parameters ---------- -* `property_uri` : - The URI for the property +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +The copied object. "; -%feature("docstring") sbol::Interaction::getTypeURI " - -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::Build::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` "; -%feature("docstring") sbol::Interaction::getPropertyValues " +%feature("docstring") sbol::Build::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` Get all values of a custom annotation property by its URI. @@ -1781,197 +2711,294 @@ Returns A vector of property values or SBOL_ERROR_NOT_FOUND "; -// File: classsbol_1_1_int_property.xml +%feature("docstring") sbol::Build::find " +`find(uri) -> SBOLObject *` +Search this object recursively to see if an object or any child object with URI +already exists. -%feature("docstring") sbol::IntProperty " +Parameters +---------- +* `uri` : + The URI to search for. -IntProperty objects are used to contain integers. +Returns +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; -They can be used as member objects inside custom SBOL Extension classes. +%feature("docstring") sbol::Build::Build " +`Build(uri=\"example\", version=VERSION_STRING)` + +Constructs a new Build from scratch. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". "; -%feature("docstring") sbol::IntProperty::IntProperty " +%feature("docstring") sbol::Build::Build " +`Build(uri, structure, behavior, version=VERSION_STRING)` + +Constructs a new Build. + +The structure and behavior of the Build are initialized. A FunctionalComponent +is autoconstructed which correlates the structure and function. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `structure` : + A ComponentDefinition representing the experimentally verified structure of + the construct as verified by DNA sequencing or other analysis +* `function` : + A ModuleDefiniition representing the observed behavior of the constructed + system +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". "; -%feature("docstring") sbol::IntProperty::get " +%feature("docstring") sbol::Build::getAnnotation " +`getAnnotation(property_uri) -> std::string` -Basic getter for all SBOL literal properties. +Get the value of a custom annotation property by its URI. + +Synonymous with getPropertyValue + +Parameters +---------- +* `property_uri` : + The URI for the property Returns ------- -An integer +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::IntProperty::getOwner " -"; +%feature("docstring") sbol::Build::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -%feature("docstring") sbol::IntProperty::clear " +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. -Remove all children objects from the parent and destroy them. -"; +Parameters +---------- +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match -%feature("docstring") sbol::IntProperty::getAll " +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; -Retrieve a vector of objects from the IntProperty. +%feature("docstring") sbol::Build::setAnnotation " +`setAnnotation(property_uri, val)` -"; +Set the value for a user-defined annotation property. -%feature("docstring") sbol::IntProperty::write " +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::IntProperty::set " +%feature("docstring") sbol::Build::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Basic setter for SBOL IntProperty. +Get the value of a custom annotation property by its URI. Parameters ---------- -* `new_value` : - A new integer value for the property, which is converted to a raw string - during serialization. +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::IntProperty::add " +%feature("docstring") sbol::Build::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` -Appends the new value to a list of values, for properties that allow it. +Copies an object. + +No child objects are copied. Parameters ---------- -* `new_value` : - A new string which will be added to a list of values. +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -// File: classsbol_1_1_referenced_object_1_1iterator.xml +%feature("docstring") sbol::Build::apply " +`apply(callback_fn, user_data)` +"; +%feature("docstring") sbol::Build::addPropertyValue " +`addPropertyValue(property_uri, val)` -%feature("docstring") sbol::ReferencedObject::iterator " +Append a value to a user-defined annotation property. -Provides iterator functionality for SBOL properties that contain multiple -references. +Either a literal or URI value "; +%feature("docstring") sbol::Build::getTypeURI " +`getTypeURI() -> rdf_type` -// File: classsbol_1_1_owned_object_1_1iterator.xml +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; +%feature("docstring") sbol::Build::setPropertyValue " +`setPropertyValue(property_uri, val)` -%feature("docstring") sbol::OwnedObject::iterator " +Set and overwrite the value for a user-defined annotation property. -Provides iterator functionality for SBOL properties that contain multiple -objects. +Either a literal or URI value "; -%feature("docstring") sbol::OwnedObject::iterator::iterator " +%feature("docstring") sbol::Build::~Build " +`~Build()` "; -// File: classsbol_1_1_property_1_1iterator.xml - - -%feature("docstring") sbol::Property::iterator " +%feature("docstring") sbol::Build::getClassName " +`getClassName(type) -> std::string` -Provides iterator functionality for SBOL properties that contain multiple -values. +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Property::iterator::iterator " -"; +%feature("docstring") sbol::Build::generate " +`generate(uri) -> SBOLClass &` -// File: classsbol_1_1_list.xml +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode +templateparam +------------- +* `The` : + type of SBOL object to generate +"; -%feature("docstring") sbol::List " +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` -Provides interface for an SBOL container Property that is allowed to have more -than one object or value. +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode templateparam ------------- -* `PropertyType` : - The type of SBOL Property, eg, Text, Int, OwnedObject, etc +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::List::List " +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Design &` "; -// File: classsbol_1_1_location.xml +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Build &` +"; -%feature("docstring") sbol::Location " +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -The Location class specifies the strand orientation of a Component and can be -further extended by the Range, Cut, and GenericLocation classes. +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Test &` "; -%feature("docstring") sbol::Location::copy " +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Test &` "; -%feature("docstring") sbol::Location::find " +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Analysis &` +"; -Search this object recursively to see if an object with the URI already exists. +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -Parameters ----------- -* `uri` : - The URI to search for. +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Design &` +"; -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Design &` "; -%feature("docstring") sbol::Location::getPropertyValue " +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Build &` +"; -Get the value of a custom annotation property by its URI. +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Parameters ----------- -* `property_uri` : - The URI for the property +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Test &` +"; -Returns -------- -The value of the property or SBOL_ERROR_NOT_FOUND +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Test &` "; -%feature("docstring") sbol::Location::getProperties " +%feature("docstring") sbol::Build::generate " +`generate(uri) -> Analysis &` +"; -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +%feature("docstring") sbol::Build::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; -Returns -------- -A vector of URIs that identify the properties contained in this object +%feature("docstring") sbol::Build::generate " +`generate() -> SBOLClass &` "; -%feature("docstring") sbol::Location::getClassName " +%feature("docstring") sbol::Build::close " +`close()` -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object -"; +Use this method to destroy an SBOL object that is not contained by a parent +Document. -%feature("docstring") sbol::Location::Location " +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. "; -%feature("docstring") sbol::Location::compare " - -Compare two SBOL objects or Documents. - -The behavior is currently undefined for objects with custom annotations or -extension classes. - -Parameters ----------- -* `comparand` : - A pointer to the object being compared to this one. - -Returns -------- -1 if the objects are identical, 0 if they are different -"; - -%feature("docstring") sbol::Location::find_property " +%feature("docstring") sbol::Build::find_property " +`find_property(uri) -> SBOLObject *` Search this object recursively to see if it contains a member property with the given RDF type. @@ -1987,43 +3014,103 @@ A pointer to the object that contains a member property with the specified RDF type, NULL otherwise "; -%feature("docstring") sbol::Location::getPropertyValues " - -Get all values of a custom annotation property by its URI. - -Parameters ----------- -* `property_uri` : - The URI for the property +%feature("docstring") sbol::Build::update_uri " +`update_uri()` +"; -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +%feature("docstring") sbol::Build::cast " +`cast() -> SBOLClass &` "; -%feature("docstring") sbol::Location::getTypeURI " +// File: classsbol_1_1_collection.xml -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object -"; -// File: classsbol_1_1_maps_to.xml +%feature("docstring") sbol::Collection " +The Collection class is a class that groups together a set of TopLevel objects +that have something in common. -%feature("docstring") sbol::MapsTo " +Some examples of Collection objects: . Results of a query to find all +ComponentDefinition objects in a repository that function as promoters . A set +of ModuleDefinition objects representing a library of genetic logic gates. . A +ModuleDefinition for a complexdesign, and all of the ModuleDefinition, +ComponentDefinition, Sequence, and Model objects used to provide its full +specification. -The purpose of the MapsTo class is to make identity relationships between -different ComponentInstances in functional and structural hierarchies more -clear. For example, a MapsTo object may be used to connect outputs and inputs -between different low-level ModuleDefinitions contained in a higher level Module -Definition. A MapsTo object may also be used to override a generic Component in -a low-level ModuleDefinition with an explicit Component in a high-level -ModuleDefinition, for example mapping a generic gene to an explicit component -with a name and sequence. +Attributes +---------- +* `members` : `URIProperty` + The members property of a Collection is OPTIONAL and MAY contain a set of + URI references to zero or more TopLevel objects. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/collection.h "; -%feature("docstring") sbol::MapsTo::find_property " +%feature("docstring") sbol::Collection::find_property " +`find_property(uri) -> SBOLObject *` Search this object recursively to see if it contains a member property with the given RDF type. @@ -2039,39 +3126,25 @@ A pointer to the object that contains a member property with the specified RDF type, NULL otherwise "; -%feature("docstring") sbol::MapsTo::copy " -"; - -%feature("docstring") sbol::MapsTo::getClassName " - -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object -"; - -%feature("docstring") sbol::MapsTo::compare " - -Compare two SBOL objects or Documents. +%feature("docstring") sbol::Collection::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` -The behavior is currently undefined for objects with custom annotations or -extension classes. +Get all values of a custom annotation property by its URI. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `property_uri` : + The URI for the property Returns ------- -1 if the objects are identical, 0 if they are different +A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::MapsTo::MapsTo " - -Construct a MapsTo. +%feature("docstring") sbol::Collection::Collection " +`Collection(uri=\"example\", version=VERSION_STRING)` -If operating in SBOL-compliant mode, use ModuleDefinition::mapsTos::create -instead. +Construct a Collection. Parameters ---------- @@ -2080,206 +3153,222 @@ Parameters scheme, namespace, and identifier. If SBOLCompliance configuration is enabled, then this argument is simply the displayId for the new object and a full URI will automatically be constructed. -* `local` : - The identity of the lower level ComponentInstance -* `remote` : - The identity of the higher level ComponentInstance -* `restriction` : - Flag indicating the relationship between high- and low-level - ComponentInstances. By default, this is set to - SBOL_REFINEMENT_VERIFY_IDENTICAL "; -%feature("docstring") sbol::MapsTo::getPropertyValues " +%feature("docstring") sbol::Collection::Collection " +`Collection(type, uri, version)` -Get all values of a custom annotation property by its URI. +Constructor used for defining extension classes. Parameters ---------- -* `property_uri` : - The URI for the property - -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +* `rdf_type` : + The RDF type for an extension class derived from this one "; -%feature("docstring") sbol::MapsTo::getProperties " - -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> SBOLClass &` -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A vector of URIs that identify the properties contained in this object +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::MapsTo::find " - -Search this object recursively to see if an object with the URI already exists. +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` Parameters ---------- * `uri` : - The URI to search for. + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::MapsTo::getPropertyValue " - -Get the value of a custom annotation property by its URI. +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Design &` +"; -Parameters ----------- -* `property_uri` : - The URI for the property +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -Returns -------- -The value of the property or SBOL_ERROR_NOT_FOUND +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Build &` "; -%feature("docstring") sbol::MapsTo::getTypeURI " +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Test &` "; -// File: classsbol_1_1_model.xml +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Analysis &` +"; -%feature("docstring") sbol::Model " +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -The purpose of the Model class is to serve as a placeholder for an external -computational model and provide additional meta-data to enable better reasoning -about the contents of this model. +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Design &` +"; -In this way, there is minimal duplication of standardization efforts and users -of SBOL can formalize the function of a ModuleDefinition in the language of -their choice. +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Design &` "; -%feature("docstring") sbol::Model::find " +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Build &` +"; -Search this object recursively to see if an object with the URI already exists. +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Parameters ----------- -* `uri` : - The URI to search for. +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Test &` +"; -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Test &` "; -%feature("docstring") sbol::Model::getProperties " +%feature("docstring") sbol::Collection::generate " +`generate(uri) -> Analysis &` +"; -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +%feature("docstring") sbol::Collection::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; -Returns -------- -A vector of URIs that identify the properties contained in this object +%feature("docstring") sbol::Collection::generate " +`generate() -> SBOLClass &` "; -%feature("docstring") sbol::Model::compare " +%feature("docstring") sbol::Collection::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` -Compare two SBOL objects or Documents. +Copies an object. -The behavior is currently undefined for objects with custom annotations or -extension classes. +No child objects are copied. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -1 if the objects are identical, 0 if they are different +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -%feature("docstring") sbol::Model::getPropertyValues " - -Get all values of a custom annotation property by its URI. - -Parameters ----------- -* `property_uri` : - The URI for the property +%feature("docstring") sbol::Collection::setAnnotation " +`setAnnotation(property_uri, val)` -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND -"; +Set the value for a user-defined annotation property. -%feature("docstring") sbol::Model::addToDocument " -Add the Model object to Document +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::Model::Model " +%feature("docstring") sbol::Collection::initialize " +`initialize(uri)` "; -%feature("docstring") sbol::Model::getClassName " - -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +%feature("docstring") sbol::Collection::cast " +`cast() -> SBOLClass &` "; -%feature("docstring") sbol::Model::getPropertyValue " +%feature("docstring") sbol::Collection::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -Get the value of a custom annotation property by its URI. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::Model::getTypeURI " +%feature("docstring") sbol::Collection::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Collection::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. Returns ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::Model::find_property " +%feature("docstring") sbol::Collection::find " +`find(uri) -> SBOLObject *` -Search this object recursively to see if it contains a member property with the -given RDF type. +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- * `uri` : - The RDF type of the property to search for. + The URI to search for. Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::Model::copy " +%feature("docstring") sbol::Collection::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` -Copy an object and automatically increment its version. +Recursively copies an object. -If the optional version argument is specified, it will be used instead of -incrementing the copied object's version. An object may also be copied into a -new document and a new namespace, assuming compliant URIs. +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). templateparam ------------- @@ -2292,85 +3381,76 @@ Parameters The new copies will be attached to this Document. NULL by default. * `ns` : This namespace will be substituted for the current namespace (as configured - by setHomespace) in all SBOL-compliat URIs. + by setHomespace) in all SBOL-compliant URIs. * `version` : A new version Returns ------- -The full URI of the created object. +The copied object. "; +%feature("docstring") sbol::Collection::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; -// File: classsbol_1_1_module.xml +%feature("docstring") sbol::Collection::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. -%feature("docstring") sbol::Module " +Parameters +---------- +* `uri` : + A URI, either an ontology term or an object reference, to search for -The Module class represents a submodule of a ModuleDefinition within a -hierarchical design. +Returns +------- +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::Module::getPropertyValues " - -Get all values of a custom annotation property by its URI. +%feature("docstring") sbol::Collection::close " +`close()` -Parameters ----------- -* `property_uri` : - The URI for the property +Use this method to destroy an SBOL object that is not contained by a parent +Document. -Returns -------- -A vector of property values or SBOL_ERROR_NOT_FOUND +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. "; -%feature("docstring") sbol::Module::Module " - -Construct a Module. +%feature("docstring") sbol::Collection::setPropertyValue " +`setPropertyValue(property_uri, val)` -If operating in SBOL-compliant mode, use ModuleDefinition::modules::create -instead. +Set and overwrite the value for a user-defined annotation property. -Parameters ----------- -* `uri` : - If operating in open-world mode, this should be a full URI including a - scheme, namespace, and identifier. If SBOLCompliance configuration is - enabled, then this argument is simply the displayId for the new object and a - full URI will automatically be constructed. -* `definition` : - The identity of the Component with this structural constraint -* `version` : - An arbitrary version string. If SBOLCompliance is enabled, this should be a - Maven version string of the form \"major.minor.patch\". +Either a literal or URI value "; -%feature("docstring") sbol::Module::getClassName " - -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +%feature("docstring") sbol::Collection::apply " +`apply(callback_fn, user_data)` "; -%feature("docstring") sbol::Module::compare " +%feature("docstring") sbol::Collection::addPropertyValue " +`addPropertyValue(property_uri, val)` -Compare two SBOL objects or Documents. +Append a value to a user-defined annotation property. -The behavior is currently undefined for objects with custom annotations or -extension classes. +Either a literal or URI value +"; -Parameters ----------- -* `comparand` : - A pointer to the object being compared to this one. +%feature("docstring") sbol::Collection::update_uri " +`update_uri()` +"; -Returns -------- -1 if the objects are identical, 0 if they are different +%feature("docstring") sbol::Collection::~Collection " +`~Collection()` "; -%feature("docstring") sbol::Module::getProperties " +%feature("docstring") sbol::Collection::getProperties " +`getProperties() -> std::vector< std::string >` Gets URIs for all properties contained by this object. @@ -2382,28 +3462,8 @@ Returns A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::Module::getTypeURI " - -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object -"; - -%feature("docstring") sbol::Module::find " - -Search this object recursively to see if an object with the URI already exists. - -Parameters ----------- -* `uri` : - The URI to search for. - -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise -"; - -%feature("docstring") sbol::Module::getPropertyValue " +%feature("docstring") sbol::Collection::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` Get the value of a custom annotation property by its URI. @@ -2417,67 +3477,29 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Module::copy " -"; - -%feature("docstring") sbol::Module::find_property " - -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. +%feature("docstring") sbol::Collection::getTypeURI " +`getTypeURI() -> rdf_type` Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise -"; - -// File: classsbol_1_1_module_definition.xml - - -%feature("docstring") sbol::ModuleDefinition " - -The ModuleDefinition class represents a grouping of structural and functional -entities in a biological design. The primary usage of this class is to assert -the molecular interactions and abstract function of its child entities. +The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::ModuleDefinition::copy " - -Copy an object and automatically increment its version. - -If the optional version argument is specified, it will be used instead of -incrementing the copied object's version. An object may also be copied into a -new document and a new namespace, assuming compliant URIs. - -templateparam -------------- -* `SBOLClass` : - The type of SBOL object being copied - -Parameters ----------- -* `new_doc` : - The new copies will be attached to this Document. NULL by default. -* `ns` : - This namespace will be substituted for the current namespace (as configured - by setHomespace) in all SBOL-compliat URIs. -* `version` : - A new version +%feature("docstring") sbol::Collection::getClassName " +`getClassName(type) -> std::string` Returns ------- -The full URI of the created object. +Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::ModuleDefinition::getPropertyValue " +%feature("docstring") sbol::Collection::getAnnotation " +`getAnnotation(property_uri) -> std::string` Get the value of a custom annotation property by its URI. +Synonymous with getPropertyValue + Parameters ---------- * `property_uri` : @@ -2488,61 +3510,165 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::ModuleDefinition::assemble " +// File: classsbol_1_1_combinatorial_derivation.xml -Assemble a high-level ModuleDefinition from lower-level submodules. -Autoconstructs Module objects in the process. +%feature("docstring") sbol::CombinatorialDerivation " -Parameters ----------- -* `list_of_modules` : - A list of pointers to the submodule ModuleDefinitions -"; +A ComponentDeriviation specifies the composition of a combinatorial design or +variant library for common use cases in synthetic biology, such as tuning the +performance of a genetic circuit or biosynthetic pathway through combinatorial +DNA assembly and screening. -%feature("docstring") sbol::ModuleDefinition::getPropertyValues " +Attributes +---------- +* `strategy` : `URIProperty` + The `strategy` property is OPTIONAL and has a data type of URI. + + Table 1 provides a list of REQUIRED strategy URIs. If the `strategy` + property is not empty, then it MUST contain a URI from Table 1. This + property recommends how many `ComponentDefinition` objects a user SHOULD + derive from the `template` `ComponentDefinition`. + Strategy URI + + Description + + http://sbols.org/v2#enumerate + + A user SHOULD derive all `ComponentDefinition` objects with a unique + substructure as specified by the `Component` objects contained by the + `template` `ComponentDefinition` and the `VariableComponent` objects + contained by the `CombinatorialDerivation`. + + http://sbols.org/v2#sample + + A user SHOULD derive a subset of all `ComponentDefinition` objects with a + unique substructure as specified by the `Component` objects contained by the + `template` `ComponentDefinition` and the `VariableComponent` objects + contained by the `CombinatorialDerivation`. The manner in which this subset + is chosen is for the user to decide. + +* `masterTemplate` : `ReferencedObject` + The `master` property is REQUIRED and MUST contain a URI that refers to a + ComponentDefinition. This ComponentDefinition is expected to serve as a + template for the derivation of new ComponentDefinition objects. + Consequently, its components property SHOULD contain one or more Component + objects that describe its substructure (referred to hereafter as template + Component objects), and its sequenceConstraints property MAY also contain + one or more SequenceConstraint objects that constrain this substructure. + +* `variableComponents` : `OwnedObject< VariableComponent >` + VariableComponent objects denote the choices available when deriving the + library of variants specified by a CombinatorialDerivation. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/combinatorialderivation.h +"; + +%feature("docstring") sbol::CombinatorialDerivation::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -Get all values of a custom annotation property by its URI. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match Returns ------- -A vector of property values or SBOL_ERROR_NOT_FOUND +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::ModuleDefinition::getProperties " - -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::CombinatorialDerivation::addToDocument " +`addToDocument(arg1)` +"; -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +%feature("docstring") sbol::CombinatorialDerivation::getClassName " +`getClassName(type) -> std::string` Returns ------- -A vector of URIs that identify the properties contained in this object +Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::ModuleDefinition::setInput " - -Defines an input for a system module. +%feature("docstring") sbol::CombinatorialDerivation::setAnnotation " +`setAnnotation(property_uri, val)` -Parameters ----------- -* `input` : - A ComponentDefinition that defines the input +Set the value for a user-defined annotation property. -Returns -------- -A FunctionalComponent that is derived from the argument ComponentDefinition and -configured as this ModuleDefinition's input (it's direction property is set to -SBOL_DIRECTION_IN) +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::ModuleDefinition::find_property " +%feature("docstring") sbol::CombinatorialDerivation::find_property " +`find_property(uri) -> SBOLObject *` Search this object recursively to see if it contains a member property with the given RDF type. @@ -2558,292 +3684,598 @@ A pointer to the object that contains a member property with the specified RDF type, NULL otherwise "; -%feature("docstring") sbol::ModuleDefinition::compare " - -Compare two SBOL objects or Documents. +%feature("docstring") sbol::CombinatorialDerivation::addPropertyValue " +`addPropertyValue(property_uri, val)` -The behavior is currently undefined for objects with custom annotations or -extension classes. +Append a value to a user-defined annotation property. -Parameters ----------- -* `comparand` : - A pointer to the object being compared to this one. +Either a literal or URI value +"; -Returns -------- -1 if the objects are identical, 0 if they are different +%feature("docstring") sbol::CombinatorialDerivation::apply " +`apply(callback_fn, user_data)` "; -%feature("docstring") sbol::ModuleDefinition::getClassName " +%feature("docstring") sbol::CombinatorialDerivation::close " +`close()` -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. "; -%feature("docstring") sbol::ModuleDefinition::setOutput " +%feature("docstring") sbol::CombinatorialDerivation::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` -Defines an output for a system module. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `output` : - A ComponentDefinition that defines the output +* `uri` : + A URI, either an ontology term or an object reference, to search for Returns ------- -A FunctionalComponent that is derived from the argument ComponentDefinition and -configured as this ModuleDefinition's output (it's direction property is set to -SBOL_DIRECTION_OUT) +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::ModuleDefinition::find " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; -Search this object recursively to see if an object with the URI already exists. +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` Parameters ---------- * `uri` : - The URI to search for. + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::ModuleDefinition::getTypeURI " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Design &` +"; -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Design &` "; -%feature("docstring") sbol::ModuleDefinition::ModuleDefinition " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Build &` +"; -Construct a ModuleDefinition. +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Parameters ----------- -* `uri` : - A full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `version` : - An arbitrary version string. If SBOLCompliance is enabled, this should be a - valid Maven version string. +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Test &` "; -%feature("docstring") sbol::ModuleDefinition::addToDocument " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -Add the ModuleDefinition object to Document +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Analysis &` "; -// File: classsbol_1_1_owned_object.xml +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Design &` +"; +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -%feature("docstring") sbol::OwnedObject " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Build &` +"; -A container property that contains child objects. +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; -Creates a composition out of two or more classes. In the SBOL specification, -compositional relationships are indicated in class diagrams by arrows with black -diamonds. A compositional relationship means that deleting the parent object -will delete the child objects, and adding the parent object to a Document will -also add the child object. Owned objects are stored in arbitrary order. +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Test &` +"; -templateparam -------------- -* `SBOLClass` : - The type of child SBOL object contained by this Property +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Test &` "; -%feature("docstring") sbol::OwnedObject::validate " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri) -> Analysis &` "; -%feature("docstring") sbol::OwnedObject::write " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> Analysis &` "; -%feature("docstring") sbol::OwnedObject::remove " +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; -Remove an object from the list of objects and destroy it. +%feature("docstring") sbol::CombinatorialDerivation::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::CombinatorialDerivation::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::CombinatorialDerivation::CombinatorialDerivation " +`CombinatorialDerivation(uri=\"example\", + strategy=\"http://sbols.org/v2#enumerate\", version=VERSION_STRING)` + +Constructor. Parameters ---------- * `uri` : - The identity of the object to be destroyed. This can be a displayId of the - object or a full URI may be provided. -* `index` : - A numerical index for the object. + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `strategy` : + A URI indicating SBOL_ENUMERATE or SBOL_SAMPLE "; -%feature("docstring") sbol::OwnedObject::get " +%feature("docstring") sbol::CombinatorialDerivation::CombinatorialDerivation " +`CombinatorialDerivation(type, uri, strategy, version)` -Get the child object. +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::CombinatorialDerivation::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). templateparam ------------- * `SBOLClass` : - The type of the child object -* `SBOLSubClass` : - A derived class of SBOLClass. Use this type specialization when adding - multiple types of SBOLObjects to a container. + The type of SBOL object being copied Parameters ---------- -* `uri` : - The specific URI for a child object if this OwnedObject property contains - multiple objects, +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version Returns ------- -A reference to the child object Returns a child object from the OwnedObject -property. If no URI is specified, the first object in this OwnedObject property -is returned. +The copied object. "; -%feature("docstring") sbol::OwnedObject::OwnedObject " +%feature("docstring") sbol::CombinatorialDerivation::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` "; -%feature("docstring") sbol::OwnedObject::create " +%feature("docstring") sbol::CombinatorialDerivation::initialize " +`initialize(uri)` +"; -templateparam -------------- -* `SBOLClass` : - The type of SBOL object contained in this OwnedObject property -* `SBOLSubClass` : - A derived class of SBOLClass. Use this specialization for OwnedObject - properties which contain multiple types of SBOLObjects. +%feature("docstring") sbol::CombinatorialDerivation::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::CombinatorialDerivation::find " +`find(uri) -> SBOLObject *` + +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- * `uri` : - If SBOLCompliance is enabled, this should be the displayId for the new child - object. If not enabled, this should be a full raw URI. + The URI to search for. Returns ------- -A reference to the child object Autoconstructs a child object and attaches it to -the parent object. The new object will be constructed with default values -specified in the constructor for this type of object. If SBOLCompliance is -enabled, the child object's identity will be constructed using the supplied -displayId argument. Otherwise, the user should supply a full URI. check -uniqueness of URI in Document +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::OwnedObject::set " +%feature("docstring") sbol::CombinatorialDerivation::getProperties " +`getProperties() -> std::vector< std::string >` + +Gets URIs for all properties contained by this object. -Basic setter for OwnedObject SBOL IntProperty. +This includes SBOL core properties as well as custom annotations. Use this to +find custom extension data in an SBOL file. -templateparam -------------- -* `SBOLClass` : - The type of SBOL object contained in this OwnedObject property +Returns +------- +A vector of URIs that identify the properties contained in this object +"; + +%feature("docstring") sbol::CombinatorialDerivation::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. Parameters ---------- -* `sbol_obj` : - A child object to add to this container property. Assigns a child object to - this OwnedObject container property. This method always overwrites the first - SBOLObject in the container. appends another object to those already - contained in this OwnedObject property. In SBOLCompliant mode, the create - method is preferred -* `sbol_obj` : - The child object Sets the first object in the container +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -%feature("docstring") sbol::OwnedObject::clear " +%feature("docstring") sbol::CombinatorialDerivation::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` -Remove all children objects from the parent and destroy them. +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::OwnedObject::getAll " +%feature("docstring") sbol::CombinatorialDerivation::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Retrieve a vector of objects from the OwnedObject. +Get the value of a custom annotation property by its URI. -"; +Parameters +---------- +* `property_uri` : + The URI for the property -%feature("docstring") sbol::OwnedObject::getOwner " +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::OwnedObject::getTypeURI " +%feature("docstring") sbol::CombinatorialDerivation::getTypeURI " +`getTypeURI() -> rdf_type` Returns ------- The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::OwnedObject::getObjects " +%feature("docstring") sbol::CombinatorialDerivation::setPropertyValue " +`setPropertyValue(property_uri, val)` -Get all the objects contained in the property. +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::CombinatorialDerivation::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Synonymous with getPropertyValue + +Parameters +---------- +* `property_uri` : + The URI for the property Returns ------- -A vector of pointers to the objects +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::OwnedObject::add " +%feature("docstring") sbol::CombinatorialDerivation::update_uri " +`update_uri()` +"; -Appends the new value to a list of values, for properties that allow it. +// File: classsbol_1_1_component.xml -templateparam -------------- -* `SBOLClass` : - The type of SBOL object contained in this OwnedObject property -* `SBOLSubClass` : - A derived class of SBOLClass. Use this type specialization when adding - multiple types of SBOLObjects to a container. -Parameters +%feature("docstring") sbol::Component " + +The Component class is used to compose ComponentDefinition objects into a +structural hierarchy. For example, the ComponentDefinition of a gene could +contain four Component objects: a promoter, RBS, CDS, and terminator. In turn, +the ComponentDefinition of the promoter Component could contain Component +objects defined as various operator sites. + +Attributes ---------- -* `sbol_obj` : - A child object to add to this container property. Adds a child object to the - parent object. This method always appends another object to those already - contained in this OwnedObject property. In SBOLCompliant mode, the create - method is preferred +* `roles` : `URIProperty` + The expected purpose and function of a genetic part are described by the + roles property of ComponentDefinition. + + However, the same building block might be used for a different purpose in an + actual design. In other words, purpose and function are sometimes determined + by context. The roles property comprises an OPTIONAL set of zero or more + role URIs describing the purpose or potential function of this Components + included sub-ComponentDefinition in the context of its parent + ComponentDefinition. If provided, these role URIs MUST identify terms from + appropriate ontologies. Roles are not restricted to describing biological + function; they may annotate a Components function in any domain for which + an ontology exists. It is RECOMMENDED that these role URIs identify terms + that are compatible with the type properties of both this Components parent + ComponentDefinition and its included sub-ComponentDefinition. For example, a + role of a Component which belongs to a ComponentDefinition of type DNA and + includes a sub-ComponentDefinition of type DNA might refer to terms from the + Sequence Ontology. See documentation for ComponentDefinition for a table of + recommended ontology terms for roles. + +* `roleIntegration` : `URIProperty` + A roleIntegration specifies the relationship between a Component instances + own set of roles and the set of roles on the included sub- + ComponentDefinition. + + The roleIntegration property has a data type of URI. A Component instance + with zero roles MAY OPTIONALLY specify a roleIntegration. A Component + instance with one or more roles MUST specify a roleIntegration from the + table below If zero Component roles are given and no Component + roleIntegration is given, then http://sbols.org/v2#mergeRoles is assumed. It + is RECOMMENDED to specify a set of Component roles only if the integrated + result set of roles would differ from the set of roles belonging to this + Components included sub-ComponentDefinition. + roleIntegration URI + + Description + + http://sbols.org/v2#overrideRoles + + In the context of this Component, ignore any roles given for the included + sub-ComponentDefinition. + + + Instead use only the set of zero or more roles given for this Component. + + http://sbols.org/v2#mergeRoles + + Use the union of the two sets: both the set of zero or more roles given for + this Component as well + + + as the set of zero or more roles given for the included sub- + ComponentDefinition. + +* `definition` : `ReferencedObject` + The definition property is a REQUIRED URI that refers to the + ComponentDefinition of the ComponentInstance. + + As described in the previous section, this ComponentDefinition effectively + provides information about the types and roles of the ComponentInstance. The + definition property MUST NOT refer to the same ComponentDefinition as the + one that contains the ComponentInstance. Furthermore, ComponentInstance + objects MUST NOT form a cyclical chain of references via their definition + properties and the ComponentDefinition objects that contain them. For + example, consider the ComponentInstance objects A and B and the + ComponentDefinition objects X and Y . The reference chain X contains A, A + isdefinedby Y, Y contains B, and B isdefinedby X iscyclical. + +* `access` : `URIProperty` + The access property is a REQUIRED URI that indicates whether the + ComponentInstance can be referred to remotely by a MapsTo. + + The value of the access property MUST be one of the following URIs. + Access URI + + Description + + http://sbols.org/v2#public + + The ComponentInstance MAY be referred to by remote MapsTo objects + + http://sbols.org/v2#private + + The ComponentInstance MAY be referred to by remote MapsTo objects + +* `mapsTos` : `OwnedObject< MapsTo >` + The mapsTos property is OPTIONAL and MAY contain a set of MapsTo objects + that refer to and link together ComponentInstance objects (both Component + objects and FunctionalComponent objects) within a larger design. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/component.h "; +%feature("docstring") sbol::Component::setPropertyValue " +`setPropertyValue(property_uri, val)` -// File: classsbol_1_1_participation.xml +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; +%feature("docstring") sbol::Component::setAnnotation " +`setAnnotation(property_uri, val)` -%feature("docstring") sbol::Participation " +Set the value for a user-defined annotation property. -Each Participation represents how a particular FunctionalComponent behaves in -its parent Interaction. +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::Participation::Participation " +%feature("docstring") sbol::Component::find " +`find(uri) -> SBOLObject *` -Constructor. +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- * `uri` : - A full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `participant` : - A reference to the participating FunctionalComponent in the parent - Interaction + The URI to search for. + +Returns +------- +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::Participation::Participation " +%feature("docstring") sbol::Component::cast " +`cast() -> SBOLClass &` "; -%feature("docstring") sbol::Participation::getProperties " +%feature("docstring") sbol::Component::Component " +`Component(uri=\"example\", definition=\"\", access=SBOL_ACCESS_PUBLIC, + version=VERSION_STRING)` -Gets URIs for all properties contained by this object. +Construct a Component. -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +If operating in SBOL-compliant mode, use ComponentDefinition::components::create +instead. + +Parameters +---------- +* `A` : + full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `definition` : + A URI referring to the ComponentDefinition that defines this instance +* `access` : + Flag indicating whether the Component can be referred to remotely by a + MapsTo +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::Component::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property Returns ------- -A vector of URIs that identify the properties contained in this object +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Participation::getPropertyValues " +%feature("docstring") sbol::Component::~Component " +`~Component()` +"; + +%feature("docstring") sbol::Component::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` Get all values of a custom annotation property by its URI. @@ -2857,45 +4289,15793 @@ Returns A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Participation::find " +%feature("docstring") sbol::Component::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Component::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` -Search this object recursively to see if an object with the URI already exists. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- * `uri` : - The URI to search for. + A URI, either an ontology term or an object reference, to search for Returns ------- -A pointer to theobject with this URI if it exists, NULL otherwise +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::Participation::compare " - -Compare two SBOL objects or Documents. +%feature("docstring") sbol::Component::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -The behavior is currently undefined for objects with custom annotations or -extension classes. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Component::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Component::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Component::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Component::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Component::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Component::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Component::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Component::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Component::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Component::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Component::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +// File: classsbol_1_1_component_definition.xml + + +%feature("docstring") sbol::ComponentDefinition " + +The ComponentDefinition class represents the structural entities of a biological +design. + +The primary usage of this class is to represent structural entities with +designed sequences, such as DNA, RNA, and proteins, but it can also be used to +represent any other entity that is part of a design, such as small molecules, +proteins, and complexes + +Attributes +---------- +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that specifies the category of + biochemical or physical entity (for example DNA, protein, or small molecule) + that a ComponentDefinition object abstracts for the purpose of engineering + design. + + The types property of every ComponentDefinition MUST contain one or more + URIs that MUST identify terms from appropriate ontologies, such as the + BioPAX ontology or the ontology of Chemical Entities of Biological Interest. + See the table below for examples. + Type + + URI for BioPAX Term + + LibSBOL symbol + + DNA + + http://www.biopax.org/release/biopax-level3.owl#DnaRegion + + BIOPAX_DNA + + RNA + + http://www.biopax.org/release/biopax-level3.owl#RnaRegion + + BIOPAX_RNA + + Protein + + http://www.biopax.org/release/biopax-level3.owl#Protein + + BIOPAX_PROTEIN + + Small Molecule + + http://www.biopax.org/release/biopax-level3.owl#SmallMolecule + + BIOPAX_SMALL_MOLECULE + + Complex + + http://www.biopax.org/release/biopax-level3.owl#Complex + + BIOPAX_COMPLEX + +* `roles` : `URIProperty` + The roles property is an OPTIONAL set of URIs that clarifies the potential + function of the entity represented by a ComponentDefinition in a biochemical + or physical context. + + The roles property of a ComponentDefinition MAY contain one or more URIs + that MUST identify terms from ontologies that are consistent with the types + property of the ComponentDefinition. For example, the roles property of a + DNA or RNA ComponentDefinition could contain URIs identifying terms from the + Sequence Ontology (SO). See the table below for common examples + Role + + URI for Sequence Ontology Term + + LibSBOL symbol + + Miscellaneous + + http://identifiers.org/so/SO:0000001 + + SO_MISC + + Promoter + + http://identifiers.org/so/SO:0000167 + + SO_PROMOTER + + RBS + + http://identifiers.org/so/SO:0000139 + + SO_RBS + + CDS + + http://identifiers.org/so/SO:0000316 + + SO_CDS + + Terminator + + http://identifiers.org/so/SO:0000141 + + SO_TERMINATOR + + Gene + + http://identifiers.org/so/SO:0000704 + + + Operator + + http://identifiers.org/so/SO:0000057 + + + Engineered Gene + + http://identifiers.org/so/SO:0000280 + + + mRNA + + http://identifiers.org/so/SO:0000234 + + + Effector + + http://identifiers.org/chebi/CHEBI:35224 + + +* `components` : `OwnedObject< Component >` + The components property is OPTIONAL and MAY specify a set of Component + objects that are contained by the ComponentDefinition. The components + properties of ComponentDefinition objects can be used to construct a + hierarchy of Component and ComponentDefinition objects. If a + ComponentDefinition in such a hierarchy refers to one or more Sequence + objects, and there exist ComponentDefinition objects lower in the hierarchy + that refer to Sequence objects with the same encoding, then the elements + properties of these Sequence objects SHOULD be consistent with each other, + such that well-defined mappings exist from the lower level elements to the + higher level elements. This mapping is also subject to any restrictions on + the positions of the Component objects in the hierarchy that are imposed by + the SequenceAnnotation or SequenceConstraint objects contained by the + ComponentDefinition objects in the hierarchy. The set of relations between + Component and ComponentDefinition objects is strictly acyclic. + +* `sequences` : `ReferencedObject` + The sequences property is OPTIONAL and MAY include a URI that refer to a + Sequence object. The referenced object defines the primary structure of the + ComponentDefinition. + +* `sequence` : `OwnedObject< Sequence >` + +* `sequenceAnnotations` : `OwnedObject< SequenceAnnotation >` + The sequenceAnnotations property is OPTIONAL and MAY contain a set of + SequenceAnnotation objects. Each SequenceAnnotation specifies and describes + a potentially discontiguous region on the Sequence objects referred to by + the ComponentDefinition. + +* `sequenceConstraints` : `OwnedObject< SequenceConstraint >` + The sequenceConstraints property is OPTIONAL and MAY contain a set of + SequenceConstraint objects. These objects describe any restrictions on the + relative, sequence-based positions and/or orientations of the Component + objects contained by the ComponentDefinition. For example, the + ComponentDefinition of a gene might specify that the position of its + promoter Component precedes that of its CDS Component. This is particularly + useful when a ComponentDefinition lacks a Sequence and therefore cannot + specify the precise, sequence-based positions of its Component objects using + SequenceAnnotation objects. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/componentdefinition.h +"; + +%feature("docstring") sbol::ComponentDefinition::participate " +`participate(species)` + +A convenience method that assigns a component to participate in a biochemical +reaction. + +Behind the scenes, it auto-constructs a FunctionalComponent for this +ComponentDefinition and assigns it to a Participation + +Parameters +---------- +* `species` : + A Participation object (ie, participant species in a biochemical + Interaction). +"; + +%feature("docstring") sbol::ComponentDefinition::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::ComponentDefinition::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::ComponentDefinition::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::ComponentDefinition::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::ComponentDefinition::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::ComponentDefinition::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::ComponentDefinition::getLastComponent " +`getLastComponent() -> Component &` + +Gets the last Component in a linear sequence. + +Returns +------- +The last component in sequential order +"; + +%feature("docstring") sbol::ComponentDefinition::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::ComponentDefinition::hasDownstreamComponent " +`hasDownstreamComponent(current_component) -> int` + +Checks if the specified Component has a Component downstream in linear +arrangement on the DNA strand. + +Checks that the appropriate SequenceConstraint exists. + +Parameters +---------- +* `current_component` : + A Component in this ComponentDefinition + +Returns +------- +1 if found, 0 if not +"; + +%feature("docstring") sbol::ComponentDefinition::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::ComponentDefinition::linearize " +`linearize(list_of_components={})` +"; + +%feature("docstring") sbol::ComponentDefinition::linearize " +`linearize(list_of_uris)` +"; + +%feature("docstring") sbol::ComponentDefinition::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::ComponentDefinition::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::ComponentDefinition::updateSequence " +`updateSequence(composite_sequence=\"\") -> std::string` + +Assemble a parent ComponentDefinition's Sequence from its subcomponent +Sequences. + +Parameters +---------- +* `composite_sequence` : + A recursive parameter, use default value + +Returns +------- +The assembled parent sequence +"; + +%feature("docstring") sbol::ComponentDefinition::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::ComponentDefinition::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::ComponentDefinition::hasUpstreamComponent " +`hasUpstreamComponent(current_component) -> int` + +Checks if the specified Component has a Component upstream in linear arrangement +on the DNA strand. + +Checks that the appropriate SequenceConstraint exists. + +Parameters +---------- +* `current_component` : + A Component in this ComponentDefinition + +Returns +------- +1 if found, 0 if not +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::ComponentDefinition::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::ComponentDefinition::addDownstreamFlank " +`addDownstreamFlank(target, elements)` + +This may be a useful method when building up SBOL representations of natural DNA +sequences. + +For example it is often necessary to specify components that are assumed to have +no meaningful role in the design, but are nevertheless important to fill in +regions of sequence. This method autoconstructs a ComponentDefinition and +Sequence object to create an arbitrary flanking sequence around design +Components. The new ComponentDefinition will have Sequence Ontology type of +flanking_sequence. + +Parameters +---------- +* `target` : + The new flanking sequence will be placed downstream of the target +* `elements` : + The primary sequence elements will be assigned to the autoconstructed + Sequence object. The encoding is inferred +"; + +%feature("docstring") sbol::ComponentDefinition::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::ComponentDefinition::addUpstreamFlank " +`addUpstreamFlank(target, elements)` + +This may be a useful method when building up SBOL representations of natural DNA +sequences. + +For example it is often necessary to specify components that are assumed to have +no meaningful role in the design, but are nevertheless important to fill in +regions of sequence. This method autoconstructs a ComponentDefinition and +Sequence object to create an arbitrary flanking sequence around design +Components. The new ComponentDefinition will have Sequence Ontology type of +flanking_region or SO:0000239 + +Parameters +---------- +* `target` : + The new flanking sequence will be placed upstream of the target +* `elements` : + The primary sequence elements will be assigned to the autoconstructed + Sequence object. The encoding is inferred +"; + +%feature("docstring") sbol::ComponentDefinition::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::ComponentDefinition::build " +`build() -> ComponentDefinition &` +"; + +%feature("docstring") sbol::ComponentDefinition::disassemble " +`disassemble(range_start=1)` + +Instantiates a Component for every SequenceAnnotation. When converting from a +flat GenBank file to a flat SBOL file, the result is a ComponentDefinition with +SequenceAnnotations. This method will convert the flat SBOL file into +hierarchical SBOL. +"; + +%feature("docstring") sbol::ComponentDefinition::assemble " +`assemble(list_of_components, assembly_standard=\"\")` + +Assembles ComponentDefinitions into an abstraction hierarchy. + +The resulting data structure is a partial design, still lacking a primary +structure or explicit sequence. To form a primary structure out of the +ComponentDefinitions, call linearize after calling assemble. To fully realize +the target sequence, use Sequence::assemble(). + +Parameters +---------- +* `list_of_components` : + A list of subcomponents that will compose this ComponentDefinition +* `assembly_standard` : + An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how + components are composed and the final target sequence +"; + +%feature("docstring") sbol::ComponentDefinition::assemble " +`assemble(list_of_components, doc, assembly_standard=\"\")` + +Assembles ComponentDefinitions into an abstraction hierarchy. + +The resulting data structure is a partial design, still lacking a primary +structure or explicit sequence. To form a primary structure out of the +ComponentDefinitions, call linearize after calling assemble. To fully realize +the target sequence, use Sequence::assemble(). + +Parameters +---------- +* `list_of_components` : + A list of subcomponents that will compose this ComponentDefinition +* `doc` : + The Document to which the assembled ComponentDefinitions will be added +* `assembly_standard` : + An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how + components are composed and the final target sequence +"; + +%feature("docstring") sbol::ComponentDefinition::assemble " +`assemble(list_of_uris, assembly_standard=\"\")` + +Assembles ComponentDefinitions into an abstraction hierarchy. + +The resulting data structure is a partial design, still lacking a primary +structure or explicit sequence. To form a primary structure out of the +ComponentDefinitions, call linearize after calling assemble. To fully realize +the target sequence, use Sequence::assemble(). + +Parameters +---------- +* `list_of_uris` : + A list of URIs for the constituent ComponentDefinitions, or displayIds if + using SBOL-compliant URIs +* `assembly_standard` : + An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how + components are composed and the final target sequence +"; + +%feature("docstring") sbol::ComponentDefinition::getPrimaryStructure " +`getPrimaryStructure() -> std::vector< ComponentDefinition * >` + +Get the primary sequence of a design in terms of its sequentially ordered +Components. +"; + +%feature("docstring") sbol::ComponentDefinition::isComplete " +`isComplete(msg) -> bool` + +Use this diagnose an incomplete design. + +Recursively checks if this ComponentDefinition defines a SequenceAnnotation and +Range for every Sequence. Completeness does not guarantee regularity + +Parameters +---------- +* `msg` : + A message for diagnosing the irregularity, if any is found. The message is + returned through an argument of type std::string& + +Returns +------- +true if the abstraction hierarchy is regular, false otherwise. +"; + +%feature("docstring") sbol::ComponentDefinition::isComplete " +`isComplete() -> bool` + +Recursively verifies that the parent Document contains a ComponentDefinition and +Sequence for each and every ComponentDefinition in the abstraction hierarchy. + +If a ComponentDefinition is not complete, some objects are missing from the +Document or externally linked. Diagnose with isComplete(std::string &msg) + +Returns +------- +true if the abstraction hierarchy is complete, false otherwise. +"; + +%feature("docstring") sbol::ComponentDefinition::~ComponentDefinition " +`~ComponentDefinition()` +"; + +%feature("docstring") sbol::ComponentDefinition::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::ComponentDefinition::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::ComponentDefinition::isRegular " +`isRegular(msg) -> bool` + +Use this diagnose an irregular design. + +Recursively checks if this ComponentDefinition defines a SequenceAnnotation and +Range for every Sequence. Regularity is more stringent than completeness. A +design must be complete to be regular. + +Parameters +---------- +* `msg` : + A message for diagnosing the irregularity, if any is found. The message is + returned through an argument of type std::string& + +Returns +------- +true if the abstraction hierarchy is regular, false otherwise. +"; + +%feature("docstring") sbol::ComponentDefinition::isRegular " +`isRegular() -> bool` + +Recursively checks if this ComponentDefinition defines a SequenceAnnotation and +Range for every Sequence. + +Regularity is more stringent than completeness. A design must be complete to be +regular. If the Component is irregular, diagnose with isRegular(std::string +&msg) + +Returns +------- +true if the abstraction hierarchy is regular, false otherwise. +"; + +%feature("docstring") sbol::ComponentDefinition::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::ComponentDefinition::getInSequentialOrder " +`getInSequentialOrder() -> std::vector< Component * >` + +Orders this ComponentDefinition's member Components into a linear arrangement +based on Sequence Constraints. + +Returns +------- +Primary sequence structure +"; + +%feature("docstring") sbol::ComponentDefinition::assemblePrimaryStructure " +`assemblePrimaryStructure(primary_structure, assembly_standard=\"\")` + +Assembles ComponentDefinition into a linear primary structure. + +The resulting data structure is a partial design, still lacking an explicit +sequence. To fully realize the target sequence, use Sequence::assemble(). + +Parameters +---------- +* `primary_structure` : + A list of URIs for the constituent ComponentDefinitions, or displayIds if + using SBOL-compliant URIs +* `assembly_standard` : + An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how + components are composed and the final target sequence +"; + +%feature("docstring") sbol::ComponentDefinition::assemblePrimaryStructure " +`assemblePrimaryStructure(primary_structure, assembly_standard=\"\")` + +Assembles ComponentDefinition into a linear primary structure. + +The resulting data structure is a partial design, still lacking an explicit +sequence. To fully realize the target sequence, use Sequence::assemble(). + +Parameters +---------- +* `list_of_components` : + A list of subcomponents that will compose this ComponentDefinition +* `assembly_standard` : + An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how + components are composed and the final target sequence +"; + +%feature("docstring") sbol::ComponentDefinition::assemblePrimaryStructure " +`assemblePrimaryStructure(primary_structure, doc, assembly_standard=\"\")` + +Assembles ComponentDefinition into a linear primary structure. + +The resulting data structure is a partial design, still lacking an explicit +sequence. To fully realize the target sequence, use Sequence::assemble(). + +Parameters +---------- +* `list_of_components` : + A list of subcomponents that will compose this ComponentDefinition +* `doc` : + The Document to which the assembled ComponentDefinitions will be added +* `assembly_standard` : + An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how + components are composed and the final target sequence +"; + +%feature("docstring") sbol::ComponentDefinition::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::ComponentDefinition::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::ComponentDefinition::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::ComponentDefinition::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::ComponentDefinition::getDownstreamComponent " +`getDownstreamComponent(current_component) -> Component &` + +Get the downstream Component. + +Returns +------- +The downstream component +"; + +%feature("docstring") sbol::ComponentDefinition::getFirstComponent " +`getFirstComponent() -> Component &` + +Gets the first Component in a linear sequence. + +Returns +------- +The first component in sequential order +"; + +%feature("docstring") sbol::ComponentDefinition::insertDownstream " +`insertDownstream(target, insert)` + +Insert a Component downstream of another in a primary sequence, shifting any +adjacent Components dowstream as well. + +Parameters +---------- +* `target` : + The target Component will be upstream of the insert Component after this + operation. +* `insert` : + The insert Component is inserted downstream of the target Component. +"; + +%feature("docstring") sbol::ComponentDefinition::compile " +`compile() -> std::string` + +Compiles an abstraction hierarchy of ComponentDefinitions into a nucleotide +sequence. If no Sequence object is associated with this ComponentDefinition, one +will be automatically instantiated. +"; + +%feature("docstring") sbol::ComponentDefinition::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::ComponentDefinition::insertUpstream " +`insertUpstream(target, insert)` + +Insert a Component upstream of another in a primary sequence, shifting any +adjacent Components upstream as well. + +Parameters +---------- +* `target` : + The target Component will be downstream of the insert Component after this + operation. +* `insert` : + The insert Component is inserted upstream of the target Component. +"; + +%feature("docstring") sbol::ComponentDefinition::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::ComponentDefinition::applyToComponentHierarchy " +`applyToComponentHierarchy(callback_fn=NULL, user_data=NULL) -> std::vector< + ComponentDefinition * >` + +Perform an operation on every Component in a structurally-linked hierarchy of +Components by applying a callback function. + +If no callback is specified, the default behavior is to return a pointer list of +each Component in the hierarchy. + +Parameters +---------- +* `callback_fun` : + A pointer to a callback function with signature void + callback_fn(ComponentDefinition *, void *). +* `user_data` : + Arbitrary user data which can be passed in and out of the callback as an + argument or return value. + +Returns +------- +Returns a flat list of pointers to all Components in the hierarchy. +"; + +%feature("docstring") sbol::ComponentDefinition::getUpstreamComponent " +`getUpstreamComponent(current_component) -> Component &` + +Get the upstream Component. + +Returns +------- +The upstream component +"; + +%feature("docstring") sbol::ComponentDefinition::ComponentDefinition " +`ComponentDefinition(uri=\"example\", type=BIOPAX_DNA, version=VERSION_STRING)` + +Construct a ComponentDefinition. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `type` : + A BioPAX ontology term that indicates whether the ComponentDefinition is + DNA, RNA, protein, or some other molecule type. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::ComponentDefinition::ComponentDefinition " +`ComponentDefinition(type, uri, component_type, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `type` : + The RDF type for an extension class derived from this one +"; + +// File: classsbol_1_1_component_instance.xml + + +%feature("docstring") sbol::ComponentInstance " + +Attributes +---------- +* `definition` : `ReferencedObject` + The definition property is a REQUIRED URI that refers to the + ComponentDefinition of the ComponentInstance. + + As described in the previous section, this ComponentDefinition effectively + provides information about the types and roles of the ComponentInstance. The + definition property MUST NOT refer to the same ComponentDefinition as the + one that contains the ComponentInstance. Furthermore, ComponentInstance + objects MUST NOT form a cyclical chain of references via their definition + properties and the ComponentDefinition objects that contain them. For + example, consider the ComponentInstance objects A and B and the + ComponentDefinition objects X and Y . The reference chain X contains A, A + isdefinedby Y, Y contains B, and B isdefinedby X iscyclical. + +* `access` : `URIProperty` + The access property is a REQUIRED URI that indicates whether the + ComponentInstance can be referred to remotely by a MapsTo. + + The value of the access property MUST be one of the following URIs. + Access URI + + Description + + http://sbols.org/v2#public + + The ComponentInstance MAY be referred to by remote MapsTo objects + + http://sbols.org/v2#private + + The ComponentInstance MAY be referred to by remote MapsTo objects + +* `mapsTos` : `OwnedObject< MapsTo >` + The mapsTos property is OPTIONAL and MAY contain a set of MapsTo objects + that refer to and link together ComponentInstance objects (both Component + objects and FunctionalComponent objects) within a larger design. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. +"; + +%feature("docstring") sbol::ComponentInstance::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::ComponentInstance::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::ComponentInstance::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::ComponentInstance::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::ComponentInstance::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::ComponentInstance::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::ComponentInstance::~ComponentInstance " +`~ComponentInstance()` +"; + +%feature("docstring") sbol::ComponentInstance::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::ComponentInstance::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::ComponentInstance::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::ComponentInstance::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::ComponentInstance::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::ComponentInstance::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::ComponentInstance::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::ComponentInstance::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::ComponentInstance::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::ComponentInstance::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::ComponentInstance::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::ComponentInstance::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::ComponentInstance::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::ComponentInstance::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +// File: classsbol_1_1_config.xml + + +%feature("docstring") sbol::Config " + +A class which contains global configuration variables for the libSBOL +environment. Intended to be used like a static class, configuration variables +are accessed through the Config::setOptions and Config::getOptions methods. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/config.h +"; + +%feature("docstring") sbol::Config::setOption " +`setOption(option, value)` + +Configure options for libSBOL. + +Access online validation and conversion. +Option + +Description + +Values + +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 + +Enable validation and conversion requests through the online validator + +True or False + +validator_url + +The http request endpoint for validation + +A valid URL, set to http://www.async.ece.utah.edu/sbol-validator/endpoint.php +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 +with the SBOL specification + +True or False + +check_completeness + +If set to false, not all referenced objects must be described within +the given main_file + +True or False + +check_best_practices + +If set to true, the file is checked for the best practice rules set +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 +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, +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 +* `value` : + The option value +"; + +%feature("docstring") sbol::Config::setOption " +`setOption(option, value)` +"; + +%feature("docstring") sbol::Config::setOption " +`setOption(option, value)` +"; + +%feature("docstring") sbol::Config::Config " +`Config()` +"; + +%feature("docstring") sbol::Config::getOption " +`getOption(option) -> std::string` + +Get current option value for online validation and conversion. + +Parameters +---------- +* `option` : + The option key +"; + +// File: classsbol_1_1_cut.xml + + +%feature("docstring") sbol::Cut " + +The Cut class specifies a location between two coordinates of a Sequence's +elements. class Cut : public Location. + +Attributes +---------- +* `at` : `IntProperty` + This property specifies the location between this nucleotide coordinate (or + other sequence element) and the nucleotide coordinate immediately following + it. When equal to zero, the specified region is immediately before the first + nucleotide or character in the elements. + +* `orientation` : `URIProperty` + The orientation indicates how a region of double-stranded DNA represented by + the parent SequenceAnnotation and its associated Component are oriented. + + The orientation may be one of the following values. By default it is set to + SBOL_ORIENTATION_INLINE. + Orientation URI + + libSBOL Symbol + + http://sbols.org/v2#inline + + SBOL_ORIENTATION_INLINE + + http://sbols.org/v2#reverseComplement + + SBOL_ORIENTATION_REVERSE_COMPLEMENT + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/location.h +"; + +%feature("docstring") sbol::Cut::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Cut::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Cut::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Cut::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Cut::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Cut::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Cut::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Cut::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Cut::~Cut " +`~Cut()` +"; + +%feature("docstring") sbol::Cut::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Cut::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Cut::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Cut::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Cut::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Cut::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Cut::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Cut::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Cut::Cut " +`Cut(uri=\"example\", at=0)` + +Construct a Cut. + +If operating in SBOL-compliant mode, use SequenceAnnotation::locations.create < +Cut > instead. + +Parameters +---------- +* `uri` : + If operating in open-world mode, this should be a full URI including a + scheme, namespace, and identifier. If SBOLCompliance configuration is + enabled, then this argument is simply the displayId for the new object and a + full URI will automatically be constructed. +* `at` : + An integer of 0 or greater +"; + +%feature("docstring") sbol::Cut::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Cut::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Cut::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Cut::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +// File: classsbol_1_1_date_time_property.xml + + +%feature("docstring") sbol::DateTimeProperty " + +Contains a DateTime string following XML Schema. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/properties.h +"; + +%feature("docstring") sbol::DateTimeProperty::remove " +`remove(index=0)` + +Remove a property value. +"; + +%feature("docstring") sbol::DateTimeProperty::validate " +`validate(arg=NULL)` +"; + +%feature("docstring") sbol::DateTimeProperty::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::DateTimeProperty::add " +`add(new_value)` + +Appends the new value to a list of values, for properties that allow it. + +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; + +%feature("docstring") sbol::DateTimeProperty::stampTime " +`stampTime() -> std::string` + +Set this property with the current time. +"; + +%feature("docstring") sbol::DateTimeProperty::getTypeURI " +`getTypeURI() -> rdf_type` +"; + +%feature("docstring") sbol::DateTimeProperty::clear " +`clear()` + +Clear all property values. +"; + +%feature("docstring") sbol::DateTimeProperty::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::DateTimeProperty::DateTimeProperty " +`DateTimeProperty(property_owner, type_uri, lower_bound, upper_bound, + initial_value)` + +Initialize the DateTime. + +Conformance to XML DateTime schema is validated upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +"; + +%feature("docstring") sbol::DateTimeProperty::DateTimeProperty " +`DateTimeProperty(property_owner, type_uri, lower_bound, upper_bound)` +"; + +%feature("docstring") sbol::DateTimeProperty::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; + +%feature("docstring") sbol::DateTimeProperty::write " +`write()` +"; + +%feature("docstring") sbol::DateTimeProperty::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::DateTimeProperty::size " +`size() -> int` +"; + +%feature("docstring") sbol::DateTimeProperty::getAll " +`getAll() -> std::vector< std::string >` +"; + +%feature("docstring") sbol::DateTimeProperty::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::DateTimeProperty::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. + +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; + +%feature("docstring") sbol::DateTimeProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::DateTimeProperty::set " +`set(new_value)` +"; + +%feature("docstring") sbol::DateTimeProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::DateTimeProperty::getUpperBound " +`getUpperBound() -> char` +"; + +%feature("docstring") sbol::DateTimeProperty::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::DateTimeProperty::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + +%feature("docstring") sbol::DateTimeProperty::get " +`get() -> std::string` + +Basic getter for all SBOL literal properties. + +Returns +------- +A string literal +"; + +// File: classsbol_1_1_design.xml + + +%feature("docstring") sbol::Design " + +This class represents a biological Design. A Design is a conceptual +representation of a biological system that a synthetic biologist intends to +build. A Design is the first object created in libSBOL's formalized Design- +Build-Test-Analysis workflow. + +Attributes +---------- +* `structure` : `OwnedObject< ComponentDefinition >` + The target biological structure for synthesis or other molecular assembly. + +* `function` : `OwnedObject< ModuleDefinition >` + The intended function and predicted behavior of the Design object. + +* `characterization` : `ReferencedObject` + A reference to an Analysis or multiple Analysis objects that contain + characterization data, previously verified experimental knowledge, or + explanatory models that inform a Design. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/dbtl.h +"; + +%feature("docstring") sbol::Design::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::Design::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Design::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::Design::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Design::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Design::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Design::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Design::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Design::Design " +`Design(uri=\"example\", version=VERSION_STRING)` + +Construct a new Design from scratch. + +The structure and function of the Design are not initialized. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::Design::Design " +`Design(uri, structure, function, version=VERSION_STRING)` + +Constructs a new Design. + +The structure and function of the Design are initialized. A FunctionalComponent +is autoconstructed which correlates the structure and function. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `structure` : + A ComponentDefinition representing the structural aspects of the Design +* `function` : + A ModuleDefiniition representing the functional aspects of the Design +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::Design::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Design::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Design::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::Design::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Design::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Design::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Design::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Design::~Design " +`~Design()` +"; + +%feature("docstring") sbol::Design::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Design::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Design::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Design::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Design::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Design::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Design::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Design::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Design::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Design::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +// File: classsbol_1_1_document.xml + + +%feature("docstring") sbol::Document " + +Read and write SBOL using a Document class. The Document is a container for +Components, Modules, and all other SBOLObjects. + +Attributes +---------- +* `designs` : `OwnedObject< Design >` + +* `builds` : `OwnedObject< Build >` + +* `tests` : `OwnedObject< Test >` + +* `analyses` : `OwnedObject< Analysis >` + +* `componentDefinitions` : `OwnedObject< ComponentDefinition >` + +* `moduleDefinitions` : `OwnedObject< ModuleDefinition >` + +* `models` : `OwnedObject< Model >` + +* `sequences` : `OwnedObject< Sequence >` + +* `collections` : `OwnedObject< Collection >` + +* `activities` : `OwnedObject< Activity >` + +* `plans` : `OwnedObject< Plan >` + +* `agents` : `OwnedObject< Agent >` + +* `attachments` : `OwnedObject< Attachment >` + +* `combinatorialderivations` : `OwnedObject< CombinatorialDerivation >` + +* `implementations` : `OwnedObject< Implementation >` + +* `sampleRosters` : `OwnedObject< SampleRoster >` + +* `citations` : `URIProperty` + +* `keywords` : `URIProperty` + +* `python_iter` : `iterator` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/document.h +"; + +%feature("docstring") sbol::Document::request_validation " +`request_validation(sbol) -> std::string` +"; + +%feature("docstring") sbol::Document::readString " +`readString(sbol)` + +Convert text in SBOL into data objects. + +Parameters +---------- +* `sbol` : + A string formatted in SBOL +"; + +%feature("docstring") sbol::Document::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Document::addModel " +`addModel(sbol_obj)` +"; + +%feature("docstring") sbol::Document::close " +`close(uri=\"\")` + +Delete all objects in this Document and destroy the Document. +"; + +%feature("docstring") sbol::Document::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Document::summary " +`summary() -> std::string` + +Get a summary of objects in the Document, including SBOL core object and custom +annotation objects. +"; + +%feature("docstring") sbol::Document::Document " +`Document()` + +Construct a Document. The Document is a container for Components, Modules, and +all other SBOLObjects. +"; + +%feature("docstring") sbol::Document::Document " +`Document(filename)` +"; + +%feature("docstring") sbol::Document::generate " +`generate(world, sbol_serializer, sbol_buffer, sbol_buffer_len, ios, base_uri)` + +Generates rdf/xml. + +author: KC generates rdf/xml +"; + +%feature("docstring") sbol::Document::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Document::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Document::add " +`add(sbol_obj)` + +Register an object in the Document. + +Parameters +---------- +* `sbol_obj` : + The SBOL object you want to serialize + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object +"; + +%feature("docstring") sbol::Document::add " +`add(sbol_objects)` + +Register an object in the Document. + +Parameters +---------- +* `sbol_objects` : + A list of pointers to the SBOL objects you want to serialize + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object +"; + +%feature("docstring") sbol::Document::add " +`add(sbol_obj)` +"; + +%feature("docstring") sbol::Document::add " +`add(sbol_obj)` +"; + +%feature("docstring") sbol::Document::add " +`add(sbol_obj)` +"; + +%feature("docstring") sbol::Document::add " +`add(sbol_obj)` +"; + +%feature("docstring") sbol::Document::write " +`write(filename) -> std::string` + +Serialize all objects in this Document to an RDF/XML file. + +Parameters +---------- +* `filename` : + The full name of the file you want to write (including file extension) + +Returns +------- +A string with the validation results, or empty string if validation is disabled +"; + +%feature("docstring") sbol::Document::~Document " +`~Document()` +"; + +%feature("docstring") sbol::Document::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Document::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Document::addModuleDefinition " +`addModuleDefinition(sbol_obj)` +"; + +%feature("docstring") sbol::Document::validate " +`validate() -> std::string` + +Run validation on this Document via the online validation tool. + +Returns +------- +A string containing a message with the validation results + +author: KC +"; + +%feature("docstring") sbol::Document::read " +`read(filename)` + +Read an RDF/XML file and attach the SBOL objects to this Document. + +Existing contents of the Document will be wiped. + +Parameters +---------- +* `filename` : + The full name of the file you want to read (including file extension) +"; + +%feature("docstring") sbol::Document::addNamespace " +`addNamespace(ns, prefix)` + +Add a new namespace to this Document. + +Parameters +---------- +* `ns` : + The namespace, eg. http://sbols.org/v2# +* `prefix` : + The namespace prefix, eg. sbol +"; + +%feature("docstring") sbol::Document::search_metadata " +`search_metadata(role, type, name, collection) -> std::string` +"; + +%feature("docstring") sbol::Document::getNamespaces " +`getNamespaces() -> std::vector< std::string >` + +Returns +------- +A vector of namespaces Get namespaces contained in this Document +"; + +%feature("docstring") sbol::Document::query_repository " +`query_repository(command) -> std::string` +"; + +%feature("docstring") sbol::Document::getAll " +`getAll() -> std::vector< SBOLClass * >` + +Retrieve a vector of objects from the Document. + +templateparam +------------- +* `SBOLClass` : + The type of SBOL objects +"; + +%feature("docstring") sbol::Document::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::Document::find " +`find(uri) -> SBOLObject *` + +Search recursively for an SBOLObject in this Document that matches the uri. + +Parameters +---------- +* `uri` : + The identity of the object to search for + +Returns +------- +A pointer to the SBOLObject, or NULL if an object with this identity doesn't +exist +"; + +%feature("docstring") sbol::Document::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Document::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::Document::request_comparison " +`request_comparison(diff_file) -> std::string` + +Perform comparison on Documents using the online validation tool. + +This is for cross-validation of SBOL documents with libSBOLj. Document +comparison can also be performed using the built-in compare method. + +Returns +------- +The comparison results +"; + +%feature("docstring") sbol::Document::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Document::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Document::copy " +`copy(ns=\"\", doc=NULL, version=\"\") -> Document &` +"; + +%feature("docstring") sbol::Document::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Document::addSequence " +`addSequence(sbol_obj)` +"; + +%feature("docstring") sbol::Document::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Document::size " +`size() -> int` + +Get the total number of objects in the Document, including SBOL core object and +custom annotation objects. +"; + +%feature("docstring") sbol::Document::writeString " +`writeString() -> std::string` + +Convert data objects in this Document into textual SBOL. +"; + +%feature("docstring") sbol::Document::append " +`append(filename)` + +Read an RDF/XML file and attach the SBOL objects to this Document. + +New objects will be added to the existing contents of the Document + +Parameters +---------- +* `filename` : + The full name of the file you want to read (including file extension) +"; + +%feature("docstring") sbol::Document::get " +`get(uri) -> SBOLClass &` + +Retrieve an object from the Document. + +Parameters +---------- +* `uri` : + The identity of the SBOL object you want to retrieve + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object +"; + +%feature("docstring") sbol::Document::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Document::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Document::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Document::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Document::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Document::countTriples " +`countTriples() -> int` +"; + +%feature("docstring") sbol::Document::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Document::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Document::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Document::addComponentDefinition " +`addComponentDefinition(sbol_obj)` +"; + +// File: classsbol_1_1_enzyme_catalysis_interaction.xml + + +%feature("docstring") sbol::EnzymeCatalysisInteraction " + +Attributes +---------- +* `enzyme` : `AliasedProperty< FunctionalComponent >` + +* `substrates` : `AliasedProperty< FunctionalComponent >` + +* `products` : `AliasedProperty< FunctionalComponent >` + +* `cofactors` : `AliasedProperty< FunctionalComponent >` + +* `sideproducts` : `AliasedProperty< FunctionalComponent >` + +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that describes the behavior + represented by an Interaction. + + The types property MUST contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the occurring entity + branch of the Systems Biology Ontology (SBO). (See + http://www.ebi.ac.uk/sbo/main/) The following table provides a list of + possible SBO terms for the types property and their corresponding URIs. + Type + + URI for SBO Term + + LibSBOL symbol + + Biochemical Reaction + + http://identifiers.org/biomodels.sbo/SBO:0000176 + + SBO_BIOCHEMICAL_REACTION + + Inhibition + + http://identifiers.org/biomodels.sbo/SBO:0000169 + + SBO_INHIBITION + + Stimulation + + http://identifiers.org/biomodels.sbo/SBO:0000170 + + SBO_STIMULATION + + Genetic Production + + http://identifiers.org/biomodels.sbo/SBO:0000589 + + SBO_GENETIC_PRODUCTION + + Non-Covalent Binding + + http://identifiers.org/biomodels.sbo/SBO:0000177 + + SBO_NONCOVALENT_BINDING + + Degradation + + http://identifiers.org/biomodels.sbo/SBO:0000179 + + SBO_DEGRADATION + + Control + + http://identifiers.org/biomodels.sbo/SBO:0000168 + + SBO_CONTROL + +* `participations` : `OwnedObject< Participation >` + The participations property is an OPTIONAL and MAY contain a set of + Participation objects, each of which identifies the roles that its + referenced FunctionalComponent plays in the Interaction. Even though an + Interaction generally contains at least one Participation, the case of zero + Participation objects is allowed because it is plausible that a designer + might want to specify that an Interaction will exist, even if its + participants have not yet been determined. + +* `functionalComponents` : `OwnedObject< FunctionalComponent >` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::EnzymeCatalysisInteraction " +`EnzymeCatalysisInteraction(uri, enzyme, substrates, products)` +"; + +%feature("docstring") sbol::EnzymeCatalysisInteraction::EnzymeCatalysisInteraction " +`EnzymeCatalysisInteraction(uri, enzyme, substrates, products, cofactors, + sideproducts)` +"; + +// File: classsbol_1_1_float_property.xml + + +%feature("docstring") sbol::FloatProperty " + +FloatProperty objects are used to contain floats. + +They can be used as member objects inside custom SBOL Extension classes. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/properties.h +"; + +%feature("docstring") sbol::FloatProperty::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. + +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; + +%feature("docstring") sbol::FloatProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::FloatProperty::set " +`set(new_value)` +"; + +%feature("docstring") sbol::FloatProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::FloatProperty::FloatProperty " +`FloatProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules, initial_value)` + +Initialize the IntProperty with a value. + +Validation rules are checked upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::FloatProperty::FloatProperty " +`FloatProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules)` + +Initialize a FloatProperty without a value. + +No validation rules are run upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::FloatProperty::FloatProperty " +`FloatProperty(property_owner, type_uri, lower_bound, upper_bound, + initial_value)` +"; + +%feature("docstring") sbol::FloatProperty::FloatProperty " +`FloatProperty(property_owner, type_uri, lower_bound, upper_bound)` +"; + +%feature("docstring") sbol::FloatProperty::size " +`size() -> int` +"; + +%feature("docstring") sbol::FloatProperty::write " +`write()` +"; + +%feature("docstring") sbol::FloatProperty::remove " +`remove(index=0)` + +Remove a property value. +"; + +%feature("docstring") sbol::FloatProperty::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::FloatProperty::add " +`add(new_value)` + +Appends the new value to a list of values, for properties that allow it. + +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; + +%feature("docstring") sbol::FloatProperty::get " +`get() -> double` + +Get the float value. + +Returns +------- +An integer +"; + +%feature("docstring") sbol::FloatProperty::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::FloatProperty::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; + +%feature("docstring") sbol::FloatProperty::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::FloatProperty::clear " +`clear()` + +Clear all property values. +"; + +%feature("docstring") sbol::FloatProperty::getAll " +`getAll() -> std::vector< double >` +"; + +%feature("docstring") sbol::FloatProperty::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::FloatProperty::getTypeURI " +`getTypeURI() -> rdf_type` +"; + +%feature("docstring") sbol::FloatProperty::getUpperBound " +`getUpperBound() -> char` +"; + +%feature("docstring") sbol::FloatProperty::validate " +`validate(arg=NULL)` +"; + +%feature("docstring") sbol::FloatProperty::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::FloatProperty::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + +// File: classsbol_1_1_functional_component.xml + + +%feature("docstring") sbol::FunctionalComponent " + +The FunctionalComponent class is used to specify the functional usage of a +ComponentDefinition inside a ModuleDefinition. The ModuleDefinition describes +how the that describes how the FunctionalComponent interacts with others and +summarizes their aggregate function. + +Attributes +---------- +* `direction` : `URIProperty` + Each FunctionalComponent MUST specify via the direction property whether it + serves as an input, output, both, or neither for its parent ModuleDefinition + object. + + The value for this property MUST be one of the URIs given in the table + below. + Direction URI + + Description + + LibSBOL Symbol + + http://sbols.org/v2#in + + Indicates that the FunctionalComponent is an input. + + SBOL_DIRECTION_IN + + http://sbols.org/v2#out + + Indicates that the FunctionalComponent is an output. + + SBOL_DIRECTION_OUT + + http://sbols.org/v2#inout + + Indicates that the FunctionalComponent is both an input and output + + SBOL_DIRECTION_IN_OUT + + http://sbols.org/v2#none + + Indicates that the FunctionalComponent is neither an input or output. + + SBOL_DIRECTION_NONE + +* `definition` : `ReferencedObject` + The definition property is a REQUIRED URI that refers to the + ComponentDefinition of the ComponentInstance. + + As described in the previous section, this ComponentDefinition effectively + provides information about the types and roles of the ComponentInstance. The + definition property MUST NOT refer to the same ComponentDefinition as the + one that contains the ComponentInstance. Furthermore, ComponentInstance + objects MUST NOT form a cyclical chain of references via their definition + properties and the ComponentDefinition objects that contain them. For + example, consider the ComponentInstance objects A and B and the + ComponentDefinition objects X and Y . The reference chain X contains A, A + isdefinedby Y, Y contains B, and B isdefinedby X iscyclical. + +* `access` : `URIProperty` + The access property is a REQUIRED URI that indicates whether the + ComponentInstance can be referred to remotely by a MapsTo. + + The value of the access property MUST be one of the following URIs. + Access URI + + Description + + http://sbols.org/v2#public + + The ComponentInstance MAY be referred to by remote MapsTo objects + + http://sbols.org/v2#private + + The ComponentInstance MAY be referred to by remote MapsTo objects + +* `mapsTos` : `OwnedObject< MapsTo >` + The mapsTos property is OPTIONAL and MAY contain a set of MapsTo objects + that refer to and link together ComponentInstance objects (both Component + objects and FunctionalComponent objects) within a larger design. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/component.h +"; + +%feature("docstring") sbol::FunctionalComponent::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::FunctionalComponent::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::FunctionalComponent::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::FunctionalComponent::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::FunctionalComponent::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::FunctionalComponent::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::FunctionalComponent::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::FunctionalComponent::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::FunctionalComponent::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::FunctionalComponent::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::FunctionalComponent::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::FunctionalComponent::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::FunctionalComponent::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::FunctionalComponent::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::FunctionalComponent::~FunctionalComponent " +`~FunctionalComponent()` +"; + +%feature("docstring") sbol::FunctionalComponent::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::FunctionalComponent::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::FunctionalComponent::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::FunctionalComponent::FunctionalComponent " +`FunctionalComponent(uri=\"example\", definition=\"\", + access=SBOL_ACCESS_PUBLIC, direction=SBOL_DIRECTION_NONE, + version=VERSION_STRING)` + +Construct a FunctionalComponent. + +If operating in SBOL-compliant mode, use +ModuleDefinition::functionalComponents::create instead. + +Parameters +---------- +* `A` : + full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `definition` : + A URI referring to the ComponentDefinition that defines this instance +* `access` : + Flag indicating whether the FunctionalComponent can be referred to remotely + by a MapsTo +* `direction` : + The direction property specifies whether a FunctionalComponent serves as an + input, output, both, or neither for its parent ModuleDefinition object +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::FunctionalComponent::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::FunctionalComponent::isMasked " +`isMasked() -> int` + +Used to tell if a FunctionalComponent is linked to an equivalent +FunctionalComponent in another ModuleDefinition. + +Returns +------- +1 if the FunctionalComponent has been over-rided by another FunctionalComponent, +0 if it hasn't. +"; + +%feature("docstring") sbol::FunctionalComponent::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::FunctionalComponent::connect " +`connect(interface_component)` + +This method connects module inputs and outputs. + +This convenience method auto-constructs a MapsTo object. See Biosystem Design +for an example + +Parameters +---------- +* `interface_component` : + An input or output component from another ModuleDefinition that corresponds + with this component. +"; + +%feature("docstring") sbol::FunctionalComponent::mask " +`mask(masked_component)` + +This method is used to state that FunctionalComponents in separate +ModuleDefinitions are functionally equivalent. + +Using this method will override the FunctionalComponent in the argument with the +FunctionalComponent calling the method. This is useful for overriding a generic, +template component with an explicitly defined component. This convenience method +auto-constructs a MapsTo object. See Biosystem Design for an example + +Parameters +---------- +* `masked_component` : + The FunctionalComponent that is being masked (over-ridden) +"; + +%feature("docstring") sbol::FunctionalComponent::override " +`override(masked_component)` + +This method is used to state that FunctionalComponents in separate +ModuleDefinitions are functionally equivalent. + +Using this method will override the FunctionalComponent in the argument with the +FunctionalComponent calling the method. This is useful for overriding a generic, +template component with an explicitly defined component. This convenience method +auto-constructs a MapsTo object. See Biosystem Design for an example + +Parameters +---------- +* `masked_component` : + The FunctionalComponent that is being masked (over-ridden) +"; + +%feature("docstring") sbol::FunctionalComponent::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +// File: classsbol_1_1_gene_production_interaction.xml + + +%feature("docstring") sbol::GeneProductionInteraction " + +Attributes +---------- +* `gene` : `AliasedProperty< FunctionalComponent >` + +* `product` : `AliasedProperty< FunctionalComponent >` + +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that describes the behavior + represented by an Interaction. + + The types property MUST contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the occurring entity + branch of the Systems Biology Ontology (SBO). (See + http://www.ebi.ac.uk/sbo/main/) The following table provides a list of + possible SBO terms for the types property and their corresponding URIs. + Type + + URI for SBO Term + + LibSBOL symbol + + Biochemical Reaction + + http://identifiers.org/biomodels.sbo/SBO:0000176 + + SBO_BIOCHEMICAL_REACTION + + Inhibition + + http://identifiers.org/biomodels.sbo/SBO:0000169 + + SBO_INHIBITION + + Stimulation + + http://identifiers.org/biomodels.sbo/SBO:0000170 + + SBO_STIMULATION + + Genetic Production + + http://identifiers.org/biomodels.sbo/SBO:0000589 + + SBO_GENETIC_PRODUCTION + + Non-Covalent Binding + + http://identifiers.org/biomodels.sbo/SBO:0000177 + + SBO_NONCOVALENT_BINDING + + Degradation + + http://identifiers.org/biomodels.sbo/SBO:0000179 + + SBO_DEGRADATION + + Control + + http://identifiers.org/biomodels.sbo/SBO:0000168 + + SBO_CONTROL + +* `participations` : `OwnedObject< Participation >` + The participations property is an OPTIONAL and MAY contain a set of + Participation objects, each of which identifies the roles that its + referenced FunctionalComponent plays in the Interaction. Even though an + Interaction generally contains at least one Participation, the case of zero + Participation objects is allowed because it is plausible that a designer + might want to specify that an Interaction will exist, even if its + participants have not yet been determined. + +* `functionalComponents` : `OwnedObject< FunctionalComponent >` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. +"; + +%feature("docstring") sbol::GeneProductionInteraction::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::GeneProductionInteraction::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::GeneProductionInteraction::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::GeneProductionInteraction::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::GeneProductionInteraction::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::GeneProductionInteraction::GeneProductionInteraction " +`GeneProductionInteraction(uri, gene, product)` +"; + +%feature("docstring") sbol::GeneProductionInteraction::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::GeneProductionInteraction::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::GeneProductionInteraction::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::GeneProductionInteraction::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::GeneProductionInteraction::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::GeneProductionInteraction::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::GeneProductionInteraction::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::GeneProductionInteraction::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::GeneProductionInteraction::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::GeneProductionInteraction::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::GeneProductionInteraction::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::GeneProductionInteraction::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::GeneProductionInteraction::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::GeneProductionInteraction::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::GeneProductionInteraction::update_uri " +`update_uri()` +"; + +// File: classsbol_1_1_generic_location.xml + + +%feature("docstring") sbol::GenericLocation " + +the GenericLocation class is included as a starting point for specifying regions +on Sequence objects with encoding properties other than IUPAC and potentially +nonlinear structure. This class can also be used to set the orientation of a +SequenceAnnotation and any associated Component when their parent +ComponentDefinition is a partial design that lacks a Sequence. + +Attributes +---------- +* `orientation` : `URIProperty` + The orientation indicates how a region of double-stranded DNA represented by + the parent SequenceAnnotation and its associated Component are oriented. + + The orientation may be one of the following values. By default it is set to + SBOL_ORIENTATION_INLINE. + Orientation URI + + libSBOL Symbol + + http://sbols.org/v2#inline + + SBOL_ORIENTATION_INLINE + + http://sbols.org/v2#reverseComplement + + SBOL_ORIENTATION_REVERSE_COMPLEMENT + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/location.h +"; + +%feature("docstring") sbol::GenericLocation::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::GenericLocation::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::GenericLocation::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::GenericLocation::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::GenericLocation::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::GenericLocation::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::GenericLocation::~GenericLocation " +`~GenericLocation()` +"; + +%feature("docstring") sbol::GenericLocation::GenericLocation " +`GenericLocation(uri=\"example\")` + +Construct a GenericLocation. + +If operating in SBOL-compliant mode, use SequenceAnnotation::locations.create < +GenericLocation > instead. + +Parameters +---------- +* `uri` : + If operating in open-world mode, this should be a full URI including a + scheme, namespace, and identifier. If SBOLCompliance configuration is + enabled, then this argument is simply the displayId for the new object and a + full URI will automatically be constructed. +"; + +%feature("docstring") sbol::GenericLocation::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::GenericLocation::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::GenericLocation::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::GenericLocation::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::GenericLocation::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::GenericLocation::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::GenericLocation::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::GenericLocation::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::GenericLocation::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::GenericLocation::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::GenericLocation::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::GenericLocation::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::GenericLocation::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::GenericLocation::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +// File: classsbol_1_1_identified.xml + + +%feature("docstring") sbol::Identified " + +All SBOL-defined classes are directly or indirectly derived from the Identified +abstract class. + +An Identified object is identified using a Uniform Resource Identifier (URI), a +unique string that identifies and refers to a specific object in an SBOL +document or in an online resource such as a DNA repository. + +Attributes +---------- +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/identified.h +"; + +%feature("docstring") sbol::Identified::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Identified::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Identified::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Identified::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Identified::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Identified::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Identified::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Identified::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Identified::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Identified::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Identified::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Identified::~Identified " +`~Identified()` +"; + +%feature("docstring") sbol::Identified::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Identified::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Identified::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Identified::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Identified::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Identified::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Identified::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Identified::Identified " +`Identified(type_uri=SBOL_IDENTIFIED, uri=\"example\", version=VERSION_STRING)` +"; + +%feature("docstring") sbol::Identified::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Identified::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +// File: classsbol_1_1_implementation.xml + + +%feature("docstring") sbol::Implementation " + +An Implementation represents a real, physical instance of a synthetic biological +construct which may be associated with a laboratory sample. An Implementation +may be linked back to its original design (either a ModuleDefinition or +ComponentDefinition) using the wasDerivedFrom property inherited from the +Identified superclass. + +Attributes +---------- +* `built` : `URIProperty` + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/implementation.h +"; + +%feature("docstring") sbol::Implementation::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::Implementation::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Implementation::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Implementation::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Implementation::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Implementation::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Implementation::Implementation " +`Implementation(uri=\"example\", version=VERSION_STRING)` + +Construct an Implementation. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +"; + +%feature("docstring") sbol::Implementation::Implementation " +`Implementation(type, uri, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Implementation::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Implementation::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Implementation::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Implementation::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Implementation::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Implementation::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Implementation::~Implementation " +`~Implementation()` +"; + +%feature("docstring") sbol::Implementation::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Implementation::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::Implementation::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Implementation::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Implementation::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Implementation::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::Implementation::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Implementation::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Implementation::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Implementation::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Implementation::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Implementation::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +// File: classsbol_1_1_interaction.xml + + +%feature("docstring") sbol::Interaction " + +The Interaction class provides more detailed descriptionof how the +FunctionalComponents are intended to work together. For example, this class can +be used to represent different forms of genetic regulation (e.g., +transcriptional activation or repression), processes from the central dogma of +biology (e.g. transcription and translation), and other basic molecular +interactions (e.g., non-covalent binding or enzymatic phosphorylation). + +Attributes +---------- +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that describes the behavior + represented by an Interaction. + + The types property MUST contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the occurring entity + branch of the Systems Biology Ontology (SBO). (See + http://www.ebi.ac.uk/sbo/main/) The following table provides a list of + possible SBO terms for the types property and their corresponding URIs. + Type + + URI for SBO Term + + LibSBOL symbol + + Biochemical Reaction + + http://identifiers.org/biomodels.sbo/SBO:0000176 + + SBO_BIOCHEMICAL_REACTION + + Inhibition + + http://identifiers.org/biomodels.sbo/SBO:0000169 + + SBO_INHIBITION + + Stimulation + + http://identifiers.org/biomodels.sbo/SBO:0000170 + + SBO_STIMULATION + + Genetic Production + + http://identifiers.org/biomodels.sbo/SBO:0000589 + + SBO_GENETIC_PRODUCTION + + Non-Covalent Binding + + http://identifiers.org/biomodels.sbo/SBO:0000177 + + SBO_NONCOVALENT_BINDING + + Degradation + + http://identifiers.org/biomodels.sbo/SBO:0000179 + + SBO_DEGRADATION + + Control + + http://identifiers.org/biomodels.sbo/SBO:0000168 + + SBO_CONTROL + +* `participations` : `OwnedObject< Participation >` + The participations property is an OPTIONAL and MAY contain a set of + Participation objects, each of which identifies the roles that its + referenced FunctionalComponent plays in the Interaction. Even though an + Interaction generally contains at least one Participation, the case of zero + Participation objects is allowed because it is plausible that a designer + might want to specify that an Interaction will exist, even if its + participants have not yet been determined. + +* `functionalComponents` : `OwnedObject< FunctionalComponent >` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/interaction.h +"; + +%feature("docstring") sbol::Interaction::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Interaction::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Interaction::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Interaction::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Interaction::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Interaction::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Interaction::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Interaction::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Interaction::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Interaction::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Interaction::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Interaction::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Interaction::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Interaction::Interaction " +`Interaction(uri=\"example\", interaction_type=SBO_INTERACTION)` + +Construct an Interaction. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `interaction_type` : + A Systems Biology Ontology term that describes a biochemical interaction +"; + +%feature("docstring") sbol::Interaction::Interaction " +`Interaction(type, uri, interaction_type)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Interaction::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Interaction::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Interaction::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Interaction::~Interaction " +`~Interaction()` +"; + +%feature("docstring") sbol::Interaction::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Interaction::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Interaction::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Interaction::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +// File: classsbol_1_1_int_property.xml + + +%feature("docstring") sbol::IntProperty " + +IntProperty objects are used to contain integers. + +They can be used as member objects inside custom SBOL Extension classes. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/properties.h +"; + +%feature("docstring") sbol::IntProperty::IntProperty " +`IntProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules, initial_value)` + +Initialize the IntProperty with a value. + +Validation rules are checked upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::IntProperty::IntProperty " +`IntProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules)` + +Initialize an IntProperty without a value. + +No validation rules are run upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::IntProperty::IntProperty " +`IntProperty(property_owner, type_uri, lower_bound, upper_bound, initial_value)` +"; + +%feature("docstring") sbol::IntProperty::IntProperty " +`IntProperty(property_owner, type_uri, lower_bound, upper_bound)` +"; + +%feature("docstring") sbol::IntProperty::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::IntProperty::get " +`get() -> int` + +Get the integer value. + +Returns +------- +An integer +"; + +%feature("docstring") sbol::IntProperty::size " +`size() -> int` +"; + +%feature("docstring") sbol::IntProperty::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::IntProperty::clear " +`clear()` + +Clear all property values. +"; + +%feature("docstring") sbol::IntProperty::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + +%feature("docstring") sbol::IntProperty::getAll " +`getAll() -> std::vector< int >` +"; + +%feature("docstring") sbol::IntProperty::write " +`write()` +"; + +%feature("docstring") sbol::IntProperty::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. + +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; + +%feature("docstring") sbol::IntProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::IntProperty::set " +`set(new_value)` +"; + +%feature("docstring") sbol::IntProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::IntProperty::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; + +%feature("docstring") sbol::IntProperty::remove " +`remove(index=0)` + +Remove a property value. +"; + +%feature("docstring") sbol::IntProperty::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::IntProperty::getTypeURI " +`getTypeURI() -> rdf_type` +"; + +%feature("docstring") sbol::IntProperty::validate " +`validate(arg=NULL)` +"; + +%feature("docstring") sbol::IntProperty::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::IntProperty::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::IntProperty::add " +`add(new_value)` + +Appends the new value to a list of values, for properties that allow it. + +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; + +%feature("docstring") sbol::IntProperty::getUpperBound " +`getUpperBound() -> char` +"; + +// File: classsbol_1_1_owned_object_1_1iterator.xml + + +%feature("docstring") sbol::OwnedObject::iterator " + +Provides iterator functionality for SBOL properties that contain multiple +objects. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/object.h +"; + +%feature("docstring") sbol::OwnedObject::iterator::iterator " +`iterator(i_object=std::vector< SBOLObject *>::iterator())` +"; + +// File: classsbol_1_1_search_response_1_1iterator.xml + + +%feature("docstring") sbol::SearchResponse::iterator " + +Provides iterator functionality for SBOL properties that contain multiple +objects. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/partshop.h +"; + +%feature("docstring") sbol::SearchResponse::iterator::iterator " +`iterator(i_object=std::vector< Identified *>::iterator())` +"; + +// File: classsbol_1_1_document_1_1iterator.xml + + +%feature("docstring") sbol::Document::iterator " + +Iterate through TopLevel objects in a Document. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/document.h +"; + +%feature("docstring") sbol::Document::iterator::iterator " +`iterator(i_obj=std::unordered_map< std::string, sbol::SBOLObject + *>::iterator())` +"; + +// File: classsbol_1_1_property_1_1iterator.xml + + +%feature("docstring") sbol::Property::iterator " + +Provides iterator functionality for SBOL properties that contain multiple +values. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/property.h +"; + +%feature("docstring") sbol::Property::iterator::iterator " +`iterator(i_str=std::vector< std::string >::iterator())` +"; + +// File: classsbol_1_1_location.xml + + +%feature("docstring") sbol::Location " + +The Location class specifies the strand orientation of a Component and can be +further extended by the Range, Cut, and GenericLocation classes. + +Attributes +---------- +* `orientation` : `URIProperty` + The orientation indicates how a region of double-stranded DNA represented by + the parent SequenceAnnotation and its associated Component are oriented. + + The orientation may be one of the following values. By default it is set to + SBOL_ORIENTATION_INLINE. + Orientation URI + + libSBOL Symbol + + http://sbols.org/v2#inline + + SBOL_ORIENTATION_INLINE + + http://sbols.org/v2#reverseComplement + + SBOL_ORIENTATION_REVERSE_COMPLEMENT + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/location.h +"; + +%feature("docstring") sbol::Location::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Location::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Location::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Location::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Location::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Location::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Location::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Location::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Location::Location " +`Location(type=SBOL_LOCATION, uri=\"example\", + orientation=SBOL_ORIENTATION_INLINE)` +"; + +%feature("docstring") sbol::Location::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Location::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Location::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Location::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Location::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Location::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Location::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Location::~Location " +`~Location()` +"; + +%feature("docstring") sbol::Location::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Location::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Location::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Location::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Location::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +// File: classsbol_1_1_maps_to.xml + + +%feature("docstring") sbol::MapsTo " + +The purpose of the MapsTo class is to make identity relationships between +different ComponentInstances in functional and structural hierarchies more +clear. For example, a MapsTo object may be used to connect outputs and inputs +between different low-level ModuleDefinitions contained in a higher level Module +Definition. A MapsTo object may also be used to override a generic Component in +a low-level ModuleDefinition with an explicit Component in a high-level +ModuleDefinition, for example mapping a generic gene to an explicit component +with a name and sequence. + +Attributes +---------- +* `refinement` : `URIProperty` + Each MapsTo object MUST specify the relationship between its local and + remote ComponentInstance objects using one of the REQUIRED refinement URIs + provided in the table below. + + Refinement URI + + libSBOL Symbol + + Description + + http://sbols.org/v2#useRemote + + SBOL_REFINEMENT_USE_REMOTE + + All references to the local ComponentInstance MUST dereference to the + remote ComponentInstance instead. + + http://sbols.org/v2#useLocal + + SBOL_REFINEMENT_USE_LOCAL + + In the context of the ComponentDefinition or ModuleDefinition that contains + the owner of the MapsTo, all references to the remote ComponentInstance + MUST dereference to the local ComponentInstance instead. + + http://sbols.org/v2#verifyIdentical + + SBOL_REFINEMENT_VERIFY_IDENTICAL + + The definition properties of the local and remoteComponentInstance objects + MUST refer to the same ComponentDefinition. + + http://sbols.org/v2#merge + + SBOL_REFINEMENT_MERGE_DESCRIPTION + + In the context of the ComponentDefinition or ModuleDefinition that + contains the owner of the MapsTo, all references to the local + ComponentInstance or the remote ComponentInstance MUST dereference + to both objects. + +* `local` : `ReferencedObject` + The identity of the lower level ComponentInstance. + +* `remote` : `ReferencedObject` + The identity of the higher level ComponentInstance. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/mapsto.h +"; + +%feature("docstring") sbol::MapsTo::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::MapsTo::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::MapsTo::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::MapsTo::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::MapsTo::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::MapsTo::~MapsTo " +`~MapsTo()` +"; + +%feature("docstring") sbol::MapsTo::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::MapsTo::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::MapsTo::MapsTo " +`MapsTo(uri=\"example\", local=\"\", remote=\"\", + refinement=SBOL_REFINEMENT_VERIFY_IDENTICAL)` + +Construct a MapsTo. + +If operating in SBOL-compliant mode, use ModuleDefinition::mapsTos::create +instead. + +Parameters +---------- +* `uri` : + If operating in open-world mode, this should be a full URI including a + scheme, namespace, and identifier. If SBOLCompliance configuration is + enabled, then this argument is simply the displayId for the new object and a + full URI will automatically be constructed. +* `local` : + The identity of the lower level ComponentInstance +* `remote` : + The identity of the higher level ComponentInstance +* `restriction` : + Flag indicating the relationship between high- and low-level + ComponentInstances. By default, this is set to + SBOL_REFINEMENT_VERIFY_IDENTICAL +"; + +%feature("docstring") sbol::MapsTo::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::MapsTo::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::MapsTo::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::MapsTo::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::MapsTo::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::MapsTo::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::MapsTo::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::MapsTo::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::MapsTo::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::MapsTo::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::MapsTo::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::MapsTo::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::MapsTo::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +// File: classsbol_1_1_model.xml + + +%feature("docstring") sbol::Model " + +The purpose of the Model class is to serve as a placeholder for an external +computational model and provide additional meta-data to enable better reasoning +about the contents of this model. + +In this way, there is minimal duplication of standardization efforts and users +of SBOL can formalize the function of a ModuleDefinition in the language of +their choice. + +Attributes +---------- +* `source` : `URIProperty` + The source property is REQUIRED and MUST contain a URI reference to the + source file for a model. + +* `language` : `URIProperty` + The language property is REQUIRED and MUST contain a URI that specifies the + language in which the model is implemented. + + It is RECOMMENDED that this URI refer to a term from the EMBRACE Data and + Methods (EDAM) ontology. The Table below provides a list of terms from this + ontology and their URIs. If the language property of a Model is well- + described by one these terms, then it MUST contain the URI for this term as + its value. + Model Language + + URI for EDAM Term + + libSBOL Symbol + + SBML + + http://identifiers.org/edam/format_2585 + + EDAM_SBML + + CellML + + http://identifiers.org/edam/format_3240 + + EDAM_CELLML + + BioPAX + + http://identifiers.org/edam/format_3156 + + EDAM_BIOPAX + +* `framework` : `URIProperty` + Model Language + + URI for SBO Term + + libSBOL Symbol + + Continuous + + http://identifiers.org/biomodels.sbo/SBO:0000062 + + SBO_CONTINUOUS + + Discrete + + http://identifiers.org/biomodels.sbo/SBO:0000063 + + SBO_DISCRETE + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/model.h +"; + +%feature("docstring") sbol::Model::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Model::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Model::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Model::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Model::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Model::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Model::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Model::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::Model::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Model::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Model::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Model::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::Model::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Model::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Model::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Model::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::Model::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Model::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Model::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Model::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Model::~Model " +`~Model()` +"; + +%feature("docstring") sbol::Model::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Model::Model " +`Model(uri=\"example\", source=\"\", language=EDAM_SBML, + framework=SBO_CONTINUOUS, version=VERSION_STRING)` + +Construct a Model. + +Parameters +---------- +* `source` : + A URI reference to the model file +* `An` : + EDAM ontology term that specifies the language in which the model was + implemented +* `An` : + SBOL ontology term that specifies whether the model is continuous, discrete, + or other modeling technique +"; + +%feature("docstring") sbol::Model::Model " +`Model(type, uri, source, language, framework, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Model::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Model::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Model::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Model::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +// File: classsbol_1_1_module.xml + + +%feature("docstring") sbol::Module " + +The Module class represents a submodule of a ModuleDefinition within a +hierarchical design. + +Attributes +---------- +* `definition` : `ReferencedObject` + The definition property is a REQUIRED URI that refers to the + ModuleDefinition for the Module. + +* `mapsTos` : `OwnedObject< MapsTo >` + The mapsTos property is an OPTIONAL set of MapsTo objects that refer to and + link ComponentInstance objects together within the heterarchy of Module, + ModuleDefinition, ComponentInstance, and ComponentDefinition objects. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/module.h +"; + +%feature("docstring") sbol::Module::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Module::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Module::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Module::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Module::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Module::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Module::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Module::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Module::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Module::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Module::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Module::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Module::~Module " +`~Module()` +"; + +%feature("docstring") sbol::Module::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Module::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Module::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Module::Module " +`Module(uri=\"example\", definition=\"\", version=VERSION_STRING)` + +Construct a Module. + +If operating in SBOL-compliant mode, use ModuleDefinition::modules::create +instead. + +Parameters +---------- +* `uri` : + If operating in open-world mode, this should be a full URI including a + scheme, namespace, and identifier. If SBOLCompliance configuration is + enabled, then this argument is simply the displayId for the new object and a + full URI will automatically be constructed. +* `definition` : + The identity of the Component with this structural constraint +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::Module::Module " +`Module(type, uri, definition, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Module::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Module::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Module::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Module::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Module::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +// File: classsbol_1_1_module_definition.xml + + +%feature("docstring") sbol::ModuleDefinition " + +The ModuleDefinition class represents a grouping of structural and functional +entities in a biological design. The primary usage of this class is to assert +the molecular interactions and abstract function of its child entities. + +Attributes +---------- +* `roles` : `URIProperty` + The roles property is an OPTIONAL set of URIs that clarifies the intended + function of a ModuleDefinition. These URIs might identify descriptive + biological roles, such as metabolic pathway and signaling cascade, but + they can also identify identify logical roles, such as inverter or AND + gate, or other abstract roles for describing the function of design. + Interpretation of the meaning of such roles currently depends on the + software tools that read and write them. + +* `modules` : `OwnedObject< Module >` + The modules property is OPTIONAL and MAY specify a set of Module objects + contained by the ModuleDefinition. While the ModuleDefinition class is + analogous to a specification sheet for a system of interacting biological + elements, the Module class represents the occurrence of a particular + subsystem within the system. Hence, this class allows a system design to + include multiple instances of a subsystem, all defined by reference to the + same ModuleDefinition. For example, consider the ModuleDefinition for a + network of two-input repressor devices in which the particular repressors + have not been chosen yet. This ModuleDefinition could contain multiple + Module objects that refer to the same ModuleDefinition of an abstract two- + input repressor device. Note that the set of relations between Module and + ModuleDefinition objects is strictly acyclic. + +* `interactions` : `OwnedObject< Interaction >` + The interactions property is OPTIONAL and MAY specify a set of Interaction + objects within the ModuleDefinition. The Interaction class provides an + abstract, machine-readable representation of entity behavior within a + ModuleDefinition. Each Interaction contains Participation objects that + indicate the roles of the FunctionalComponent objects involved in the + Interaction. + +* `functionalComponents` : `OwnedObject< FunctionalComponent >` + The functionalComponents property is OPTIONAL and MAY specify a set of + FunctionalComponent objects contained by the ModuleDefinition. Just as a + Module represents an instance of a subsystem in the overall system + represented by a ModuleDefinition, a FunctionalComponent represents an + instance of a structural entity (represented by a ComponentDefinition) in + the system. This concept allows a ModuleDefinition to assert different + interactions for separate copies of the same structural entity if needed. + For example, a ModuleDefinition might contain multiple FunctionalComponent + objects that refer to the same promoter ComponentDefinition, but assert + different interactions for these promoter copies based on their separate + positions in another ComponentDefinition that represents the structure of + the entire system. + +* `models` : `ReferencedObject` + The models property is OPTIONAL and MAY specify a set of URI references to + Model objects. Model objects are placeholders that link ModuleDefinition + objects to computational models of any format. A ModuleDefinition object can + link to more than one Model since each might encode system behavior in a + different way or at a different level of detail. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/moduledefinition.h +"; + +%feature("docstring") sbol::ModuleDefinition::override " +`override(highlevel, lowlevel)` + +Overrides a low-level component in an abstract sub-Module with a high-level +component in a parent ModuleDefinition, for example when overriding an abstract +template Module with explicit components. + +Parameters +---------- +* `highlevel` : + A high-level FunctionalComponent +* `lowlevel` : + A low-level FunctionalComponent in a nested sub-Module +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::ModuleDefinition::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::ModuleDefinition::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::ModuleDefinition::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::ModuleDefinition::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::ModuleDefinition::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::ModuleDefinition::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::ModuleDefinition::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::ModuleDefinition::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::ModuleDefinition::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::ModuleDefinition::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::ModuleDefinition::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::ModuleDefinition::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::ModuleDefinition::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::ModuleDefinition::ModuleDefinition " +`ModuleDefinition(uri=\"example\", version=VERSION_STRING)` + +Construct a ModuleDefinition. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + valid Maven version string. +"; + +%feature("docstring") sbol::ModuleDefinition::ModuleDefinition " +`ModuleDefinition(sbol_type_uri, uri, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::ModuleDefinition::connect " +`connect(output, input)` + +Connects the output of a sub-Module with the input of another sub-Module. + +Auto-constructs MapsTo objects. + +Parameters +---------- +* `output` : + A FunctionalComponent configured as a Module output (see setOutput) +* `input` : + A FunctionalComponent configured as a Module input (see setInput) +"; + +%feature("docstring") sbol::ModuleDefinition::assemble " +`assemble(list_of_modules)` + +Assemble a high-level ModuleDefinition from lower-level submodules. + +Autoconstructs Module objects in the process. + +Parameters +---------- +* `list_of_modules` : + A list of pointers to the submodule ModuleDefinitions +"; + +%feature("docstring") sbol::ModuleDefinition::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::ModuleDefinition::setInput " +`setInput(input) -> FunctionalComponent &` + +Defines an input for a sub-Module. + +Useful for top-down assembly of Modules and sub-Modules. If a +FunctionalComponent with the given definition does not exist yet, one will be +autoconstructed. Otherwise the FunctionalComponent with the given definition +will be inferred. Be warned that this inference may fail if there is more than +one FunctionalComponent with the same definition. + +Parameters +---------- +* `input` : + A ComponentDefinition that defines the input + +Returns +------- +A FunctionalComponent that is derived from the argument ComponentDefinition and +configured as this ModuleDefinition's input (it's direction property is set to +SBOL_DIRECTION_IN) +"; + +%feature("docstring") sbol::ModuleDefinition::setInput " +`setInput(input)` + +Configures a FunctionalComponent as an input for a Module. + +Useful for bottom-up assembly of Modules and sub-Modules + +Parameters +---------- +* `input` : + The FunctionalComponent that will be configured +"; + +%feature("docstring") sbol::ModuleDefinition::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::ModuleDefinition::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::ModuleDefinition::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::ModuleDefinition::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::ModuleDefinition::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::ModuleDefinition::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::ModuleDefinition::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::ModuleDefinition::~ModuleDefinition " +`~ModuleDefinition()` +"; + +%feature("docstring") sbol::ModuleDefinition::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::ModuleDefinition::setOutput " +`setOutput(output) -> FunctionalComponent &` + +Defines an output for a sub-Module. + +Useful for top-down assembly of Modules and sub-Modules. If a +FunctionalComponent with the given definition does not exist yet, one will be +autoconstructed. Otherwise the FunctionalComponent with the given definition +will be inferred. Be warned that this inference may fail if there is more than +one FunctionalComponent with the same definition. + +Parameters +---------- +* `output` : + A ComponentDefinition that defines the output + +Returns +------- +A FunctionalComponent that is derived from the argument ComponentDefinition and +configured as this ModuleDefinition's output (it's direction property is set to +SBOL_DIRECTION_OUT) +"; + +%feature("docstring") sbol::ModuleDefinition::setOutput " +`setOutput(output)` + +Configures a FunctionalComponent as an output for a Module. + +Useful for bottom-up assembly of Modules and sub-Modules. + +Parameters +---------- +* `output` : + The FunctionalComponent that will be configured +"; + +%feature("docstring") sbol::ModuleDefinition::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::ModuleDefinition::addToDocument " +`addToDocument(arg1)` +"; + +// File: classsbol_1_1_owned_object.xml + + +%feature("docstring") sbol::OwnedObject " + +A container property that contains child objects. + +Creates a composition out of two or more classes. In the SBOL specification, +compositional relationships are indicated in class diagrams by arrows with black +diamonds. A compositional relationship means that deleting the parent object +will delete the child objects, and adding the parent object to a Document will +also add the child object. Owned objects are stored in arbitrary order. + +templateparam +------------- +* `SBOLClass` : + The type of child SBOL object contained by this Property + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/object.h +"; + +%feature("docstring") sbol::OwnedObject::getUpperBound " +`getUpperBound() -> char` +"; + +%feature("docstring") sbol::OwnedObject::OwnedObject " +`OwnedObject(property_owner, sbol_uri, lower_bound, upper_bound, + validation_rules, first_object)` + +Initialize a container and put the first object in it. + +Validation rules are checked upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::OwnedObject::OwnedObject " +`OwnedObject(property_owner, sbol_uri, lower_bound, upper_bound, + validation_rules)` + +Initialize a container property. + +No validation rules are run upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::OwnedObject::OwnedObject " +`OwnedObject(property_owner, sbol_uri, lower_bound, upper_bound, first_object)` +"; + +%feature("docstring") sbol::OwnedObject::OwnedObject " +`OwnedObject(property_owner, sbol_uri, lower_bound, upper_bound)` +"; + +%feature("docstring") sbol::OwnedObject::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::OwnedObject::validate " +`validate(arg=NULL)` +"; + +%feature("docstring") sbol::OwnedObject::write " +`write()` +"; + +%feature("docstring") sbol::OwnedObject::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::OwnedObject::remove " +`remove(uri) -> SBOLClass &` + +Remove an object from the list of objects. + +Parameters +---------- +* `uri` : + This can be a displayId of the object or a full URI may be provided. +"; + +%feature("docstring") sbol::OwnedObject::remove " +`remove(index=0)` + +Remove an object from the list of objects and destroy it. + +Parameters +---------- +* `index` : + A numerical index for the object. +"; + +%feature("docstring") sbol::OwnedObject::get " +`get(uri=\"\") -> SBOLClass &` + +Get the child object. + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object contained in this OwnedObject property +* `SBOLSubClass` : + A derived class of SBOLClass. Use this type specialization when adding + multiple types of SBOLObjects to a container. + +Parameters +---------- +* `sbol_obj` : + A child object to add to this container property. Adds a child object to the + parent object. This method always appends another object to those already + contained in this OwnedObject property. In SBOLCompliant mode, the create + method is preferred + +templateparam +------------- +* `SBOLClass` : + The type of the child object + +Parameters +---------- +* `uri` : + The URI of the child object + +Returns +------- +A reference to the child object By default returns the first object in this +OwnedObject container property +"; + +%feature("docstring") sbol::OwnedObject::get " +`get(uri=\"\") -> SBOLSubClass &` + +Get the child object. + +templateparam +------------- +* `SBOLClass` : + The type of the child object +* `SBOLSubClass` : + A derived class of SBOLClass. Use this type specialization when adding + multiple types of SBOLObjects to a container. + +Parameters +---------- +* `uri` : + The specific URI for a child object if this OwnedObject property contains + multiple objects, + +Returns +------- +A reference to the child object Returns a child object from the OwnedObject +property. If no URI is specified, the first object in this OwnedObject property +is returned. +"; + +%feature("docstring") sbol::OwnedObject::getAll " +`getAll() -> std::vector< SBOLClass * >` + +Get all the objects contained in the property. + +Returns +------- +A vector of pointers to the objects +"; + +%feature("docstring") sbol::OwnedObject::create " +`create(uri) -> SBOLClass &` + +Autoconstructs a child object and attaches it to the parent object. + +The new object will be constructed with default values specified in the +constructor for this type of object. If SBOLCompliance is enabled, the child +object's identity will be constructed using the supplied displayId argument. +Otherwise, the user should supply a full URI. + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object that will be created + +Parameters +---------- +* `uri` : + If SBOLCompliance is enabled, this should be the displayId for the new child + object. If not enabled, this should be a full raw URI. + +Returns +------- +A reference to the child object check uniqueness of URI in Document +"; + +%feature("docstring") sbol::OwnedObject::create " +`create(uri) -> SBOLSubClass &` + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object contained in this OwnedObject property +* `SBOLSubClass` : + A derived class of SBOLClass. Use this specialization for OwnedObject + properties which contain multiple types of SBOLObjects. + +Parameters +---------- +* `uri` : + If SBOLCompliance is enabled, this should be the displayId for the new child + object. If not enabled, this should be a full raw URI. + +Returns +------- +A reference to the child object Autoconstructs a child object and attaches it to +the parent object. The new object will be constructed with default values +specified in the constructor for this type of object. If SBOLCompliance is +enabled, the child object's identity will be constructed using the supplied +displayId argument. Otherwise, the user should supply a full URI. check +uniqueness of URI in Document +"; + +%feature("docstring") sbol::OwnedObject::create " +`create(uri) -> Build &` +"; + +%feature("docstring") sbol::OwnedObject::create " +`create(uri) -> Test &` +"; + +%feature("docstring") sbol::OwnedObject::create " +`create(uri) -> Build &` +"; + +%feature("docstring") sbol::OwnedObject::create " +`create(uri) -> Test &` +"; + +%feature("docstring") sbol::OwnedObject::set " +`set(sbol_obj)` + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object contained in this OwnedObject property + +Parameters +---------- +* `sbol_obj` : + A child object to add to this container property. Assigns a child object to + this OwnedObject container property. This method always overwrites the first + SBOLObject in the container. appends another object to those already + contained in this OwnedObject property. In SBOLCompliant mode, the create + method is preferred +* `sbol_obj` : + The child object Sets the first object in the container +"; + +%feature("docstring") sbol::OwnedObject::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. + +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; + +%feature("docstring") sbol::OwnedObject::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::OwnedObject::set " +`set(new_value)` +"; + +%feature("docstring") sbol::OwnedObject::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::OwnedObject::clear " +`clear()` + +Remove all children objects from the parent and destroy them. +"; + +%feature("docstring") sbol::OwnedObject::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + +%feature("docstring") sbol::OwnedObject::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::OwnedObject::size " +`size() -> int` +"; + +%feature("docstring") sbol::OwnedObject::find " +`find(uri) -> bool` + +Parameters +---------- +* `uri` : + The full uniform resource identifier of the object to search for in this + property + +Returns +------- +A boolean indicating whether found or not +"; + +%feature("docstring") sbol::OwnedObject::define " +`define(definition_object) -> SBOLClass &` + +Autoconstructs a child object and attaches it to the parent object. + +Additionally, it sets the definition property of the child object, for example, +in the case of creating Components, FunctionalComponents, and Modules. The new +object will be constructed with default values specified in the constructor for +this type of object. If SBOLCompliance is enabled, the child object's identity +will be constructed using the supplied displayId argument. Otherwise, the user +should supply a full URI. + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object that will be created + +Parameters +---------- +* `definition_object` : + The returned object will reference the definition_object in its definition + property. + +Returns +------- +A reference to the child object check uniqueness of URI in Document +"; + +%feature("docstring") sbol::OwnedObject::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::OwnedObject::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::OwnedObject::getTypeURI " +`getTypeURI() -> rdf_type` +"; + +%feature("docstring") sbol::OwnedObject::add " +`add(sbol_obj)` + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object contained in this OwnedObject property + +Parameters +---------- +* `sbol_obj` : + A child object to add to this container property. Adds a child object to the + parent object. This method always appends another object to those already + contained in this OwnedObject property. In SBOLCompliant mode, the create + method is preferred +"; + +%feature("docstring") sbol::OwnedObject::add " +`add(new_value)` + +Appends the new value to a list of values, for properties that allow it. + +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; + +// File: classsbol_1_1_participation.xml + + +%feature("docstring") sbol::Participation " + +Each Participation represents how a particular FunctionalComponent behaves in +its parent Interaction. + +Attributes +---------- +* `roles` : `URIProperty` + The roles property is an OPTIONAL set of URIs that describes the behavior of + a Participation (and by extension its referenced FunctionalComponent) in the + context of its parent Interaction. + + The roles property MAY contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the participant role + branch of the SBO. The table below provides a list of possible SBO terms for + the roles property and their corresponding URIs. + Role + + Systems Biology Ontology Term + + LibSBOL Symbol + + Inhibitor + + http://identifiers.org/biomodels.sbo/SBO:0000020 + + SBO_INHIBITOR + + Stimulator + + http://identifiers.org/biomodels.sbo/SBO:0000459 + + SBO_STIMULATOR + + Reactant + + http://identifiers.org/biomodels.sbo/SBO:0000010 + + SBO_REACTANT + + Product + + http://identifiers.org/biomodels.sbo/SBO:0000011 + + SBO_PRODUCT + + Ligand + + http://identifiers.org/biomodels.sbo/SBO:0000280 + + SBO_LIGAND + + Non-covalent Complex + + http://identifiers.org/biomodels.sbo/SBO:0000253 + + SBO_NONCOVALENT_COMPLEX + + If a Participation is well described by one of the terms from this table + then its roles property MUST contain the URI that identifies this term. + Lastly, if the roles property of a Participation contains multiple URIs, + then they MUST identify non-conflicting terms. For example, the SBO terms + stimulator and inhibitor would conflict. + +* `participant` : `ReferencedObject` + The participant property MUST specify precisely one FunctionalComponent + object that plays the designated role in its parent Interaction object. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/participation.h +"; + +%feature("docstring") sbol::Participation::~Participation " +`~Participation()` +"; + +%feature("docstring") sbol::Participation::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Participation::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Participation::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Participation::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Participation::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Participation::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Participation::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Participation::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Participation::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Participation::define " +`define(species, role=\"\")` +"; + +%feature("docstring") sbol::Participation::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Participation::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Participation::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Participation::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Participation::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Participation::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Participation::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Participation::Participation " +`Participation(uri=\"example\", participant=\"\", version=VERSION_STRING)` + +Constructor. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `participant` : + A reference to the participating FunctionalComponent in the parent + Interaction +"; + +%feature("docstring") sbol::Participation::Participation " +`Participation(uri, species, version=VERSION_STRING)` + +Constructor. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `species` : + A ComponentDefinition that represents one of the participating species in + the parent Interaction +"; + +%feature("docstring") sbol::Participation::Participation " +`Participation(type, uri, participant, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Participation::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Participation::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Participation::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Participation::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +// File: classsbol_1_1_part_shop.xml + + +%feature("docstring") sbol::PartShop " + +A class which provides an API front-end for online bioparts repositories. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/partshop.h +"; + +%feature("docstring") sbol::PartShop::pull " +`pull(uri, doc)` + +Retrieve an object from an online resource. + +Parameters +---------- +* `uri` : + The identity of the SBOL object you want to retrieve +* `doc` : + A document to add the data to +"; + +%feature("docstring") sbol::PartShop::pull " +`pull(uris, doc)` + +Retrieve an object from an online resource. + +Parameters +---------- +* `uris` : + A vector of URIs for multiple SBOL objects you want to retrieve +* `doc` : + A document to add the data to +"; + +%feature("docstring") sbol::PartShop::pull " +`pull(uri, doc, recursive=true)` +"; + +%feature("docstring") sbol::PartShop::pull " +`pull(uri, doc, recursive)` +"; + +%feature("docstring") sbol::PartShop::pull " +`pull(uri, doc, recursive)` +"; + +%feature("docstring") sbol::PartShop::login " +`login(email, password=\"\")` + +In order to submit to a PartShop, you must login first. + +Register on SynBioHub to obtain account credentials. + +Parameters +---------- +* `email` : + The email associated with the user's SynBioHub account +* `password` : + The user's password +"; + +%feature("docstring") sbol::PartShop::submit " +`submit(doc, collection=\"\", overwrite=0) -> std::string` + +Submit an SBOL Document to SynBioHub. + +Parameters +---------- +* `doc` : + The Document to submit +* `collection` : + The URI of an SBOL Collection to which the Document contents will be + uploaded +* `overwrite` : + An integer code: 0(default) - do not overwrite, 1 - overwrite, 2 - merge +"; + +%feature("docstring") sbol::PartShop::addSynBioHubAnnotations " +`addSynBioHubAnnotations(doc)` +"; + +%feature("docstring") sbol::PartShop::search " +`search(search_text, object_type, property_uri, offset=0, limit=25) -> + SearchResponse &` + +An EXACT search. + +Scan the parts repository for objects that exactly match the specified criteria. +In most uses of this function, LibSBOL's built-in RDF type constants (see +constants.h) will come in handy. For instance, searching for all +SBOL_COMPONENT_DEFINITION of type BIOPAX_DNA. (These constants follow a fairly +systematic and consistent naming scheme (see constants.h). The number of records +returned in the search is specified by offset and limit parameters. + +Parameters +---------- +* `search_text` : + This may be a literal text value or it may be a URI. +* `object_type` : + The RDF type of an SBOL object. See constants.h. For example, + SBOL_COMPONENT_DEFINITION +* `property_uri` : + The RDF type of an SBOL property. Specifies which field of an SBOL object to + search. For example, SBOL_ROLES. Refer to constants.h +* `offset` : + The index of the first record to return. This parameter is indexed starting + from zero. +* `limit` : + The total count number of records to return + +Returns +------- +Metadata formatted as a string encoding JSON. +"; + +%feature("docstring") sbol::PartShop::search " +`search(search_text, object_type=SBOL_COMPONENT_DEFINITION, offset=0, limit=25) + -> SearchResponse &` + +A GENERAL search. + +Search name, description, and displayId properties for a match to the search +text, including matches to substrings of the property value. The type of object +to search for can be further restricted by use of the second parameter, though +this is set to SBOL_COMPONENT_DEFINITION by default. See constants.h for more of +libSBOL's built-in RDF type constants. These constants follow a fairly +predictable and consistent naming scheme. The number of records returned in the +search is specified by offset and limit parameters. + +Parameters +---------- +* `search_text` : + A snippet of text to search for in a property's value. +* `object_type` : + The RDF type of an SBOL object. See constants.h. For example, + SBOL_COMPONENT_DEFINITION by default. +* `offset` : + The index of the first record to return. This parameter is indexed starting + from zero. +* `limit` : + The total count number of records to return + +Returns +------- +Metadata formatted as a string encoding JSON. +"; + +%feature("docstring") sbol::PartShop::search " +`search(q) -> SearchResponse &` + +Perform an ADVANCED search using a SearchQuery object. + +Parameters +---------- +* `search_query` : + A map of string key-value pairs. Keys are objectType, sbolTag, collection, + dcterms:tag, namespace/tag, offset, limit. + +Returns +------- +Search metadata A vector of maps with key-value pairs. +"; + +%feature("docstring") sbol::PartShop::searchRootCollections " +`searchRootCollections() -> std::string` + +Returns all Collections that are not members of any other Collections. + +Parameters +---------- +* `doc` : + A Document to add the Collections to +"; + +%feature("docstring") sbol::PartShop::attachFile " +`attachFile(topleveluri, filename)` + +Upload and attach a file to a TopLevel object in a PartShop. + +Parameters +---------- +* `top_level_uri` : + The identity of the object to which the file will be attached +* `file_name` : + A path to the file attachment +"; + +%feature("docstring") sbol::PartShop::count " +`count() -> int` + +Return the count of objects contained in a PartShop. + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object, usually a ComponentDefinition +"; + +%feature("docstring") sbol::PartShop::getURL " +`getURL() -> std::string` + +Returns the network address of the PartShop. + +Returns +------- +The URL of the online repository +"; + +%feature("docstring") sbol::PartShop::searchCount " +`searchCount(search_text, object_type, property_uri) -> int` + +Returns the number of search records for an EXACT search matching the given +criteria. + +Returns +------- +An integer count. +"; + +%feature("docstring") sbol::PartShop::searchCount " +`searchCount(search_text, object_type=SBOL_COMPONENT_DEFINITION) -> int` + +Returns the number of search records for a general search matching the given +criteria. + +Returns +------- +An integer count. +"; + +%feature("docstring") sbol::PartShop::searchCount " +`searchCount(q) -> int` + +Returns the number of search records matching the given criteria for an ADVANCED +search. + +Parameters +---------- +* `search_query` : + A map of string key-value pairs. See SearchQuery for required and optional + criteria. + +Returns +------- +An integer count. +"; + +%feature("docstring") sbol::PartShop::searchSubCollections " +`searchSubCollections(uri) -> std::string` + +Returns all Collections that are members of the Collection specified by its URI. + +Parameters +---------- +* `uri` : + The URI of a Collection of Collections +* `doc` : + A Document to add the subcollections to +"; + +%feature("docstring") sbol::PartShop::downloadAttachment " +`downloadAttachment(attachment_uri, path=\".\")` + +Download a file attached to a TopLevel object in an online repository. + +Parameters +---------- +* `attachment_uri` : + The full URI of the attached object +* `path` : + The target path to which the file will be downloaded +"; + +%feature("docstring") sbol::PartShop::PartShop " +`PartShop(url)` + +Construct an interface to an instance of SynBioHub or other parts repository. + +Parameters +---------- +* `The` : + URL of the online repository +"; + +// File: classsbol_1_1_plan.xml + + +%feature("docstring") sbol::Plan " + +Examples of agents are person, organisation or software. These agents should be +annotated with additional information, such as software version, needed to be +able to run the same software again. + +Attributes +---------- +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/provo.h +"; + +%feature("docstring") sbol::Plan::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Plan::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Plan::Plan " +`Plan(uri=\"example\", version=VERSION_STRING)` + +Constructor. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +"; + +%feature("docstring") sbol::Plan::Plan " +`Plan(type, uri, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Plan::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Plan::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::Plan::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Plan::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Plan::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Plan::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Plan::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Plan::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Plan::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Plan::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Plan::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Plan::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Plan::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Plan::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Plan::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Plan::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Plan::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Plan::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Plan::~Plan " +`~Plan()` +"; + +%feature("docstring") sbol::Plan::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::Plan::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Plan::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::Plan::generate " +`generate() -> SBOLClass &` +"; + +// File: classsbol_1_1_property.xml + + +%feature("docstring") sbol::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. + +templateparam +------------- +* `The` : + SBOL specification currently supports string, URI, and integer literal + values. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/property.h +"; + +%feature("docstring") sbol::Property::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::Property::clear " +`clear()` + +Clear all property values. +"; + +%feature("docstring") sbol::Property::size " +`size() -> int` +"; + +%feature("docstring") sbol::Property::remove " +`remove(index=0)` + +Remove a property value. +"; + +%feature("docstring") sbol::Property::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; + +%feature("docstring") sbol::Property::Property " +`Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules, + initial_value)` + +Parameters +---------- +* `type_uri` : + An RDF hash URI for this property, consisting of a namespace followed by an + identifier. For example, Properties of SBOLObjects use URIs of the form + http://sbols.org/v2#somePropertyName, where the identifier somePropertyName + determines the appearance of XML nodes in an SBOL file. Alternatively, + annotations in a custom namespace can be provided using a similarly formed + hash URI in another namespace. +* `property_owner` : + All Property objects must have a pointer back to its parent SBOLObject of + which it is a member +* `initial_value` : + The initial value of the Property +* `validation_rules` : + A vector of externally defined ValidationRules. The vector contains pointers + to functions which correspond to the validation rules listed in the appendix + of the formal SBOL specification document. ValidationRules are automatically + checked every time a setter or adder method is called and when Documents are + read and written. +"; + +%feature("docstring") sbol::Property::Property " +`Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules, + initial_value)` +"; + +%feature("docstring") sbol::Property::Property " +`Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules, + initial_value)` +"; + +%feature("docstring") sbol::Property::Property " +`Property(property_owner, type_uri, lower_bound, upper_bound, validation_rules)` +"; + +%feature("docstring") sbol::Property::write " +`write()` +"; + +%feature("docstring") sbol::Property::~Property " +`~Property()` +"; + +%feature("docstring") sbol::Property::add " +`add(new_value)` + +Appends the new value to a list of values, for properties that allow it. + +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; + +%feature("docstring") sbol::Property::getUpperBound " +`getUpperBound() -> char` +"; + +%feature("docstring") sbol::Property::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::Property::getTypeURI " +`getTypeURI() -> rdf_type` +"; + +%feature("docstring") sbol::Property::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. + +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; + +%feature("docstring") sbol::Property::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::Property::set " +`set(new_value)` +"; + +%feature("docstring") sbol::Property::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::Property::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::Property::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + +%feature("docstring") sbol::Property::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::Property::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::Property::validate " +`validate(arg=NULL)` +"; + +// File: classsbol_1_1_range.xml + + +%feature("docstring") sbol::Range " + +A Range object specifies a region via discrete, inclusive start and end +positions that correspond to indices for characters in the elements String of a +Sequence. Note that the index of the first location is 1, as is typical practice +in biology, rather than 0, as is typical practice in computer science. + +Attributes +---------- +* `start` : `IntProperty` + Specifies the inclusive starting position of a sequence region. It must be 1 + or greater. + +* `end` : `IntProperty` + Specifies the inclusive end position of a sequence region. It must be equal + to or greater than the start. + +* `orientation` : `URIProperty` + The orientation indicates how a region of double-stranded DNA represented by + the parent SequenceAnnotation and its associated Component are oriented. + + The orientation may be one of the following values. By default it is set to + SBOL_ORIENTATION_INLINE. + Orientation URI + + libSBOL Symbol + + http://sbols.org/v2#inline + + SBOL_ORIENTATION_INLINE + + http://sbols.org/v2#reverseComplement + + SBOL_ORIENTATION_REVERSE_COMPLEMENT + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/location.h +"; + +%feature("docstring") sbol::Range::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Range::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Range::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Range::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Range::adjoins " +`adjoins(comparand) -> int` + +Indicate if these Ranges represent adjacent intervals. + +Another Range object + +Returns +------- +1 if these Ranges adjoin or border each other, 0 if they are separated by an +intervening Range +"; + +%feature("docstring") sbol::Range::follows " +`follows(comparand) -> int` + +Calculates how many bases separate these Ranges Another Range object. + +Returns +------- +The number of bases by which this Range follows the comparand, or 0 if it does +not follow +"; + +%feature("docstring") sbol::Range::length " +`length() -> int` + +Returns the length of a Range. +"; + +%feature("docstring") sbol::Range::contains " +`contains(comparand) -> int` + +Calculates how many bases of the comparand are contained by this Range. + +Another Range object + +Returns +------- +The number of bases which are contained (equivalent to the length of the +comparand), or 0 if it is not contained. +"; + +%feature("docstring") sbol::Range::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Range::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Range::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Range::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Range::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Range::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Range::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Range::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Range::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Range::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Range::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Range::overlaps " +`overlaps(comparand) -> int` + +Calculates how many bases separate this Range from the comparand. + +Another Range object + +Returns +------- +The number of bases by which the Ranges overlap. If they overlap, this is always +a positive number regardless of direction. If they do not overlap, returns zero +"; + +%feature("docstring") sbol::Range::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Range::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Range::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Range::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Range::~Range " +`~Range()` +"; + +%feature("docstring") sbol::Range::Range " +`Range(uri=\"example\", start=1, end=2)` + +Construct a Range. + +If operating in SBOL-compliant mode, use SequenceAnnotation::locations.create < +Range > instead. + +Parameters +---------- +* `uri` : + If operating in open-world mode, this should be a full URI including a + scheme, namespace, and identifier. If SBOLCompliance configuration is + enabled, then this argument is simply the displayId for the new object and a + full URI will automatically be constructed. +* `start` : + An integer of 1 or greater +* `end` : + An integer equal to or greater than the start +"; + +%feature("docstring") sbol::Range::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Range::precedes " +`precedes(comparand) -> int` + +Calculates how many bases separate these Ranges Another Range object. + +Returns +------- +The number of bases by which this Range precedes the comparand, or 0 if it does +not precede +"; + +// File: classsbol_1_1_referenced_object.xml + + +%feature("docstring") sbol::ReferencedObject " + +A reference to another SBOL object Contains a Uniform Resource Identifier (URI) +that refers to an an associated object. + +The object it points to may be another resource in this Document or an external +reference, for example to an object in an external repository or database. In +the SBOL specification, association by reference is indicated in class diagrams +by arrows with open (white) diamonds. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/object.h +"; + +%feature("docstring") sbol::ReferencedObject::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::ReferencedObject::getUpperBound " +`getUpperBound() -> char` +"; + +%feature("docstring") sbol::ReferencedObject::validate " +`validate(arg=NULL)` +"; + +%feature("docstring") sbol::ReferencedObject::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::ReferencedObject::add " +`add(uri)` + +Append a URI reference of an object to the property store. + +Parameters +---------- +* `uri` : + The full URI of the referenced object, e.g., my_obj.identity.get() +"; + +%feature("docstring") sbol::ReferencedObject::add " +`add(obj)` + +Append a URI reference of an object to the property store. + +Parameters +---------- +* `The` : + referenced object +"; + +%feature("docstring") sbol::ReferencedObject::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::ReferencedObject::getTypeURI " +`getTypeURI() -> rdf_type` +"; + +%feature("docstring") sbol::ReferencedObject::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; + +%feature("docstring") sbol::ReferencedObject::create " +`create(uri) -> std::string` + +Creates a new SBOL object corresponding to the RDF type specified in the +Property definition. + +Creates another SBOL object derived from TopLevel and adds it to the Document. + +Parameters +---------- +* `uri` : + A Uniform Resource Identifier (URI) for the new object, or a displayId if + operating in SBOL-compliant mode (library default) + +Returns +------- +The full URI of the created object + +Parameters +---------- +* `uri` : + In \"open world\" mode, this is a full URI and the same as the returned URI. + If the default namespace for libSBOL has been configured, then this argument + should simply be a local identifier. If SBOL-compliance is enabled, this + argument should be the intended displayId of the new object. A full URI is + automatically generated and returned. + +Returns +------- +The full URI of the created object. +"; + +%feature("docstring") sbol::ReferencedObject::set " +`set(uri)` + +Set the property with a URI reference to an object. + +Parameters +---------- +* `The` : + full URI of the referenced object, e.g., my_obj.identity.get() +"; + +%feature("docstring") sbol::ReferencedObject::set " +`set(obj)` + +Set the property with a URI reference to an object, overwriting the first value +in the property store. + +Parameters +---------- +* `The` : + referenced object +"; + +%feature("docstring") sbol::ReferencedObject::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::ReferencedObject::set " +`set(new_value)` +"; + +%feature("docstring") sbol::ReferencedObject::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::ReferencedObject::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::ReferencedObject::setReference " +`setReference(uri)` +"; + +%feature("docstring") sbol::ReferencedObject::clear " +`clear()` + +Clear all property values. +"; + +%feature("docstring") sbol::ReferencedObject::write " +`write()` +"; + +%feature("docstring") sbol::ReferencedObject::size " +`size() -> int` +"; + +%feature("docstring") sbol::ReferencedObject::getAll " +`getAll() -> std::vector< std::string >` +"; + +%feature("docstring") sbol::ReferencedObject::get " +`get() -> std::string` + +Get first URI. + +Returns +------- +A string of characters used to identify a resource +"; + +%feature("docstring") sbol::ReferencedObject::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::ReferencedObject::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + +%feature("docstring") sbol::ReferencedObject::remove " +`remove(index=0)` + +Remove a property value. +"; + +%feature("docstring") sbol::ReferencedObject::addReference " +`addReference(uri)` +"; + +%feature("docstring") sbol::ReferencedObject::ReferencedObject " +`ReferencedObject(property_owner, type_uri, reference_type_uri, lower_bound, + upper_bound, validation_rules, initial_value)` +"; + +%feature("docstring") sbol::ReferencedObject::ReferencedObject " +`ReferencedObject(property_owner, type_uri, reference_type_uri, lower_bound, + upper_bound, validation_rules)` +"; + +%feature("docstring") sbol::ReferencedObject::ReferencedObject " +`ReferencedObject(property_owner, type_uri, reference_type_uri, lower_bound, + upper_bound, initial_value)` +"; + +%feature("docstring") sbol::ReferencedObject::ReferencedObject " +`ReferencedObject(property_owner, type_uri, reference_type_uri, lower_bound, + upper_bound)` +"; + +// File: classsbol_1_1_sample_roster.xml + + +%feature("docstring") sbol::SampleRoster " + +A SampleRoster is a container used to group Builds that are included in an +experiment together. A SampleRoster can be used to generate a Test in a Design- +Build-Test-Learn workflow. + +Attributes +---------- +* `samples` : `ReferencedObject` + References to Builds which were tested in an experiment. + +* `members` : `URIProperty` + The members property of a Collection is OPTIONAL and MAY contain a set of + URI references to zero or more TopLevel objects. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/dbtl.h +"; + +%feature("docstring") sbol::SampleRoster::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SampleRoster::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SampleRoster::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::SampleRoster::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::SampleRoster::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SampleRoster::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::SampleRoster::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SampleRoster::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SampleRoster::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SampleRoster::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SampleRoster::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::SampleRoster::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SampleRoster::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SampleRoster::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::SampleRoster::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::SampleRoster::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::SampleRoster::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::SampleRoster::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::SampleRoster::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::SampleRoster::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SampleRoster::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SampleRoster::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::SampleRoster::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SampleRoster::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SampleRoster::SampleRoster " +`SampleRoster(uri=\"example\", version=VERSION_STRING)` + +Construct a new SampleRoster object. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +// File: classsbol_1_1_s_b_o_l_error.xml + + +%feature("docstring") sbol::SBOLError " +"; + +%feature("docstring") sbol::SBOLError::what " +`what() -> const char *` +"; + +%feature("docstring") sbol::SBOLError::SBOLError " +`SBOLError(error_code, message)` +"; + +%feature("docstring") sbol::SBOLError::error_code " +`error_code() -> SBOLErrorCode` +"; + +// File: classsbol_1_1_s_b_o_l_object.xml + + +%feature("docstring") sbol::SBOLObject " + +An SBOLObject converts a C++ class data structure into an RDF triple store and +contains methods for serializing and parsing RDF triples. + +Attributes +---------- +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/object.h +"; + +%feature("docstring") sbol::SBOLObject::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SBOLObject::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SBOLObject::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SBOLObject::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::SBOLObject::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SBOLObject::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::SBOLObject::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SBOLObject::SBOLObject " +`SBOLObject(uri=\"example\")` +"; + +%feature("docstring") sbol::SBOLObject::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SBOLObject::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SBOLObject::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SBOLObject::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SBOLObject::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SBOLObject::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::SBOLObject::~SBOLObject " +`~SBOLObject()` +"; + +%feature("docstring") sbol::SBOLObject::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SBOLObject::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SBOLObject::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SBOLObject::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SBOLObject::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +// File: classsbol_1_1_search_query.xml + + +%feature("docstring") sbol::SearchQuery " + +A SearchQuery object is used to configure advanced searches for bioparts in a +PartShop. Advanced searches are useful for matching values across multiple +fields, or to specify multiple values in a single field. + +Attributes +---------- +* `objectType` : `URIProperty` + Set this property to indicate the type of SBOL object to search for. Set to + SBOL_COMPONENT_DEFINITION by default. + +* `limit` : `IntProperty` + Set this property to specify the total number of records to retrieve from a + search request. By default 25 records are retrieved. + +* `offset` : `IntProperty` + When the number of search hits exceeds the limit, the offset property can be + used to retrieve more records. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/partshop.h +"; + +%feature("docstring") sbol::SearchQuery::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchQuery::SearchQuery " +`SearchQuery(search_target=SBOL_COMPONENT_DEFINITION, offset=0, limit=25)` + +SearchQuery constructor. + +Parameters +---------- +* `search_target` : + The type of SBOL object to search for, indicated using a URI. Set to + SBOL_COMPONENT_DEFINITION by default. +"; + +%feature("docstring") sbol::SearchQuery::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SearchQuery::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::SearchQuery::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SearchQuery::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::SearchQuery::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchQuery::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchQuery::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SearchQuery::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SearchQuery::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SearchQuery::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::SearchQuery::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SearchQuery::~SearchQuery " +`~SearchQuery()` + +Retrieve a child object by URI. +"; + +%feature("docstring") sbol::SearchQuery::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SearchQuery::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SearchQuery::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SearchQuery::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SearchQuery::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::SearchQuery::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SearchQuery::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SearchQuery::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::SearchQuery::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SearchQuery::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::SearchQuery::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchQuery::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +// File: classsbol_1_1_search_response.xml + + +%feature("docstring") sbol::SearchResponse " + +A SearchResponse is a container of search records returned by a search request. + +Attributes +---------- +* `records` : `std::vector< sbol::Identified *>` + +* `python_iter` : `std::vector< Identified * >::iterator` + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/partshop.h +"; + +%feature("docstring") sbol::SearchResponse::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::SearchResponse::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SearchResponse::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SearchResponse::~SearchResponse " +`~SearchResponse()` +"; + +%feature("docstring") sbol::SearchResponse::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::SearchResponse::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SearchResponse::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SearchResponse::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchResponse::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchResponse::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::SearchResponse::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SearchResponse::size " +`size() -> int` + +Returns the number of records contained in a search response. +"; + +%feature("docstring") sbol::SearchResponse::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SearchResponse::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::SearchResponse::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::SearchResponse::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SearchResponse::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::SearchResponse::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::SearchResponse::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SearchResponse::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SearchResponse::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::SearchResponse::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SearchResponse::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SearchResponse::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchResponse::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::SearchResponse::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::SearchResponse::SearchResponse " +`SearchResponse()` +"; + +%feature("docstring") sbol::SearchResponse::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SearchResponse::extend " +`extend(response)` + +Adds more search records to an existing SearchResponse. + +Parameters +---------- +* `response` : + A SearchResponse object +"; + +%feature("docstring") sbol::SearchResponse::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +// File: classsbol_1_1_sequence.xml + + +%feature("docstring") sbol::Sequence " + +The primary structure (eg, nucleotide or amino acid sequence) of a +ComponentDefinition object. + +Attributes +---------- +* `elements` : `TextProperty` + The elements property is a REQUIRED String of characters that represents the + constituents of a biological or chemical molecule. For example, these + characters could represent the nucleotide bases of a molecule of DNA, the + amino acid residues of a protein, or the atoms and chemical bonds of a small + molecule. + +* `encoding` : `URIProperty` + The encoding property is REQUIRED and has a data type of URI. + + This property MUST indicate how the elements property of a Sequence MUST be + formed and interpreted. For example, the elements property of a Sequence + with an IUPAC DNA encoding property MUST contain characters that represent + nucleotide bases, such as a, t, c, and g. The elements property of a + Sequence with a Simplified Molecular-Input Line-Entry System (SMILES) + encoding, on the other hand, MUST contain characters that represent atoms + and chemical bonds, such as C, N, O, and =. It is RECOMMENDED that the + encoding property contains a URI from the table below. The terms in the + table are organized by the type of ComponentDefinition that typically refer + to a Sequence with such an encoding. When the encoding of a Sequence is well + described by one of the URIs in the table, it MUST contain that URI. + ComponentDefinition type + + Encoding + + libSBOL Symbol + + URI + + DNA, RNA + + IUPAC DNA, RNA + + SBOL_ENCODING_IUPAC + + http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html + + Protein + + IUPAC Protein + + SBOL_ENCODING_IUPAC_PROTEIN + + http://www.chem.qmul.ac.uk/iupac/AminoAcid/ + + Small Molecule + + SMILES + + SBOL_ENCODING_SMILES + + http://www.opensmiles.org/opensmiles.html + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/sequence.h +"; + +%feature("docstring") sbol::Sequence::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Sequence::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Sequence::assemble " +`assemble(composite_sequence=\"\") -> std::string` + +Calculates the complete sequence of a high-level Component from the sequence of +its subcomponents. + +Pior to assembling the the complete sequence, you must assemble a template +design by calling ComponentDefinition::assemble for the ComponentDefinition that +references this Sequence. + +Parameters +---------- +* `composite_sequence` : + Typically no value for the composite sequence should be specified by the + user. This parameter is used to hold the composite sequence as it is passed + to function calls at a higher-level of the recursion stack. +"; + +%feature("docstring") sbol::Sequence::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Sequence::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Sequence::synthesize " +`synthesize(clone_id) -> ComponentDefinition &` + +Parameters +---------- +* `clone_id` : + A URI for the build, or displayId if working in SBOLCompliant mode. +"; + +%feature("docstring") sbol::Sequence::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Sequence::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Sequence::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Sequence::~Sequence " +`~Sequence()` +"; + +%feature("docstring") sbol::Sequence::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Sequence::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Sequence::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Sequence::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Sequence::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Sequence::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Sequence::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Sequence::Sequence " +`Sequence(uri=\"example\", elements=\"\", encoding=SBOL_ENCODING_IUPAC, + version=VERSION_STRING)` + +Construct a Seqiemce. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `elements` : + A string representation of the primary structure of DNA, RNA, protein, or a + SMILES string for small molecules. +* `encoding` : + A URI that describes the representation format used for the elements + property. Set to SBOL_ENCODING_IUPAC by default +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string. +"; + +%feature("docstring") sbol::Sequence::Sequence " +`Sequence(type_uri, uri, elements, encoding, version)` + +Constructor used for defining extension classes. + +Parameters +---------- +* `type_uri` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::Sequence::compile " +`compile() -> std::string` + +Synonomous with Sequence::assemble. Calculates the complete sequence of a high- +level Component from the sequence of its subcomponents. Prior to assembling the +the complete sequence, you must assemble a template design by calling +ComponentDefinition::assemble for the ComponentDefinition that references this +Sequence. +"; + +%feature("docstring") sbol::Sequence::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Sequence::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Sequence::length " +`length() -> int` + +Returns +------- +The length of the primary sequence in the elements property +"; + +%feature("docstring") sbol::Sequence::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Sequence::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::Sequence::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Sequence::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::Sequence::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::Sequence::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::Sequence::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Sequence::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +// File: classsbol_1_1_sequence_annotation.xml + + +%feature("docstring") sbol::SequenceAnnotation " + +The SequenceAnnotation class describes one or more regions of interest on the +Sequence objects referred to by its parent ComponentDefinition. In addition, +SequenceAnnotation objects can describe the substructure of their parent +ComponentDefinition through association with the Component objects contained by +this ComponentDefinition. + +Attributes +---------- +* `component` : `ReferencedObject` + The component property is OPTIONAL and has a data type of URI. This URI MUST + refer to a Component that is contained by the same parent + ComponentDefinition that contains the SequenceAnnotation. In this way, the + properties of the SequenceAnnotation, such as its description and locations, + are associated with part of the substructure of its parent + ComponentDefinition. + +* `locations` : `OwnedObject< Location >` + The locations property is a REQUIRED set of one or more Location objects + that indicate which elements of a Sequence are described by the + SequenceAnnotation. + + Allowing multiple Location objects on a single SequenceAnnotation is + intended to enable representation of discontinuous regions (for example, a + Component encoded across a set of exons with interspersed introns). As such, + the Location objects of a single SequenceAnnotation SHOULD NOT specify + overlapping regions, since it is not clear what this would mean. There is no + such concern with different SequenceAnnotation objects, however, which can + freely overlap in Location (for example, specifying overlapping linkers for + sequence assembly). + +* `roles` : `URIProperty` + Alternatively to describing substructure, a SequenceAnnotation can be + utilized to identify a feature, such as a GenBank feature, of a specified + Sequence. + + In this use case, the SequenceAnnotation MUST NOT have a component property, + but instead it would have a roles property. The roles property comprises an + OPTIONAL set of zero or more URIs describing the specified sequence feature + being annotated. If provided, these role URIs MUST identify terms from + appropriate ontologies. Roles are not restricted to describing biological + function; they may annotate Sequences function in any domain for which an + ontology exists. It is RECOMMENDED that these role URIs identify terms that + are compatible with the type properties of this SequenceAnnotations parent + ComponentDefinition. For example, a role of a SequenceAnnotation which + belongs to a ComponentDefinition of type DNA might refer to terms from the + Sequence Ontology. See documentation for ComponentDefinition for a table of + recommended ontology terms. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/sequenceannotation.h +"; + +%feature("docstring") sbol::SequenceAnnotation::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SequenceAnnotation::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::SequenceAnnotation::length " +`length() -> int` + +The length of a SequenceAnnotation in base coordinates. +"; + +%feature("docstring") sbol::SequenceAnnotation::precedes " +`precedes(comparand) -> bool` + +Tests if the comparand SequenceAnnotation precedes this one according to base +coordinates. + +Parameters +---------- +* `comparand` : + Another SequenceAnnotation + +Returns +------- +true or false +"; + +%feature("docstring") sbol::SequenceAnnotation::precedes " +`precedes(comparand_list) -> std::vector< SequenceAnnotation * >` +"; + +%feature("docstring") sbol::SequenceAnnotation::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::SequenceAnnotation::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::SequenceAnnotation::follows " +`follows(comparand) -> bool` + +Tests if the comparand SequenceAnnotation follows this one according to base +coordinates. + +Parameters +---------- +* `comparand` : + Another SequenceAnnotation + +Returns +------- +true or false +"; + +%feature("docstring") sbol::SequenceAnnotation::follows " +`follows(comparand_list) -> std::vector< SequenceAnnotation * >` +"; + +%feature("docstring") sbol::SequenceAnnotation::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SequenceAnnotation::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SequenceAnnotation::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::SequenceAnnotation::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SequenceAnnotation::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::SequenceAnnotation::extract " +`extract(start_reference=1) -> ComponentDefinition &` + +Convert a SequenceAnnotation to a subcomponent. + +Returns +------- +A ComponentDefinition representing the subcomponent +"; + +%feature("docstring") sbol::SequenceAnnotation::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SequenceAnnotation::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SequenceAnnotation::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SequenceAnnotation::contains " +`contains(comparand) -> bool` + +Tests if the comparand SequenceAnnotation is contained within the same start and +end base coordinates as this one. + +This is mutually exclusive with overlaps. + +Parameters +---------- +* `comparand` : + Another SequenceAnnotation + +Returns +------- +true or false +"; + +%feature("docstring") sbol::SequenceAnnotation::contains " +`contains(comparand_list) -> std::vector< SequenceAnnotation * >` +"; + +%feature("docstring") sbol::SequenceAnnotation::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SequenceAnnotation::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SequenceAnnotation::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::SequenceAnnotation::overlaps " +`overlaps(comparand) -> bool` + +Tests if the comparand SequenceAnnotation overlaps with this one in the primary +sequence. + +Parameters +---------- +* `comparand` : + Another SequenceAnnotation + +Returns +------- +true or false +"; + +%feature("docstring") sbol::SequenceAnnotation::overlaps " +`overlaps(comparand_list) -> std::vector< SequenceAnnotation * >` +"; + +%feature("docstring") sbol::SequenceAnnotation::~SequenceAnnotation " +`~SequenceAnnotation()` +"; + +%feature("docstring") sbol::SequenceAnnotation::SequenceAnnotation " +`SequenceAnnotation(uri=\"example\", version=VERSION_STRING)` + +Construct a ComponentDefinition. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::SequenceAnnotation::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SequenceAnnotation::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SequenceAnnotation::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SequenceAnnotation::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SequenceAnnotation::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +// File: classsbol_1_1_sequence_constraint.xml + + +%feature("docstring") sbol::SequenceConstraint " + +The SequenceConstraint class can be used to assert restrictions on the relative, +sequence-based positions of pairs of Component objects contained by the same +parent ComponentDefinition. The primary purpose of this class is to enable the +specification of partially designed ComponentDefinition objects, for which the +precise positions or orientations of their contained Component objects are not +yet fully determined. + +Attributes +---------- +* `subject` : `ReferencedObject` + The subject property is REQUIRED and MUST contain a URI that refers to a + Component contained by the same parent ComponentDefinition that contains the + SequenceConstraint. + +* `object` : `ReferencedObject` + The object property is REQUIRED and MUST contain a URI that refers to a + Component contained by the same parent ComponentDefinition that contains the + SequenceConstraint. This Component MUST NOT be the same Component that the + SequenceConstraint refers to via its subject property. + +* `restriction` : `URIProperty` + The restriction property is REQUIRED and has a data type of URI. + + This property MUST indicate the type of structural restriction on the + relative, sequence-based positions or orientations of the subject and object + Component objects. The URI value of this property SHOULD come from the + RECOMMENDED URIs in the following table. + libSBOL Symbol + + Description + + SBOL_RESTRICTION_PRECEDES + + The position of the subject Component MUST precede that of the object + Component. + If each one is associated with a SequenceAnnotation, then the + SequenceAnnotation + associated with the subject Component MUST specify a region that starts + before + the region specified by the SequenceAnnotation associated with the object + Component. + + SBOL_RESTRICTION_SAME_ORIENTATION_AS + + The subject and object Component objects MUST have the same orientation. If + each + one is associated with a SequenceAnnotation, then the orientation URIs of + the Location objects of the first SequenceAnnotation MUST be among those of + the + second SequenceAnnotation, and vice versa. + + SBOL_RESTRICTION_OPPOSITE_ORIENTATION_AS + + The subject and object Component objects MUST have opposite orientations. If + each one is associated with a SequenceAnnotation, then the orientation URIs + of + the Location objects of one SequenceAnnotation MUST NOT be among those of + the + other SequenceAnnotation. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/sequenceconstraint.h +"; + +%feature("docstring") sbol::SequenceConstraint::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SequenceConstraint::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SequenceConstraint::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SequenceConstraint::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::SequenceConstraint::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SequenceConstraint::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SequenceConstraint::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SequenceConstraint::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SequenceConstraint::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SequenceConstraint::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SequenceConstraint::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SequenceConstraint::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::SequenceConstraint::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::SequenceConstraint::~SequenceConstraint " +`~SequenceConstraint()` +"; + +%feature("docstring") sbol::SequenceConstraint::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SequenceConstraint::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::SequenceConstraint::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::SequenceConstraint::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SequenceConstraint::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SequenceConstraint::SequenceConstraint " +`SequenceConstraint(uri=\"example\", subject=\"\", object=\"\", + restriction=SBOL_RESTRICTION_PRECEDES, version=VERSION_STRING)` + +Construct a SequenceConstraint. + +If operating in SBOL-compliant mode, use +ComponentDefinition::sequenceConstraints::create instead. + +Parameters +---------- +* `uri` : + If operating in open-world mode, this should be a full URI including a + scheme, namespace, and identifier. If SBOLCompliance configuration is + enabled, then this argument is simply the displayId for the new object and a + full URI will automatically be constructed. +* `subject` : + Identity of the Component with this structural constraint +* `object` : + Identity of the other Component with this structural constraint +* `restriction` : + Flag indicating the type of structual constraint between the subject and + object Components. By default, this is set to SBOL_RESTRICTION_PRECEDES +"; + +%feature("docstring") sbol::SequenceConstraint::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SequenceConstraint::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +// File: classsbol_1_1_small_molecule_activation_interaction.xml + + +%feature("docstring") sbol::SmallMoleculeActivationInteraction " + +Attributes +---------- +* `ligand` : `AliasedProperty< FunctionalComponent >` + +* `transcriptionFactor` : `AliasedProperty< FunctionalComponent >` + +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that describes the behavior + represented by an Interaction. + + The types property MUST contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the occurring entity + branch of the Systems Biology Ontology (SBO). (See + http://www.ebi.ac.uk/sbo/main/) The following table provides a list of + possible SBO terms for the types property and their corresponding URIs. + Type + + URI for SBO Term + + LibSBOL symbol + + Biochemical Reaction + + http://identifiers.org/biomodels.sbo/SBO:0000176 + + SBO_BIOCHEMICAL_REACTION + + Inhibition + + http://identifiers.org/biomodels.sbo/SBO:0000169 + + SBO_INHIBITION + + Stimulation + + http://identifiers.org/biomodels.sbo/SBO:0000170 + + SBO_STIMULATION + + Genetic Production + + http://identifiers.org/biomodels.sbo/SBO:0000589 + + SBO_GENETIC_PRODUCTION + + Non-Covalent Binding + + http://identifiers.org/biomodels.sbo/SBO:0000177 + + SBO_NONCOVALENT_BINDING + + Degradation + + http://identifiers.org/biomodels.sbo/SBO:0000179 + + SBO_DEGRADATION + + Control + + http://identifiers.org/biomodels.sbo/SBO:0000168 + + SBO_CONTROL + +* `participations` : `OwnedObject< Participation >` + The participations property is an OPTIONAL and MAY contain a set of + Participation objects, each of which identifies the roles that its + referenced FunctionalComponent plays in the Interaction. Even though an + Interaction generally contains at least one Participation, the case of zero + Participation objects is allowed because it is plausible that a designer + might want to specify that an Interaction will exist, even if its + participants have not yet been determined. + +* `functionalComponents` : `OwnedObject< FunctionalComponent >` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::SmallMoleculeActivationInteraction " +`SmallMoleculeActivationInteraction(uri, ligand, transcription_factor)` +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SmallMoleculeActivationInteraction::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +// File: classsbol_1_1_small_molecule_inhibition_interaction.xml + + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction " + +Attributes +---------- +* `ligand` : `AliasedProperty< FunctionalComponent >` + +* `transcriptionFactor` : `AliasedProperty< FunctionalComponent >` + +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that describes the behavior + represented by an Interaction. + + The types property MUST contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the occurring entity + branch of the Systems Biology Ontology (SBO). (See + http://www.ebi.ac.uk/sbo/main/) The following table provides a list of + possible SBO terms for the types property and their corresponding URIs. + Type + + URI for SBO Term + + LibSBOL symbol + + Biochemical Reaction + + http://identifiers.org/biomodels.sbo/SBO:0000176 + + SBO_BIOCHEMICAL_REACTION + + Inhibition + + http://identifiers.org/biomodels.sbo/SBO:0000169 + + SBO_INHIBITION + + Stimulation + + http://identifiers.org/biomodels.sbo/SBO:0000170 + + SBO_STIMULATION + + Genetic Production + + http://identifiers.org/biomodels.sbo/SBO:0000589 + + SBO_GENETIC_PRODUCTION + + Non-Covalent Binding + + http://identifiers.org/biomodels.sbo/SBO:0000177 + + SBO_NONCOVALENT_BINDING + + Degradation + + http://identifiers.org/biomodels.sbo/SBO:0000179 + + SBO_DEGRADATION + + Control + + http://identifiers.org/biomodels.sbo/SBO:0000168 + + SBO_CONTROL + +* `participations` : `OwnedObject< Participation >` + The participations property is an OPTIONAL and MAY contain a set of + Participation objects, each of which identifies the roles that its + referenced FunctionalComponent plays in the Interaction. Even though an + Interaction generally contains at least one Participation, the case of zero + Participation objects is allowed because it is plausible that a designer + might want to specify that an Interaction will exist, even if its + participants have not yet been determined. + +* `functionalComponents` : `OwnedObject< FunctionalComponent >` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::SmallMoleculeInhibitionInteraction " +`SmallMoleculeInhibitionInteraction(uri, ligand, transcription_factor)` +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::SmallMoleculeInhibitionInteraction::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +// File: classsbol_1_1_test.xml + + +%feature("docstring") sbol::Test " + +A Test is a container for experimental data. A Test is the product of the third +step of libSBOL's formalized Design-Build-Test-Analyze workflow. + +Attributes +---------- +* `samples` : `ReferencedObject` + References to Builds which were tested in the experiment. + +* `dataFiles` : `ReferencedObject` + References to file Attachments which contain experimental data sets. + +* `members` : `URIProperty` + The members property of a Collection is OPTIONAL and MAY contain a set of + URI references to zero or more TopLevel objects. + +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/dbtl.h +"; + +%feature("docstring") sbol::Test::find_property " +`find_property(uri) -> SBOLObject *` + +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 +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise +"; + +%feature("docstring") sbol::Test::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value +"; + +%feature("docstring") sbol::Test::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Test::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `Usually` : + the same type of SBOL object as this +"; + +%feature("docstring") sbol::Test::cast " +`cast() -> SBOLClass &` +"; + +%feature("docstring") sbol::Test::getProperties " +`getProperties() -> std::vector< std::string >` + +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 +"; + +%feature("docstring") sbol::Test::addToDocument " +`addToDocument(arg1)` +"; + +%feature("docstring") sbol::Test::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Test::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Test::initialize " +`initialize(uri)` +"; + +%feature("docstring") sbol::Test::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Test::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Test::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` + +Recursively copies an object. + +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). + +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied + +Parameters +---------- +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version + +Returns +------- +The copied object. +"; + +%feature("docstring") sbol::Test::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Test::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type +"; + +%feature("docstring") sbol::Test::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +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 +"; + +%feature("docstring") sbol::Test::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Test::~Test " +`~Test()` +"; + +%feature("docstring") sbol::Test::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Test::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. + +Parameters +---------- +* `property_uri` : + The URI for the property + +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; + +%feature("docstring") sbol::Test::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Test::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Test::Test " +`Test(uri=\"example\", version=VERSION_STRING)` + +Construct a new Test object. + +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `version` : + An arbitrary version string. If SBOLCompliance is enabled, this should be a + Maven version string of the form \"major.minor.patch\". +"; + +%feature("docstring") sbol::Test::find " +`find(uri) -> SBOLObject *` + +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` + +Parameters +---------- +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Design &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Build &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Test &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri) -> Analysis &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::Test::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; + +%feature("docstring") sbol::Test::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::Test::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +// File: classsbol_1_1_text_property.xml + + +%feature("docstring") sbol::TextProperty " + +TextProperty objects are used to contain string literals. + +They can be used as member objects inside custom SBOL Extension classes. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/properties.h +"; + +%feature("docstring") sbol::TextProperty::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. + +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; + +%feature("docstring") sbol::TextProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::TextProperty::set " +`set(new_value)` +"; + +%feature("docstring") sbol::TextProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::TextProperty::get " +`get() -> std::string` + +Basic getter for all SBOL literal properties. + +Returns +------- +A string literal +"; + +%feature("docstring") sbol::TextProperty::getTypeURI " +`getTypeURI() -> rdf_type` +"; + +%feature("docstring") sbol::TextProperty::clear " +`clear()` + +Clear all property values. +"; + +%feature("docstring") sbol::TextProperty::getAll " +`getAll() -> std::vector< std::string >` +"; + +%feature("docstring") sbol::TextProperty::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::TextProperty::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::TextProperty::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::TextProperty::add " +`add(new_value)` + +Appends the new value to a list of values, for properties that allow it. + +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; + +%feature("docstring") sbol::TextProperty::size " +`size() -> int` +"; + +%feature("docstring") sbol::TextProperty::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::TextProperty::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; + +%feature("docstring") sbol::TextProperty::remove " +`remove(index=0)` + +Remove a property value. +"; + +%feature("docstring") sbol::TextProperty::write " +`write()` +"; + +%feature("docstring") sbol::TextProperty::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::TextProperty::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + +%feature("docstring") sbol::TextProperty::validate " +`validate(arg=NULL)` +"; + +%feature("docstring") sbol::TextProperty::TextProperty " +`TextProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules, initial_value)` + +Initialize the TextProperty with a value. + +Validation rules are checked upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::TextProperty::TextProperty " +`TextProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules)` + +Initialize a TextProperty without a value. + +No validation rules are run upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; + +%feature("docstring") sbol::TextProperty::TextProperty " +`TextProperty(property_owner, type_uri, lower_bound, upper_bound, + initial_value)` +"; + +%feature("docstring") sbol::TextProperty::TextProperty " +`TextProperty(property_owner, type_uri, lower_bound, upper_bound)` +"; + +%feature("docstring") sbol::TextProperty::getUpperBound " +`getUpperBound() -> char` +"; + +// File: classsbol_1_1_top_level.xml + + +%feature("docstring") sbol::TopLevel " + +All SBOL classes derived from TopLevel appear as top level nodes in the RDF/XML +document tree and SBOL files. An abstract class. + +Attributes +---------- +* `attachments` : `ReferencedObject` + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/toplevel.h +"; + +%feature("docstring") sbol::TopLevel::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::TopLevel::compare " +`compare(comparand) -> int` + +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. + +Parameters +---------- +* `comparand` : + A pointer to the object being compared to this one. + +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::TopLevel::find " +`find(uri) -> SBOLObject *` + +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 ------- -1 if the objects are identical, 0 if they are different +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::Participation::getClassName " +%feature("docstring") sbol::TopLevel::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` + +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 Returns ------- -Parses a local class name from the RDF-type of this SBOL Object +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::Participation::getPropertyValue " +%feature("docstring") sbol::TopLevel::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` Get the value of a custom annotation property by its URI. @@ -2909,174 +20089,214 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Participation::getTypeURI " +%feature("docstring") sbol::TopLevel::getProperties " +`getProperties() -> std::vector< std::string >` + +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 ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::Participation::find_property " - -Search this object recursively to see if it contains a member property with the -given RDF type. +%feature("docstring") sbol::TopLevel::setAnnotation " +`setAnnotation(property_uri, val)` -Parameters ----------- -* `uri` : - The RDF type of the property to search for. +Set the value for a user-defined annotation property. -Returns -------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::Participation::copy " +%feature("docstring") sbol::TopLevel::TopLevel " +`TopLevel(type_uri=SBOL_TOP_LEVEL, uri=\"example\", version=VERSION_STRING)` "; -// File: classsbol_1_1_property.xml +%feature("docstring") sbol::TopLevel::getClassName " +`getClassName(type) -> std::string` +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; -%feature("docstring") sbol::Property " +%feature("docstring") sbol::TopLevel::close " +`close()` -Member properties of all SBOL objects are defined using a Property object. +Use this method to destroy an SBOL object that is not contained by a parent +Document. -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. +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; -templateparam -------------- -* `The` : - SBOL specification currently supports string, URI, and integer literal - values. +%feature("docstring") sbol::TopLevel::~TopLevel " +`~TopLevel()` "; -%feature("docstring") sbol::Property::clear " +%feature("docstring") sbol::TopLevel::setPropertyValue " +`setPropertyValue(property_uri, val)` -Remove all children objects from the parent and destroy them. +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value "; -%feature("docstring") sbol::Property::getAll " +%feature("docstring") sbol::TopLevel::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` -Retrieve a vector of objects from the Property. +Get all values of a custom annotation property by its URI. -"; +Parameters +---------- +* `property_uri` : + The URI for the property -%feature("docstring") sbol::Property::remove " +Returns +------- +A vector of property values or SBOL_ERROR_NOT_FOUND +"; -Remove a Property from the list of objects and destroy it. +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> SBOLClass &` Parameters ---------- * `uri` : - The identity of the object to be destroyed. This can be a displayId of the - object or a full URI may be provided. -* `index` : - A numerical index for the object. + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::Property::Property " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages={}) -> SBOLClass &` Parameters ---------- -* `type_uri` : - An RDF hash URI for this property, consisting of a namespace followed by an - identifier. For example, Properties of SBOLObjects use URIs of the form - http://sbols.org/v2#somePropertyName, where the identifier somePropertyName - determines the appearance of XML nodes in an SBOL file. Alternatively, - annotations in a custom namespace can be provided using a similarly formed - hash URI in another namespace. -* `property_owner` : - All Property objects must have a pointer back to its parent SBOLObject of - which it is a member -* `initial_value` : - The initial value of the Property -* `validation_rules` : - A vector of externally defined ValidationRules. The vector contains pointers - to functions which correspond to the validation rules listed in the appendix - of the formal SBOL specification document. ValidationRules are automatically - checked every time a setter or adder method is called and when Documents are - read and written. +* `uri` : + A URI for the new object, or a displayId if operating in SBOLCompliant mode + +templateparam +------------- +* `The` : + type of SBOL object to generate "; -%feature("docstring") sbol::Property::write " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Design &` "; -%feature("docstring") sbol::Property::add " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Design &` +"; -Appends the new value to a list of values, for properties that allow it. +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Build &` +"; -Parameters ----------- -* `new_value` : - A new string which will be added to a list of values. +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Build &` "; -%feature("docstring") sbol::Property::getTypeURI " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Test &` +"; -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Test &` "; -%feature("docstring") sbol::Property::set " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Analysis &` +"; -Basic setter for SBOL Property. +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; -Parameters ----------- -* `new_value` : - A new integer value for the property, which is converted to a raw string - during serialization. +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Design &` "; -%feature("docstring") sbol::Property::getOwner " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Design &` "; -%feature("docstring") sbol::Property::validate " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Build &` "; -// File: classsbol_1_1_range.xml +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Build &` +"; +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Test &` +"; -%feature("docstring") sbol::Range " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Test &` +"; -A Range object specifies a region via discrete, inclusive start and end -positions that correspond to indices for characters in the elements String of a -Sequence. Note that the index of the first location is 1, as is typical practice -in biology, rather than 0, as is typical practice in computer science. +%feature("docstring") sbol::TopLevel::generate " +`generate(uri) -> Analysis &` "; -%feature("docstring") sbol::Range::find " +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> Analysis &` +"; + +%feature("docstring") sbol::TopLevel::generate " +`generate(uri, agent, plan, usages) -> SBOLClass &` +"; -Search this object recursively to see if an object with the URI already exists. +%feature("docstring") sbol::TopLevel::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::TopLevel::simpleCopy " +`simpleCopy(uri) -> SBOLClass &` + +Copies an object. + +No child objects are copied. Parameters ---------- * `uri` : - The URI to search for. + A URI for the new object, or a displayId if operating in SBOLCompliant mode -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +templateparam +------------- +* `Usually` : + the same type of SBOL object as this "; -%feature("docstring") sbol::Range::getProperties " +%feature("docstring") sbol::TopLevel::addPropertyValue " +`addPropertyValue(property_uri, val)` -Gets URIs for all properties contained by this object. +Append a value to a user-defined annotation property. -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +Either a literal or URI value +"; -Returns -------- -A vector of URIs that identify the properties contained in this object +%feature("docstring") sbol::TopLevel::addToDocument " +`addToDocument(arg1)` "; -%feature("docstring") sbol::Range::getPropertyValues " +%feature("docstring") sbol::TopLevel::getAnnotation " +`getAnnotation(property_uri) -> std::string` -Get all values of a custom annotation property by its URI. +Get the value of a custom annotation property by its URI. + +Synonymous with getPropertyValue Parameters ---------- @@ -3085,225 +20305,367 @@ Parameters Returns ------- -A vector of property values or SBOL_ERROR_NOT_FOUND +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Range::compare " - -Compare two SBOL objects or Documents. - -The behavior is currently undefined for objects with custom annotations or -extension classes. +%feature("docstring") sbol::TopLevel::initialize " +`initialize(uri)` +"; -Parameters ----------- -* `comparand` : - A pointer to the object being compared to this one. +%feature("docstring") sbol::TopLevel::update_uri " +`update_uri()` +"; -Returns -------- -1 if the objects are identical, 0 if they are different +%feature("docstring") sbol::TopLevel::apply " +`apply(callback_fn, user_data)` "; -%feature("docstring") sbol::Range::getClassName " +%feature("docstring") sbol::TopLevel::copy " +`copy(target_doc=NULL, ns=\"\", version=\"\") -> SBOLClass &` -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object -"; +Recursively copies an object. -%feature("docstring") sbol::Range::getPropertyValue " +Use this to copy an object to a new document, a new namespace, or to increment +its version recursively. An object be recursively copied into a new document and +a new namespace, assuming compliant URIs. If the optional version argument is +specified, it will be used instead of incrementing the copied object's version +(this can be used when using a custom versioning scheme other than libSBOL's +default). -Get the value of a custom annotation property by its URI. +templateparam +------------- +* `SBOLClass` : + The type of SBOL object being copied Parameters ---------- -* `property_uri` : - The URI for the property +* `new_doc` : + The new copies will be attached to this Document. NULL by default. +* `ns` : + This namespace will be substituted for the current namespace (as configured + by setHomespace) in all SBOL-compliant URIs. +* `version` : + A new version Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +The copied object. "; -%feature("docstring") sbol::Range::getTypeURI " - -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::TopLevel::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` "; -%feature("docstring") sbol::Range::Range " +%feature("docstring") sbol::TopLevel::cast " +`cast() -> SBOLClass &` +"; -Construct a Range. +%feature("docstring") sbol::TopLevel::find_property " +`find_property(uri) -> SBOLObject *` -If operating in SBOL-compliant mode, use SequenceAnnotation.locations.create instead. +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- * `uri` : - If operating in open-world mode, this should be a full URI including a - scheme, namespace, and identifier. If SBOLCompliance configuration is - enabled, then this argument is simply the displayId for the new object and a - full URI will automatically be constructed. -* `start` : - An integer of 1 or greater -* `end` : - An integer equal to or greater than the start + The RDF type of the property to search for. + +Returns +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -%feature("docstring") sbol::Range::find_property " +%feature("docstring") sbol::TopLevel::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` Search this object recursively to see if it contains a member property with the -given RDF type. +given RDF type and indicated property value. Parameters ---------- * `uri` : - The RDF type of the property to search for. + A URI, either an ontology term or an object reference, to search for Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::Range::copy " -"; +// File: classsbol_1_1_transcriptional_activation_interaction.xml + + +%feature("docstring") sbol::TranscriptionalActivationInteraction " + +Attributes +---------- +* `activator` : `AliasedProperty< FunctionalComponent >` + +* `targetPromoter` : `AliasedProperty< FunctionalComponent >` + +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that describes the behavior + represented by an Interaction. + + The types property MUST contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the occurring entity + branch of the Systems Biology Ontology (SBO). (See + http://www.ebi.ac.uk/sbo/main/) The following table provides a list of + possible SBO terms for the types property and their corresponding URIs. + Type + + URI for SBO Term + + LibSBOL symbol + + Biochemical Reaction + + http://identifiers.org/biomodels.sbo/SBO:0000176 + + SBO_BIOCHEMICAL_REACTION + + Inhibition + + http://identifiers.org/biomodels.sbo/SBO:0000169 + + SBO_INHIBITION + + Stimulation + + http://identifiers.org/biomodels.sbo/SBO:0000170 + + SBO_STIMULATION + + Genetic Production + + http://identifiers.org/biomodels.sbo/SBO:0000589 + + SBO_GENETIC_PRODUCTION + + Non-Covalent Binding + + http://identifiers.org/biomodels.sbo/SBO:0000177 + + SBO_NONCOVALENT_BINDING + + Degradation + + http://identifiers.org/biomodels.sbo/SBO:0000179 -// File: classsbol_1_1_referenced_object.xml + SBO_DEGRADATION + Control -%feature("docstring") sbol::ReferencedObject " + http://identifiers.org/biomodels.sbo/SBO:0000168 -A reference to another SBOL object Contains a Uniform Resource Identifier (URI) -that refers to an an associated object. + SBO_CONTROL -The object it points to may be another resource in this Document or an external -reference, for example to an object in an external repository. In the SBOL -specification, association by reference is indicated in class diagrams by arrows -with open (white) diamonds. -"; +* `participations` : `OwnedObject< Participation >` + The participations property is an OPTIONAL and MAY contain a set of + Participation objects, each of which identifies the roles that its + referenced FunctionalComponent plays in the Interaction. Even though an + Interaction generally contains at least one Participation, the case of zero + Participation objects is allowed because it is plausible that a designer + might want to specify that an Interaction will exist, even if its + participants have not yet been determined. -%feature("docstring") sbol::ReferencedObject::create " +* `functionalComponents` : `OwnedObject< FunctionalComponent >` -Creates another SBOL object derived from TopLevel and adds it to the Document. +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. -Parameters ----------- -* `uri` : - In \"open world\" mode, this is a full URI and the same as the returned URI. - If the default namespace for libSBOL has been configured, then this argument - should simply be a local identifier. If SBOL-compliance is enabled, this - argument should be the intended displayId of the new object. A full URI is - automatically generated and returned. +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. -Returns -------- -The full URI of the created object. -"; +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. -%feature("docstring") sbol::ReferencedObject::validate " -"; +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. -%feature("docstring") sbol::ReferencedObject::write " -"; +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. -%feature("docstring") sbol::ReferencedObject::get " +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. -Basic getter for all SBOL literal properties. +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. -Returns -------- -A string of characters used to identify a resource +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. "; -%feature("docstring") sbol::ReferencedObject::getOwner " -"; +%feature("docstring") sbol::TranscriptionalActivationInteraction::close " +`close()` -%feature("docstring") sbol::ReferencedObject::set " +Use this method to destroy an SBOL object that is not contained by a parent +Document. -Basic setter for SBOL ReferencedObject. +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::TranscriptionalActivationInteraction::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. Parameters ---------- -* `new_value` : - A new integer value for the property, which is converted to a raw string - during serialization. +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::ReferencedObject::remove " +%feature("docstring") sbol::TranscriptionalActivationInteraction::generate " +`generate() -> SBOLClass &` +"; + +%feature("docstring") sbol::TranscriptionalActivationInteraction::find_property " +`find_property(uri) -> SBOLObject *` -Remove a ReferencedObject from the list of objects and destroy it. +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- * `uri` : - The identity of the object to be destroyed. This can be a displayId of the - object or a full URI may be provided. -* `index` : - A numerical index for the object. -"; + The RDF type of the property to search for. -%feature("docstring") sbol::ReferencedObject::addReference " +Returns +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -%feature("docstring") sbol::ReferencedObject::add " +%feature("docstring") sbol::TranscriptionalActivationInteraction::compare " +`compare(comparand) -> int` -Appends the new value to a list of values, for properties that allow it. +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. Parameters ---------- -* `new_value` : - A new string which will be added to a list of values. -"; - -%feature("docstring") sbol::ReferencedObject::setReference " -"; - -%feature("docstring") sbol::ReferencedObject::getTypeURI " +* `comparand` : + A pointer to the object being compared to this one. Returns ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::ReferencedObject::clear " +%feature("docstring") sbol::TranscriptionalActivationInteraction::setAnnotation " +`setAnnotation(property_uri, val)` -Remove all children objects from the parent and destroy them. +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; -%feature("docstring") sbol::ReferencedObject::ReferencedObject " +%feature("docstring") sbol::TranscriptionalActivationInteraction::cast " +`cast() -> SBOLClass &` "; -%feature("docstring") sbol::ReferencedObject::getAll " +%feature("docstring") sbol::TranscriptionalActivationInteraction::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; -Retrieve a vector of objects from the ReferencedObject. +%feature("docstring") sbol::TranscriptionalActivationInteraction::find " +`find(uri) -> SBOLObject *` +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 +------- +A pointer to theobject with this URI if it exists, NULL otherwise "; -// File: classsbol_1_1_s_b_o_l_error.xml +%feature("docstring") sbol::TranscriptionalActivationInteraction::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. -%feature("docstring") sbol::SBOLError " -"; +Parameters +---------- +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match -%feature("docstring") sbol::SBOLError::what " +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::SBOLError::SBOLError " +%feature("docstring") sbol::TranscriptionalActivationInteraction::apply " +`apply(callback_fn, user_data)` "; -// File: classsbol_1_1_s_b_o_l_object.xml - +%feature("docstring") sbol::TranscriptionalActivationInteraction::addPropertyValue " +`addPropertyValue(property_uri, val)` -%feature("docstring") sbol::SBOLObject " +Append a value to a user-defined annotation property. -An SBOLObject converts a class data structure into an RDF triple store and -contains methods for serializing and parsing RDF triples. +Either a literal or URI value "; -%feature("docstring") sbol::SBOLObject::getProperties " +%feature("docstring") sbol::TranscriptionalActivationInteraction::getProperties " +`getProperties() -> std::vector< std::string >` Gets URIs for all properties contained by this object. @@ -3315,23 +20677,36 @@ Returns A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::SBOLObject::find_property " +%feature("docstring") sbol::TranscriptionalActivationInteraction::getClassName " +`getClassName(type) -> std::string` + +Returns +------- +Parses a local class name from the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::TranscriptionalActivationInteraction::TranscriptionalActivationInteraction " +`TranscriptionalActivationInteraction(uri, activator, target_promoter)` +"; + +%feature("docstring") sbol::TranscriptionalActivationInteraction::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` Search this object recursively to see if it contains a member property with the -given RDF type. +given RDF type and indicated property value. Parameters ---------- * `uri` : - The RDF type of the property to search for. + A URI, either an ontology term or an object reference, to search for Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::SBOLObject::getPropertyValues " +%feature("docstring") sbol::TranscriptionalActivationInteraction::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` Get all values of a custom annotation property by its URI. @@ -3345,30 +20720,13 @@ Returns A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::SBOLObject::SBOLObject " -"; - -%feature("docstring") sbol::SBOLObject::compare " - -Compare two SBOL objects or Documents. - -The behavior is currently undefined for objects with custom annotations or -extension classes. - -Parameters ----------- -* `comparand` : - A pointer to the object being compared to this one. - -Returns -------- -1 if the objects are identical, 0 if they are different -"; - -%feature("docstring") sbol::SBOLObject::getPropertyValue " +%feature("docstring") sbol::TranscriptionalActivationInteraction::getAnnotation " +`getAnnotation(property_uri) -> std::string` Get the value of a custom annotation property by its URI. +Synonymous with getPropertyValue + Parameters ---------- * `property_uri` : @@ -3379,187 +20737,235 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::SBOLObject::getTypeURI " +%feature("docstring") sbol::TranscriptionalActivationInteraction::getTypeURI " +`getTypeURI() -> rdf_type` Returns ------- The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::SBOLObject::getClassName " +%feature("docstring") sbol::TranscriptionalActivationInteraction::setPropertyValue " +`setPropertyValue(property_uri, val)` -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value "; -%feature("docstring") sbol::SBOLObject::find " +%feature("docstring") sbol::TranscriptionalActivationInteraction::update_uri " +`update_uri()` +"; -Search this object recursively to see if an object with the URI already exists. +// File: classsbol_1_1_transcriptional_repression_interaction.xml -Parameters + +%feature("docstring") sbol::TranscriptionalRepressionInteraction " + +Attributes ---------- -* `uri` : - The URI to search for. +* `repressor` : `AliasedProperty< FunctionalComponent >` -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise -"; +* `targetPromoter` : `AliasedProperty< FunctionalComponent >` -// File: classsbol_1_1_sequence.xml +* `types` : `URIProperty` + The types property is a REQUIRED set of URIs that describes the behavior + represented by an Interaction. + The types property MUST contain one or more URIs that MUST identify terms + from appropriate ontologies. It is RECOMMENDED that at least one of the URIs + contained by the types property refer to a term from the occurring entity + branch of the Systems Biology Ontology (SBO). (See + http://www.ebi.ac.uk/sbo/main/) The following table provides a list of + possible SBO terms for the types property and their corresponding URIs. + Type -%feature("docstring") sbol::Sequence " + URI for SBO Term -The primary structure (eg, nucleotide or amino acid sequence) of a -ComponentDefinition object. -"; + LibSBOL symbol -%feature("docstring") sbol::Sequence::find " + Biochemical Reaction -Search this object recursively to see if an object with the URI already exists. + http://identifiers.org/biomodels.sbo/SBO:0000176 -Parameters ----------- -* `uri` : - The URI to search for. + SBO_BIOCHEMICAL_REACTION -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise -"; + Inhibition -%feature("docstring") sbol::Sequence::find_property " + http://identifiers.org/biomodels.sbo/SBO:0000169 -Search this object recursively to see if it contains a member property with the -given RDF type. + SBO_INHIBITION -Parameters ----------- -* `uri` : - The RDF type of the property to search for. + Stimulation -Returns -------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise -"; + http://identifiers.org/biomodels.sbo/SBO:0000170 -%feature("docstring") sbol::Sequence::Sequence " + SBO_STIMULATION -Construct a ComponentDefinition. + Genetic Production -Parameters ----------- -* `uri` : - A full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `elements` : - A string representation of the primary structure of DNA, RNA, protein, or a - SMILES string for small molecules. -* `encoding` : - A URI that describes the representation format used for the elements - property. Set to SBOL_ENCODING_IUPAC by default -* `version` : - An arbitrary version string. If SBOLCompliance is enabled, this should be a - Maven version string. -"; + http://identifiers.org/biomodels.sbo/SBO:0000589 -%feature("docstring") sbol::Sequence::copy " + SBO_GENETIC_PRODUCTION -Copy an object and automatically increment its version. + Non-Covalent Binding -If the optional version argument is specified, it will be used instead of -incrementing the copied object's version. An object may also be copied into a -new document and a new namespace, assuming compliant URIs. + http://identifiers.org/biomodels.sbo/SBO:0000177 -templateparam -------------- -* `SBOLClass` : - The type of SBOL object being copied + SBO_NONCOVALENT_BINDING -Parameters ----------- -* `new_doc` : - The new copies will be attached to this Document. NULL by default. -* `ns` : - This namespace will be substituted for the current namespace (as configured - by setHomespace) in all SBOL-compliat URIs. -* `version` : - A new version + Degradation -Returns -------- -The full URI of the created object. -"; + http://identifiers.org/biomodels.sbo/SBO:0000179 -%feature("docstring") sbol::Sequence::addToDocument " + SBO_DEGRADATION -Add the Sequence object to Document + Control -"; + http://identifiers.org/biomodels.sbo/SBO:0000168 -%feature("docstring") sbol::Sequence::assemble " + SBO_CONTROL -Calculates the complete sequence of a high-level Component from the sequence of -its subcomponents. +* `participations` : `OwnedObject< Participation >` + The participations property is an OPTIONAL and MAY contain a set of + Participation objects, each of which identifies the roles that its + referenced FunctionalComponent plays in the Interaction. Even though an + Interaction generally contains at least one Participation, the case of zero + Participation objects is allowed because it is plausible that a designer + might want to specify that an Interaction will exist, even if its + participants have not yet been determined. -{rior to assembling the the complete sequence, you must assemble a template -design by calling ComponentDefinition::assemble for the ComponentDefinition that -references this Sequence. +* `functionalComponents` : `OwnedObject< FunctionalComponent >` -Parameters ----------- -* `composite_sequence` : - Typically no value for the composite sequence should be specified by the - user. This parameter is used to hold the composite sequence as it is passed - to function calls at a higher-level of the recursion stack. +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. "; -%feature("docstring") sbol::Sequence::getPropertyValues " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::find_property " +`find_property(uri) -> SBOLObject *` -Get all values of a custom annotation property by its URI. +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + The RDF type of the property to search for. Returns ------- -A vector of property values or SBOL_ERROR_NOT_FOUND +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -%feature("docstring") sbol::Sequence::getTypeURI " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::TranscriptionalRepressionInteraction " +`TranscriptionalRepressionInteraction(uri, repressor, target_promoter)` +"; + +%feature("docstring") sbol::TranscriptionalRepressionInteraction::find " +`find(uri) -> SBOLObject *` + +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 uniform resource identifier that describes the RDF-type of this SBOL Object +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::Sequence::compare " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::cast " +`cast() -> SBOLClass &` +"; -Compare two SBOL objects or Documents. +%feature("docstring") sbol::TranscriptionalRepressionInteraction::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -The behavior is currently undefined for objects with custom annotations or -extension classes. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + The RDF type of the property to search for. +* `value` : + The property value to match Returns ------- -1 if the objects are identical, 0 if they are different +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::Sequence::getPropertyValue " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::getAnnotation " +`getAnnotation(property_uri) -> std::string` Get the value of a custom annotation property by its URI. +Synonymous with getPropertyValue + Parameters ---------- * `property_uri` : @@ -3570,14 +20976,27 @@ Returns The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::Sequence::getClassName " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::close " +`close()` + +Use this method to destroy an SBOL object that is not contained by a parent +Document. + +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; + +%feature("docstring") sbol::TranscriptionalRepressionInteraction::getClassName " +`getClassName(type) -> std::string` Returns ------- Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::Sequence::getProperties " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::getProperties " +`getProperties() -> std::vector< std::string >` Gets URIs for all properties contained by this object. @@ -3589,21 +21008,14 @@ Returns A vector of URIs that identify the properties contained in this object "; -// File: classsbol_1_1_sequence_annotation.xml - - -%feature("docstring") sbol::SequenceAnnotation " - -The SequenceAnnotation class describes one or more regions of interest on the -Sequence objects referred to by its parent ComponentDefinition. In addition, -SequenceAnnotation objects can describe the substructure of their parent -ComponentDefinition through association with the Component objects contained by -this ComponentDefinition. +%feature("docstring") sbol::TranscriptionalRepressionInteraction::apply " +`apply(callback_fn, user_data)` "; -%feature("docstring") sbol::SequenceAnnotation::getPropertyValues " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Get all values of a custom annotation property by its URI. +Get the value of a custom annotation property by its URI. Parameters ---------- @@ -3612,34 +21024,58 @@ Parameters Returns ------- -A vector of property values or SBOL_ERROR_NOT_FOUND +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::SequenceAnnotation::SequenceAnnotation " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::getTypeURI " +`getTypeURI() -> rdf_type` -Construct a ComponentDefinition. +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::TranscriptionalRepressionInteraction::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::TranscriptionalRepressionInteraction::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- * `uri` : - A full URI including a scheme, namespace, and identifier. If SBOLCompliance - configuration is enabled, then this argument is simply the displayId for the - new object and a full URI will automatically be constructed. -* `version` : - An arbitrary version string. If SBOLCompliance is enabled, this should be a - Maven version string of the form \"major.minor.patch\". -"; - -%feature("docstring") sbol::SequenceAnnotation::getClassName " + A URI, either an ontology term or an object reference, to search for Returns ------- -Parses a local class name from the RDF-type of this SBOL Object +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::SequenceAnnotation::getPropertyValue " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::setAnnotation " +`setAnnotation(property_uri, val)` -Get the value of a custom annotation property by its URI. +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::TranscriptionalRepressionInteraction::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::TranscriptionalRepressionInteraction::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` + +Get all values of a custom annotation property by its URI. Parameters ---------- @@ -3648,26 +21084,27 @@ Parameters Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::SequenceAnnotation::find_property " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::generate " +`generate() -> SBOLClass &` +"; -Search this object recursively to see if it contains a member property with the -given RDF type. +%feature("docstring") sbol::TranscriptionalRepressionInteraction::addPropertyValue " +`addPropertyValue(property_uri, val)` -Parameters ----------- -* `uri` : - The RDF type of the property to search for. +Append a value to a user-defined annotation property. -Returns -------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +Either a literal or URI value "; -%feature("docstring") sbol::SequenceAnnotation::compare " +%feature("docstring") sbol::TranscriptionalRepressionInteraction::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::TranscriptionalRepressionInteraction::compare " +`compare(comparand) -> int` Compare two SBOL objects or Documents. @@ -3684,103 +21121,321 @@ Returns 1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::SequenceAnnotation::getTypeURI " +// File: classsbol_1_1_u_r_i_property.xml -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object + +%feature("docstring") sbol::URIProperty " + +A URIProperty may contain a restricted type of string that conforms to the +specification for a Uniform Resource Identifier (URI), typically consisting of a +namespace authority followed by an identifier. + +A URIProperty often contains a reference to an SBOL object or may contain an +ontology term. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/properties.h "; -%feature("docstring") sbol::SequenceAnnotation::find " +%feature("docstring") sbol::URIProperty::write " +`write()` +"; + +%feature("docstring") sbol::URIProperty::URIProperty " +`URIProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules, initial_value)` + +Initialize the property with a value that is passed through a constructor for +the parent SBOLObject. -Search this object recursively to see if an object with the URI already exists. +Validation rules are checked upon initialization. Parameters ---------- -* `uri` : - The URI to search for. +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions +"; -Returns -------- -A pointer to theobject with this URI if it exists, NULL otherwise +%feature("docstring") sbol::URIProperty::URIProperty " +`URIProperty(property_owner, type_uri, lower_bound, upper_bound, + validation_rules)` + +Initialize a Property without a value. + +No validation rules are run upon initialization. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property +* `validation_rules` : + A vector of pointers to the validation functions "; -%feature("docstring") sbol::SequenceAnnotation::copy " +%feature("docstring") sbol::URIProperty::URIProperty " +`URIProperty(property_owner, type_uri, lower_bound, upper_bound, initial_value)` "; -%feature("docstring") sbol::SequenceAnnotation::getProperties " +%feature("docstring") sbol::URIProperty::URIProperty " +`URIProperty(property_owner, type_uri, lower_bound, upper_bound)` +"; -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::URIProperty::getAll " +`getAll() -> std::vector< std::string >` +"; -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +%feature("docstring") sbol::URIProperty::get " +`get() -> std::string` + +Get first URI. Returns ------- -A vector of URIs that identify the properties contained in this object +A string of characters used to identify a resource "; -// File: classsbol_1_1_sequence_constraint.xml +%feature("docstring") sbol::URIProperty::getLowerBound " +`getLowerBound() -> char` +"; +%feature("docstring") sbol::URIProperty::getUpperBound " +`getUpperBound() -> char` +"; -%feature("docstring") sbol::SequenceConstraint " +%feature("docstring") sbol::URIProperty::size " +`size() -> int` +"; -The SequenceConstraint class can be used to assert restrictions on the relative, -sequence-based positions of pairs of Component objects contained by the same -parent ComponentDefinition. The primary purpose of this class is to enable the -specification of partially designed ComponentDefinition objects, for which the -precise positions or orientations of their contained Component objects are not -yet fully determined. +%feature("docstring") sbol::URIProperty::getTypeURI " +`getTypeURI() -> rdf_type` "; -%feature("docstring") sbol::SequenceConstraint::SequenceConstraint " +%feature("docstring") sbol::URIProperty::copy " +`copy(target_property)` -Construct a SequenceConstraint. +Copy property values to a target object's property fields. +"; -If operating in SBOL-compliant mode, use -ComponentDefinition::sequenceConstraints::create instead. +%feature("docstring") sbol::URIProperty::remove " +`remove(index=0)` + +Remove a property value. +"; + +%feature("docstring") sbol::URIProperty::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::URIProperty::end " +`end() -> iterator` +"; + +%feature("docstring") sbol::URIProperty::validate " +`validate(arg=NULL)` +"; + +%feature("docstring") sbol::URIProperty::begin " +`begin() -> iterator` +"; + +%feature("docstring") sbol::URIProperty::getOwner " +`getOwner() -> SBOLObject &` +"; + +%feature("docstring") sbol::URIProperty::clear " +`clear()` + +Clear all property values. +"; + +%feature("docstring") sbol::URIProperty::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. Parameters ---------- -* `uri` : - If operating in open-world mode, this should be a full URI including a - scheme, namespace, and identifier. If SBOLCompliance configuration is - enabled, then this argument is simply the displayId for the new object and a - full URI will automatically be constructed. -* `subject` : - Identity of the Component with this structural constraint -* `object` : - Identity of the other Component with this structural constraint -* `restriction` : - Flag indicating the type of structual constraint between the subject and - object Components. By default, this is set to SBOL_RESTRICTION_PRECEDES +* `new_value` : + A new string value for the Property. "; -%feature("docstring") sbol::SequenceConstraint::getPropertyValue " +%feature("docstring") sbol::URIProperty::set " +`set(new_value)` -Get the value of a custom annotation property by its URI. +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. Parameters ---------- -* `property_uri` : - The URI for the property +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; -Returns -------- -The value of the property or SBOL_ERROR_NOT_FOUND +%feature("docstring") sbol::URIProperty::set " +`set(new_value)` "; -%feature("docstring") sbol::SequenceConstraint::getTypeURI " +%feature("docstring") sbol::URIProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::URIProperty::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; + +%feature("docstring") sbol::URIProperty::add " +`add(new_value)` + +Appends the new value to a list of values, for properties that allow it. + +Parameters +---------- +* `new_value` : + A new string which will be added to a list of values. +"; + +// File: classsbol_1_1_usage.xml + + +%feature("docstring") sbol::Usage " + +How different entities are used in an Activity is specified with the Usage +class, which is linked from an Activity through the qualifiedUsage relationship. +A Usage is then linked to an Entity through the Entitys URI and the role of +this entity is qualified with the hadRole property. When the wasDerivedFrom +property is used together with the full provenance described here, the entity +pointed at by the wasDerivedFrom property MUST be included in a Usage. + +Attributes +---------- +* `entity` : `URIProperty` + The entity property is REQUIRED and MUST contain a URI which MAY refer to an + SBOL Identified object. + +* `roles` : `URIProperty` + The hadRole property is REQUIRED and MAY contain a URI that refers to a + particular term describing the usage of an entity referenced by the entity + property. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/provo.h +"; + +%feature("docstring") sbol::Usage::getClassName " +`getClassName(type) -> std::string` Returns ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::SequenceConstraint::copy " +%feature("docstring") sbol::Usage::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +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 + +Returns +------- +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::SequenceConstraint::compare " +%feature("docstring") sbol::Usage::compare " +`compare(comparand) -> int` Compare two SBOL objects or Documents. @@ -3792,14 +21447,32 @@ Parameters * `comparand` : A pointer to the object being compared to this one. -Returns -------- -1 if the objects are identical, 0 if they are different +Returns +------- +1 if the objects are identical, 0 if they are different +"; + +%feature("docstring") sbol::Usage::setPropertyValue " +`setPropertyValue(property_uri, val)` + +Set and overwrite the value for a user-defined annotation property. + +Either a literal or URI value +"; + +%feature("docstring") sbol::Usage::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value "; -%feature("docstring") sbol::SequenceConstraint::find " +%feature("docstring") sbol::Usage::find " +`find(uri) -> SBOLObject *` -Search this object recursively to see if an object with the URI already exists. +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- @@ -3811,23 +21484,43 @@ Returns A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::SequenceConstraint::find_property " +%feature("docstring") sbol::Usage::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Search this object recursively to see if it contains a member property with the -given RDF type. +Get the value of a custom annotation property by its URI. Parameters ---------- -* `uri` : - The RDF type of the property to search for. +* `property_uri` : + The URI for the property Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::SequenceConstraint::getPropertyValues " +%feature("docstring") sbol::Usage::update_uri " +`update_uri()` +"; + +%feature("docstring") sbol::Usage::~Usage " +`~Usage()` +"; + +%feature("docstring") sbol::Usage::getTypeURI " +`getTypeURI() -> rdf_type` + +Returns +------- +The uniform resource identifier that describes the RDF-type of this SBOL Object +"; + +%feature("docstring") sbol::Usage::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` +"; + +%feature("docstring") sbol::Usage::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` Get all values of a custom annotation property by its URI. @@ -3841,7 +21534,21 @@ Returns A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::SequenceConstraint::getProperties " +%feature("docstring") sbol::Usage::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::Usage::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value +"; + +%feature("docstring") sbol::Usage::getProperties " +`getProperties() -> std::vector< std::string >` Gets URIs for all properties contained by this object. @@ -3853,200 +21560,345 @@ Returns A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::SequenceConstraint::getClassName " - -Returns -------- -Parses a local class name from the RDF-type of this SBOL Object +%feature("docstring") sbol::Usage::generate " +`generate() -> SBOLClass &` "; -// File: classsbol_1_1_text_property.xml - +%feature("docstring") sbol::Usage::find_property " +`find_property(uri) -> SBOLObject *` -%feature("docstring") sbol::TextProperty " +Search this object recursively to see if it contains a member property with the +given RDF type. -TextProperty objects are used to contain string literals. +Parameters +---------- +* `uri` : + The RDF type of the property to search for. -They can be used as member objects inside custom SBOL Extension classes. +Returns +------- +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -%feature("docstring") sbol::TextProperty::set " +%feature("docstring") sbol::Usage::getAnnotation " +`getAnnotation(property_uri) -> std::string` + +Get the value of a custom annotation property by its URI. -Basic setter for SBOL TextProperty. +Synonymous with getPropertyValue Parameters ---------- -* `new_value` : - A new integer value for the property, which is converted to a raw string - during serialization. -"; - -%feature("docstring") sbol::TextProperty::get " - -Basic getter for all SBOL literal properties. +* `property_uri` : + The URI for the property Returns ------- -A string literal +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::TextProperty::getTypeURI " - -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::Usage::cast " +`cast() -> SBOLClass &` "; -%feature("docstring") sbol::TextProperty::clear " +%feature("docstring") sbol::Usage::close " +`close()` -Remove all children objects from the parent and destroy them. -"; +Use this method to destroy an SBOL object that is not contained by a parent +Document. -%feature("docstring") sbol::TextProperty::getAll " +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. +"; -Retrieve a vector of objects from the TextProperty. +%feature("docstring") sbol::Usage::Usage " +`Usage(uri=\"example\", entity=\"\", role=\"\", version=VERSION_STRING)` -"; +Constructor. -%feature("docstring") sbol::TextProperty::getOwner " +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. "; -%feature("docstring") sbol::TextProperty::add " +%feature("docstring") sbol::Usage::Usage " +`Usage(type, uri, entity, role, version)` -Appends the new value to a list of values, for properties that allow it. +Constructor used for defining extension classes. Parameters ---------- -* `new_value` : - A new string which will be added to a list of values. +* `rdf_type` : + The RDF type for an extension class derived from this one "; -%feature("docstring") sbol::TextProperty::remove " +%feature("docstring") sbol::Usage::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` -Remove a TextProperty from the list of objects and destroy it. +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- * `uri` : - The identity of the object to be destroyed. This can be a displayId of the - object or a full URI may be provided. -* `index` : - A numerical index for the object. -"; + The RDF type of the property to search for. +* `value` : + The property value to match -%feature("docstring") sbol::TextProperty::write " +Returns +------- +A vector containing all objects found that contain a member property with the +specified RDF type "; -%feature("docstring") sbol::TextProperty::validate " -"; +// File: classsbol_1_1_variable_component.xml -%feature("docstring") sbol::TextProperty::TextProperty " -"; -// File: classsbol_1_1_top_level.xml +%feature("docstring") sbol::VariableComponent " +The VariableComponent class can be used to specify a choice of +ComponentDefinition objects for any new Component derived from a template +Component in the template ComponentDefinition. This specification is made using +the class properties variable, variants, variantCollections, and +variantDerivations. While the variants, variantCollections, and +variantDerivations properties are OPTIONAL, at least one of them MUST NOT be +empty. -%feature("docstring") sbol::TopLevel " +Attributes +---------- +* `variable` : `ReferencedObject` + The variable property is REQUIRED and MUST contain a URI that refers to a + template `Component` in the template `ComponentDefinition`. If the + wasDerivedFrom property of a Component refers to this template Component, + then the definition property of the derived Component MUST refer to one of + the ComponentDefinition objects referred to by the variants property of the + VariableComponent. If not, then this definition property MUST either (1) + refer to one of the ComponentDefinition objects from a Collection referred + to by the variantCollections property of the VariableComponent, or (2) refer + to a ComponentDefinition derived from a CombinatorialDerivation referred to + by the variantDerivations property of the VariableComponent. + +* `repeat` : `URIProperty` + The `repeat` property is REQUIRED and has a data type of URI. + + This property specifies how many `Component` objects can be derived from the + template `Component` during the derivation of a new `ComponentDefinition`. + The URI value of this property MUST come from the REQUIRED `operator` URIs + provided in the table below + Operator URI + + Description + + http://sbols.org/v2#zeroOrOne + + No more than one `Component` in the derived `ComponentDefinition` SHOULD + have a `wasDerivedFrom` property that refers to the template `Component`. + + http://sbols.org/v2#one + + Exactly one `Component` in the derived `ComponentDefinition` SHOULD have a + `wasDerivedFrom` property that refers to the template `Component`. + + http://sbols.org/v2#zeroOrMore + + Any number of `Component` objects in the derived `ComponentDefinition` MAY + have `wasDerivedFrom` properties that refer to the template `Component`. + + http://sbols.org/v2#oneOrMore + + At least one `Component` in the derived `ComponentDefinition` SHOULD have a + `wasDerivedFrom` property that refers to the template `Component`. + +* `variants` : `ReferencedObject` + The variants property is OPTIONAL and MAY contain zero or more URIs that + each refer to a ComponentDefinition. This property specifies individual + ComponentDefinition objects to serve as options when deriving a new + Component from the template Component. + +* `variantCollections` : `ReferencedObject` + The variantCollections property is OPTIONAL and MAY contain zero or more + URIs that each refer to a Collection. The members property of each + Collection referred to in this way MUST NOT be empty and MUST refer only to + ComponentDefinition objects. This property enables the convenient + specification of existing groups of ComponentDefinition objects to serve as + options when deriving a new Component from the template Component. + +* `variantDerivations` : `ReferencedObject` + The variantDerivations property is OPTIONAL and MAY contain zero or more + URIs that each refer to a CombinatorialDerivation. This property enables the + convenient specification of ComponentDefinition objects derived in + accordance with another CombinatorialDerivation to serve as options when + deriving a new Component from the template Component. The variantDerivations + property of a VariableComponent MUST NOT refer to the + CombinatorialDerivation that contains this VariableComponent (no cyclic + derivations are allowed. + +* `persistentIdentity` : `URIProperty` + The persistentIdentity property is OPTIONAL and has a data type of URI. This + URI serves to uniquely refer to a set of SBOL objects that are different + versions of each other. An Identified object MUST be referred to using + either its identity URI or its persistentIdentity URI. + +* `displayId` : `TextProperty` + The displayId property is an OPTIONAL identifier with a data type of String. + This property is intended to be an intermediate between name and identity + that is machine-readable, but more human-readable than the full URI of an + identity. If the displayId property is used, then its String value SHOULD be + locally unique (global uniqueness is not necessary) and MUST be composed of + only alphanumeric or underscore characters and MUST NOT begin with a digit. + +* `version` : `VersionProperty` + If the version property is used, then it is RECOMMENDED that version + numbering follow the conventions of semantic versioning, particularly as + implemented by Maven. This convention represents versions as sequences of + numbers and qualifiers that are separated by the characters . and - and + are compared in lexicographical order (for example, 1 < 1.3.1 < 2.0-beta). + For a full explanation, see the linked resources. + +* `wasDerivedFrom` : `URIProperty` + The wasDerivedFrom property is OPTIONAL and has a data type of URI. An SBOL + object with this property refers to another SBOL object or non-SBOL resource + from which this object was derived. If the wasDerivedFrom property of an + SBOL object A that refers to an SBOL object B has an identical + persistentIdentity, and both A and B have a version, then the version of B + MUST precede that of A. In addition, an SBOL object MUST NOT refer to itself + via its own wasDerivedFrom property or form a cyclical chain of references + via its wasDerivedFrom property and those of other SBOL objects. For + example, the reference chain A was derived from B and B was derived from + A is cyclical. + +* `wasGeneratedBy` : `ReferencedObject` + An Activity which generated this ComponentDefinition, eg., a design process + like codon-optimization or a construction process like Gibson Assembly. + +* `name` : `TextProperty` + The name property is OPTIONAL and has a data type of String. This property + is intended to be displayed to a human when visualizing an Identified + object. If an Identified object lacks a name, then software tools SHOULD + instead display the objects displayId or identity. It is RECOMMENDED that + software tools give users the ability to switch perspectives between name + properties that are human-readable and displayId properties that are less + human-readable, but are more likely to be unique. + +* `description` : `TextProperty` + The description property is OPTIONAL and has a data type of String. This + property is intended to contain a more thorough text description of an + Identified object. + +* `identity` : `URIProperty` + The identity property is REQUIRED by all Identified objects and has a data + type of URI. A given Identified objects identity URI MUST be globally + unique among all other identity URIs. The identity of a compliant SBOL + object MUST begin with a URI prefix that maps to a domain over which the + user has control. Namely, the user can guarantee uniqueness of identities + within this domain. For other best practices regarding URIs see Section 11.2 + of the SBOL specification doucment. + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/combinatorialderivation.h +"; + +%feature("docstring") sbol::VariableComponent::getAnnotation " +`getAnnotation(property_uri) -> std::string` -All SBOL classes derived from TopLevel appear as top level nodes in the RDF/XML -document tree and SBOL files. An abstract class. -"; +Get the value of a custom annotation property by its URI. -%feature("docstring") sbol::TopLevel::TopLevel " -"; +Synonymous with getPropertyValue -%feature("docstring") sbol::TopLevel::getTypeURI " +Parameters +---------- +* `property_uri` : + The URI for the property Returns ------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::TopLevel::find " +%feature("docstring") sbol::VariableComponent::compare " +`compare(comparand) -> int` -Search this object recursively to see if an object with the URI already exists. +Compare two SBOL objects or Documents. + +The behavior is currently undefined for objects with custom annotations or +extension classes. Parameters ---------- -* `uri` : - The URI to search for. +* `comparand` : + A pointer to the object being compared to this one. Returns ------- -A pointer to theobject with this URI if it exists, NULL otherwise +1 if the objects are identical, 0 if they are different "; -%feature("docstring") sbol::TopLevel::getClassName " +%feature("docstring") sbol::VariableComponent::getTypeURI " +`getTypeURI() -> rdf_type` Returns ------- -Parses a local class name from the RDF-type of this SBOL Object +The uniform resource identifier that describes the RDF-type of this SBOL Object "; -%feature("docstring") sbol::TopLevel::getProperties " - -Gets URIs for all properties contained by this object. +%feature("docstring") sbol::VariableComponent::close " +`close()` -This includes SBOL core properties as well as custom annotations. Use this to -find custom extension data in an SBOL file. +Use this method to destroy an SBOL object that is not contained by a parent +Document. -Returns -------- -A vector of URIs that identify the properties contained in this object +If the object does have a parent Document, instead use doc.close() with the +object's URI identity as an argument. Recurse through child objects and delete +them. "; -%feature("docstring") sbol::TopLevel::addToDocument " +%feature("docstring") sbol::VariableComponent::setPropertyValue " +`setPropertyValue(property_uri, val)` -Add the TopLevel object to Document +Set and overwrite the value for a user-defined annotation property. +Either a literal or URI value "; -%feature("docstring") sbol::TopLevel::compare " - -Compare two SBOL objects or Documents. +%feature("docstring") sbol::VariableComponent::find " +`find(uri) -> SBOLObject *` -The behavior is currently undefined for objects with custom annotations or -extension classes. +Search this object recursively to see if an object or any child object with URI +already exists. Parameters ---------- -* `comparand` : - A pointer to the object being compared to this one. +* `uri` : + The URI to search for. Returns ------- -1 if the objects are identical, 0 if they are different +A pointer to theobject with this URI if it exists, NULL otherwise "; -%feature("docstring") sbol::TopLevel::copy " - -Copy an object and automatically increment its version. - -If the optional version argument is specified, it will be used instead of -incrementing the copied object's version. An object may also be copied into a -new document and a new namespace, assuming compliant URIs. +%feature("docstring") sbol::VariableComponent::find_property " +`find_property(uri) -> SBOLObject *` -templateparam -------------- -* `SBOLClass` : - The type of SBOL object being copied +Search this object recursively to see if it contains a member property with the +given RDF type. Parameters ---------- -* `new_doc` : - The new copies will be attached to this Document. NULL by default. -* `ns` : - This namespace will be substituted for the current namespace (as configured - by setHomespace) in all SBOL-compliat URIs. -* `version` : - A new version +* `uri` : + The RDF type of the property to search for. Returns ------- -The full URI of the created object. +A pointer to the object that contains a member property with the specified RDF +type, NULL otherwise "; -%feature("docstring") sbol::TopLevel::getPropertyValues " +%feature("docstring") sbol::VariableComponent::getPropertyValues " +`getPropertyValues(property_uri) -> std::vector< std::string >` Get all values of a custom annotation property by its URI. @@ -4060,89 +21912,140 @@ Returns A vector of property values or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::TopLevel::getPropertyValue " +%feature("docstring") sbol::VariableComponent::cast " +`cast() -> SBOLClass &` +"; -Get the value of a custom annotation property by its URI. +%feature("docstring") sbol::VariableComponent::apply " +`apply(callback_fn, user_data)` +"; + +%feature("docstring") sbol::VariableComponent::find_reference " +`find_reference(uri) -> std::vector< SBOLObject * >` + +Search this object recursively to see if it contains a member property with the +given RDF type and indicated property value. Parameters ---------- -* `property_uri` : - The URI for the property +* `uri` : + A URI, either an ontology term or an object reference, to search for Returns ------- -The value of the property or SBOL_ERROR_NOT_FOUND +A vector containing all objects found that contain the URI in a property value "; -%feature("docstring") sbol::TopLevel::find_property " +%feature("docstring") sbol::VariableComponent::find_property_value " +`find_property_value(uri, value, matches={}) -> std::vector< SBOLObject * >` Search this object recursively to see if it contains a member property with the -given RDF type. +given RDF type and indicated property value. Parameters ---------- * `uri` : The RDF type of the property to search for. +* `value` : + The property value to match Returns ------- -A pointer to the object that contains a member property with the specified RDF -type, NULL otherwise +A vector containing all objects found that contain a member property with the +specified RDF type "; -// File: classsbol_1_1_u_r_i_property.xml - +%feature("docstring") sbol::VariableComponent::getProperties " +`getProperties() -> std::vector< std::string >` -%feature("docstring") sbol::URIProperty " +Gets URIs for all properties contained by this object. -A URIProperty may contain a restricted type of string that conforms to the -specification for a Uniform Resource Identifier (URI), typically consisting of a -namespace authority followed by an identifier. +This includes SBOL core properties as well as custom annotations. Use this to +find custom extension data in an SBOL file. -A URIProperty often contains a reference to an SBOL object or may contain an -ontology term. +Returns +------- +A vector of URIs that identify the properties contained in this object "; -%feature("docstring") sbol::URIProperty::write " +%feature("docstring") sbol::VariableComponent::addPropertyValue " +`addPropertyValue(property_uri, val)` + +Append a value to a user-defined annotation property. + +Either a literal or URI value "; -%feature("docstring") sbol::URIProperty::URIProperty " +%feature("docstring") sbol::VariableComponent::copy " +`copy(ns=\"\", version=\"\") -> SBOLClass &` "; -%feature("docstring") sbol::URIProperty::getAll " +%feature("docstring") sbol::VariableComponent::VariableComponent " +`VariableComponent(uri=\"example\", repeat=\"http://sbols.org/v2#one\", + version=VERSION_STRING)` -Retrieve a vector of objects from the URIProperty. +Constructor. +Parameters +---------- +* `uri` : + A full URI including a scheme, namespace, and identifier. If SBOLCompliance + configuration is enabled, then this argument is simply the displayId for the + new object and a full URI will automatically be constructed. +* `repeat` : + A URI indicating how many `Component` objects can be derived from the + template `Component` "; -%feature("docstring") sbol::URIProperty::get " +%feature("docstring") sbol::VariableComponent::VariableComponent " +`VariableComponent(type, uri, repeat, version)` -Basic getter for all SBOL literal properties. +Constructor used for defining extension classes. + +Parameters +---------- +* `rdf_type` : + The RDF type for an extension class derived from this one +"; + +%feature("docstring") sbol::VariableComponent::getClassName " +`getClassName(type) -> std::string` Returns ------- -A string of characters used to identify a resource +Parses a local class name from the RDF-type of this SBOL Object "; -%feature("docstring") sbol::URIProperty::set " +%feature("docstring") sbol::VariableComponent::getPropertyValue " +`getPropertyValue(property_uri) -> std::string` -Basic setter for SBOL URIProperty. +Get the value of a custom annotation property by its URI. Parameters ---------- -* `new_value` : - A new integer value for the property, which is converted to a raw string - during serialization. +* `property_uri` : + The URI for the property + +Returns +------- +The value of the property or SBOL_ERROR_NOT_FOUND "; -%feature("docstring") sbol::URIProperty::add " +%feature("docstring") sbol::VariableComponent::update_uri " +`update_uri()` +"; -Appends the new value to a list of values, for properties that allow it. +%feature("docstring") sbol::VariableComponent::generate " +`generate() -> SBOLClass &` +"; -Parameters ----------- -* `new_value` : - A new string which will be added to a list of values. +%feature("docstring") sbol::VariableComponent::setAnnotation " +`setAnnotation(property_uri, val)` + +Set the value for a user-defined annotation property. + +Synonymous with setPropertyValue If the value is a URI, it should be surrounded +by angle brackets, else it will be interpreted as a literal value "; // File: classsbol_1_1_version_property.xml @@ -4153,18 +22056,31 @@ Parameters Contains a version number for an SBOL object. The VersionProperty follows Maven versioning semantics and includes a major, -minor, and patch version number. Specifically, libSBOL currently only supports -using '.' as a delimiter (e.g.: v2.0.1). If the user does not want to follow Maven -versioning, they can specify an arbitrary version string using the set() method. +minor, and patch version number. + +Attributes +---------- +* `python_iter` : `std::vector< std::string >::iterator` + +C++ includes: /Users/bbartley/Dev/git/libSBOL/source/properties.h +"; + +%feature("docstring") sbol::VersionProperty::clear " +`clear()` + +Clear all property values. "; %feature("docstring") sbol::VersionProperty::getAll " +`getAll() -> std::vector< std::string >` +"; -Retrieve a vector of objects from the VersionProperty. - +%feature("docstring") sbol::VersionProperty::end " +`end() -> iterator` "; %feature("docstring") sbol::VersionProperty::major " +`major() -> int` Get major version. @@ -4175,8 +22091,20 @@ returns the major version number "; %feature("docstring") sbol::VersionProperty::set " +`set(new_value)` + +Basic setter for SBOL TextProperty and URIProperty. + +Parameters +---------- +* `new_value` : + A new string value for the Property. +"; + +%feature("docstring") sbol::VersionProperty::set " +`set(new_value)` -Basic setter for SBOL VersionProperty. +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. Parameters ---------- @@ -4185,14 +22113,32 @@ Parameters during serialization. "; -%feature("docstring") sbol::VersionProperty::getTypeURI " +%feature("docstring") sbol::VersionProperty::set " +`set(new_value)` +"; -Returns -------- -The uniform resource identifier that describes the RDF-type of this SBOL Object +%feature("docstring") sbol::VersionProperty::set " +`set(new_value)` + +Basic setter for SBOL IntProperty, but can be used with TextProperty as well. + +Parameters +---------- +* `new_value` : + A new integer value for the property, which is converted to a raw string + during serialization. +"; + +%feature("docstring") sbol::VersionProperty::getLowerBound " +`getLowerBound() -> char` +"; + +%feature("docstring") sbol::VersionProperty::getTypeURI " +`getTypeURI() -> rdf_type` "; %feature("docstring") sbol::VersionProperty::minor " +`minor() -> int` Get minor version. @@ -4202,15 +22148,42 @@ The minor version as an integer Splits the version string by a delimiter and returns the minor version number "; +%feature("docstring") sbol::VersionProperty::copy " +`copy(target_property)` + +Copy property values to a target object's property fields. +"; + %feature("docstring") sbol::VersionProperty::VersionProperty " +`VersionProperty(property_owner, type_uri, lower_bound, upper_bound, + initial_value)` + +Initialize the VersionProperty with a version string. + +If a version is specified, it will be checked to confirm it follows Maven +versioning semantics. + +Parameters +---------- +* `type_uri` : + An RDF type for the property which determines how the property is serialized + in SBOL files +* `lower_bound` : + A char flag (typically '0' or '1') indicating the minimum number of values + allowed for this property +* `upper_bound` : + A char flag (typically '1' or '*') indicating the maximum number of values + allowed for this property "; %feature("docstring") sbol::VersionProperty::decrementMajor " +`decrementMajor()` Decrement major version. "; %feature("docstring") sbol::VersionProperty::get " +`get() -> std::string` Basic getter for all SBOL literal properties. @@ -4220,47 +22193,61 @@ A string literal "; %feature("docstring") sbol::VersionProperty::decrementMinor " +`decrementMinor()` Decrement major version. "; -%feature("docstring") sbol::VersionProperty::remove " +%feature("docstring") sbol::VersionProperty::find " +`find(query) -> bool` + +Check if a value in this property matches the query. +"; -Remove a VersionProperty from the list of objects and destroy it. +%feature("docstring") sbol::VersionProperty::begin " +`begin() -> iterator` +"; -Parameters ----------- -* `uri` : - The identity of the object to be destroyed. This can be a displayId of the - object or a full URI may be provided. -* `index` : - A numerical index for the object. +%feature("docstring") sbol::VersionProperty::addValidationRule " +`addValidationRule(rule)` +"; + +%feature("docstring") sbol::VersionProperty::remove " +`remove(index=0)` + +Remove a property value. "; %feature("docstring") sbol::VersionProperty::incrementMajor " +`incrementMajor()` Increment major version. "; %feature("docstring") sbol::VersionProperty::incrementMinor " +`incrementMinor()` Increment minor version. "; %feature("docstring") sbol::VersionProperty::validate " +`validate(arg=NULL)` "; %feature("docstring") sbol::VersionProperty::decrementPatch " +`decrementPatch()` Decrement major version. "; %feature("docstring") sbol::VersionProperty::incrementPatch " +`incrementPatch()` Increment patch version. "; %feature("docstring") sbol::VersionProperty::add " +`add(new_value)` Appends the new value to a list of values, for properties that allow it. @@ -4270,7 +22257,20 @@ Parameters A new string which will be added to a list of values. "; +%feature("docstring") sbol::VersionProperty::getUpperBound " +`getUpperBound() -> char` +"; + +%feature("docstring") sbol::VersionProperty::size " +`size() -> int` +"; + +%feature("docstring") sbol::VersionProperty::write " +`write()` +"; + %feature("docstring") sbol::VersionProperty::patch " +`patch() -> int` Get patch version. @@ -4281,165 +22281,442 @@ returns the patch version "; %feature("docstring") sbol::VersionProperty::getOwner " +`getOwner() -> SBOLObject &` "; // File: namespacesbol.xml -%feature("docstring") sbol::toggleSBOLCompliantTypes " +%feature("docstring") sbol::libsbol_rule_13 " +`libsbol_rule_13(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Allows SBOL-compliant URIs. +%feature("docstring") sbol::create " +`create() -> sbol::SBOLObject &` +"; -Parameters ----------- -* `is_toggled` : - Accepts boolean. The default value is false. +%feature("docstring") sbol::calculateCoverage " +`calculateCoverage(target, qc_annotations) -> float` +"; + +%feature("docstring") sbol::libsbol_rule_11 " +`libsbol_rule_11(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; + +%feature("docstring") sbol::setFileFormat " +`setFileFormat(file_format) -> SBOL_DECLSPEC void` + +Sets file format to use. +"; + +%feature("docstring") sbol::getHomespace " +`getHomespace() -> SBOL_DECLSPEC std::string` + +Get the current default namespace for autocreation of URIs when a new SBOL +object is created. "; %feature("docstring") sbol::hasHomespace " +`hasHomespace() -> SBOL_DECLSPEC int` Checks if a valid default namespace has been defined. "; -%feature("docstring") sbol::compliantTypesEnabled " +%feature("docstring") sbol::is_alphanumeric_or_underscore " +`is_alphanumeric_or_underscore(c) -> bool` +"; -Checks if an object's type is included in SBOL-compliant URIs. +%feature("docstring") sbol::calculateAmbiguity " +`calculateAmbiguity(target, qc_annotations) -> float` "; -%feature("docstring") sbol::setHomespace " +%feature("docstring") sbol::libsbol_rule_19 " +`libsbol_rule_19(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Sets the default namespace for autocreation of URIs when a new SBOL object is -created. +%feature("docstring") sbol::libsbol_rule_18 " +`libsbol_rule_18(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Parameters ----------- -* `ns`: - Homespace +%feature("docstring") sbol::libsbol_rule_17 " +`libsbol_rule_17(sbol_obj, arg) -> SBOL_DECLSPEC void` "; -%feature("docstring") sbol::create " +%feature("docstring") sbol::libsbol_rule_16 " +`libsbol_rule_16(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; + +%feature("docstring") sbol::libsbol_rule_15 " +`libsbol_rule_15(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; + +%feature("docstring") sbol::libsbol_rule_14 " +`libsbol_rule_14(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; + +%feature("docstring") sbol::calculateError " +`calculateError(target, qc_annotations) -> float` +"; + +%feature("docstring") sbol::libsbol_rule_12 " +`libsbol_rule_12(sbol_obj, arg) -> SBOL_DECLSPEC void` "; %feature("docstring") sbol::getFileFormat " +`getFileFormat() -> std::string SBOL_DECLSPEC` Returns currently accepted file format. "; -%feature("docstring") sbol::exceptionsEnabled " +%feature("docstring") sbol::libsbol_rule_10 " +`libsbol_rule_10(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Checks if exception is enabled. +%feature("docstring") sbol::libsbol_rule_9 " +`libsbol_rule_9(sbol_obj, arg) -> SBOL_DECLSPEC void` "; -%feature("docstring") sbol::toggleExceptions " +%feature("docstring") sbol::libsbol_rule_8 " +`libsbol_rule_8(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Function to toggle exception handling. +%feature("docstring") sbol::libsbol_rule_3 " +`libsbol_rule_3(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Parameters ----------- -* `is_toggled` : - Accepts boolean. The default value is false. +%feature("docstring") sbol::libsbol_rule_2 " +`libsbol_rule_2(sbol_obj, arg) -> SBOL_DECLSPEC void` "; -%feature("docstring") sbol::setFileFormat " +%feature("docstring") sbol::libsbol_rule_1 " +`libsbol_rule_1(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Sets file format to use. +%feature("docstring") sbol::libsbol_rule_7 " +`libsbol_rule_7(sbol_obj, arg) -> SBOL_DECLSPEC void` "; -%feature("docstring") sbol::getHomespace " +%feature("docstring") sbol::libsbol_rule_6 " +`libsbol_rule_6(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Returns the current default namespace for autocreation of URIs when a new SBOL -object is created. +%feature("docstring") sbol::libsbol_rule_5 " +`libsbol_rule_5(sbol_obj, arg) -> SBOL_DECLSPEC void` "; -%feature("docstring") sbol::isSBOLCompliant " +%feature("docstring") sbol::libsbol_rule_4 " +`libsbol_rule_4(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Checks if SBOLCompliance is enabled. +%feature("docstring") sbol::reportQC " +`reportQC(target, construct, qc_method) -> std::unordered_map< std::string, + std::tuple< int, int, float > >` "; -%feature("docstring") sbol::toggleSBOLCompliance " +%feature("docstring") sbol::addQCAnnotations " +`addQCAnnotations(target, construct)` +"; -Enables SBOLCompliance, which simplifies creation of URIs in constructor calls. +%feature("docstring") sbol::sbolRule10101 " +`sbolRule10101(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Parameters ----------- -* `is_toggled` : - Accepts boolean. The default value is false. +%feature("docstring") sbol::setHomespace " +`setHomespace(ns) -> SBOL_DECLSPEC void` + +Global methods. + +Set the default namespace for autocreation of URIs when a new SBOL object is +created "; +%feature("docstring") sbol::sbolRule10102 " +`sbolRule10102(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -%feature("docstring") sbol::PartShop::count " -Return the count of objects contained in a PartShop +%feature("docstring") sbol::is_not_alphanumeric_or_underscore " +`is_not_alphanumeric_or_underscore(c) -> bool` "; -%feature("docstring") sbol::PartShop::pull " -Retrieve an object from an online resource +%feature("docstring") sbol::verify_base " +`verify_base(target_base, actual_base) -> std::string` +"; -Parameters ----------- -* `uri` : - The identity of the SBOL object you want to retrieve -* `doc` : - The Document to which SBOL data will be added -"; - -%feature("docstring") sbol::PartShop::pullRootCollections " -Returns a Document containing all Collections in the PartShop that are not members of any other Collections. -"; - -%feature("docstring") sbol::PartShop::search " -An exact search. Scan the parts repository for objects that exactly match the specified criteria. In most uses of this function, LibSBOL's built-in RDF type constants (see @file constants.h) will come in handy. For instance, searching for all SBOL_COMPONENT_DEFINITION of type BIOPAX_DNA. (These constants follow a fairly systematic and consistent naming scheme (see @file constants.h). The number of records returned in the search is specified by offset and limit parameters. Metadata is return as a list of object metadata in dictionary format. +%feature("docstring") sbol::libsbol_rule_22 " +`libsbol_rule_22(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Parameters ----------- -* `search_text` : - This may be a literal text value or it may be a URI -* `object_type` : - The RDF type of an SBOL object. For example, SBOL_COMPONENT_DEFINITION -* `property_uri` : - The RDF type of an SBOL property. Specifies which field of an SBOL object to search. For example, SBOL_ROLES -* `offset` : - The index of the first record to return. This parameter is indexed starting from zero -* `limit` : - The total count number of records to return -"; +%feature("docstring") sbol::libsbol_rule_20 " +`libsbol_rule_20(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -%feature("docstring") sbol::PartShop::search " -A general search. Search name, description, and displayId properties for a match to the search text, including matches to substrings of the property value. The type of object to search for can be further restricted by use of the second parameter, though this is set to SBOL_COMPONENT_DEFINITION by default. See @file constants.h for more of libSBOL's built-in RDF type constants. These constants follow a fairly predictable and consistent naming scheme. The number of records returned in the search is specified by offset and limit parameters. Metadata is return as a list of object metadata in dictionary format. +%feature("docstring") sbol::libsbol_rule_21 " +`libsbol_rule_21(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Parameters ----------- -* `search_text` A snippet of text to search for in an SBOL object's displayId, name, and description fields -* `object_type` The RDF type of an SBOL object. For example, SBOL_COMPONENT_DEFINITION -* `offset` The index of the first record to return. This parameter is indexed starting from zero -* `limit` The total count number of records to return -"; - -%feature("docstring") sbol::PartShop::search " -An advanced search that allows the user to specify an arbitrary number of search criteria as key/value pairs. Metadata is return as a list of object metadata in dictionary format. +%feature("docstring") sbol::libsbol_rule_24 " +`libsbol_rule_24(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Parameters ----------- -* `q` : - A SearchQuery object populated with search fields and values specified as key/value pairs +%feature("docstring") sbol::sbol_rule_10204 " +`sbol_rule_10204(sbol_obj, arg) -> SBOL_DECLSPEC void` "; - -%feature("docstring") sbol::PartShop::submit " -Submit your SBOL data to a SynBioHub instance. In order to submit to a PartShop, you must login first. Register on [SynBioHub](http://synbiohub.org) to obtain account credentials. -* `doc` : - The Document to submit -* `overwrite` : - An integer code: 0(default) - do not overwrite, 1 - overwrite, 2 - merge + +%feature("docstring") sbol::calculateIdentity " +`calculateIdentity(target, qc_annotations) -> float` "; -%feature("docstring") sbol::PartShop::login " -In order to submit to a PartShop, you must login first. Register on [SynBioHub](http://synbiohub.org) to obtain account credentials. +%feature("docstring") sbol::sbol_rule_10202 " +`sbol_rule_10202(sbol_obj, arg) -> SBOL_DECLSPEC void` +"; -Parameters ----------- -* `email` : - The email associated with the user's SynBioHub account -* `password` : - The user's password +%feature("docstring") sbol::get_sequence_annotation_callback " +`get_sequence_annotation_callback(cdef_node, user_data)` "; - // File: namespacestd.xml + +// File: _biosystem_design_example_8cpp.xml + +%feature("docstring") main " +`main() -> int` +"; + +// File: _c_r_i_s_p_r_repression_example_8cpp.xml + +%feature("docstring") main " +`main() -> int` +"; + +// File: _sequence_assembly_example_8cpp.xml + +%feature("docstring") main " +`main() -> int` +"; + +// File: _find_doxygen_8cmake.xml + +// File: getting__started_8dox.xml + +// File: installation_8dox.xml + +// File: mainpage_8dox.xml + +// File: modules_8dox.xml + +// File: sequences_8dox.xml + +// File: assembly_8cpp.xml + +%feature("docstring") std::disassemble " +`disassemble(cdef_node, range_start)` +"; + +%feature("docstring") std::compare_ranges " +`compare_ranges(a, b) -> bool` +"; + +%feature("docstring") std::is_complete " +`is_complete(cdef_node, user_data)` +"; + +%feature("docstring") std::is_regular " +`is_regular(cdef_node, user_data)` +"; + +%feature("docstring") std::nest_ranges " +`nest_ranges(ranges, cdef_node, nucleotides)` +"; + +// File: assembly_8h.xml + +// File: attachment_8h.xml + +// File: source_2cmake__install_8cmake.xml + +// File: manual_2cmake__install_8cmake.xml + +// File: source_2_c_make_lists_8txt.xml + +%feature("docstring") include_directories " +`include_directories(${JsonCpp_INCLUDE_DIR})` +"; + +%feature("docstring") if " +`if(SBOL_BUILD_SHARED) -> MATCHES Linux OR Darwin` +"; + +%feature("docstring") if " +`if(${CMAKE_SYSTEM_NAME} MATCHES \"Windows\")` +"; + +%feature("docstring") if " +`if(arg1) -> bigobj EHsc` +"; + +%feature("docstring") endif " +`endif()` +"; + +%feature("docstring") add_subdirectory " +`add_subdirectory(arg1)` +"; + +// File: example_2_c_make_lists_8txt.xml + +%feature("docstring") TARGET_LINK_LIBRARIES " +`TARGET_LINK_LIBRARIES(ws2_32)` +"; + +%feature("docstring") find_library " +`find_library(arg1)` +"; + +%feature("docstring") find_library " +`find_library(arg1)` +"; + +%feature("docstring") find_library " +`find_library(arg1)` +"; + +%feature("docstring") SET " +`SET(include) -> SBOL lib` +"; + +%feature("docstring") SET " +`SET(sbol) -> lib` +"; + +%feature("docstring") cmake_policy " +`cmake_policy(NEW)` +"; + +// File: manual_2_c_make_lists_8txt.xml + +%feature("docstring") CONFIGURE_FILE " +`CONFIGURE_FILE(${SBOL_MANUAL_DIR}/Doxyfile.in ${SBOL_MANUAL_DIR}/)` +"; + +// File: collection_8h.xml + +// File: combinatorialderivation_8h.xml + +// File: component_8h.xml + +// File: componentdefinition_8h.xml + +// File: config_8cpp.xml + +// File: config_8h.xml + +// File: constants_8h.xml + +// File: dbtl_8cpp.xml + +// File: dbtl_8h.xml + +// File: document_8cpp.xml + +// File: document_8h.xml + +// File: identified_8h.xml + +// File: implementation_8h.xml + +// File: interaction_8h.xml + +// File: location_8h.xml + +// File: mapsto_8h.xml + +// File: mergestaticlibs_8cmake.xml + +// File: model_8h.xml + +// File: module_8h.xml + +// File: moduledefinition_8h.xml + +// File: object_8cpp.xml + +// File: object_8h.xml + +// File: participation_8h.xml + +// File: partshop_8cpp.xml + +%feature("docstring") sbol::getch " +`getch(arg1) -> int` +"; + +%feature("docstring") sbol::encode_http " +`encode_http(text)` +"; + +%feature("docstring") sbol::replace " +`replace(text, target, replacement)` +"; + +%feature("docstring") sbol::http_get_request " +`http_get_request(get_request, headers=NULL, response_headers=NULL) -> + std::string` +"; + +// File: partshop_8h.xml + +// File: properties_8cpp.xml + +// File: properties_8h.xml + +// File: property_8h.xml + +// File: provo_8h.xml + +// File: sbol_8h.xml + +// File: sbolerror_8cpp.xml + +// File: sbolerror_8h.xml + +// File: sequence_8h.xml + +// File: sequenceannotation_8h.xml + +// File: sequenceconstraint_8h.xml + +// File: toplevel_8h.xml + +// File: validation_8cpp.xml + +// File: validation_8h.xml + +// File: group__sbol__core__data__model.xml + +// File: group__extension__layer.xml + +// File: getting_started.xml + +// File: installation.xml + +// File: modular_design.xml + +// File: sequences.xml + +// File: dir_a2f46d281c6389dc39997ffcf82aba39.xml + +// File: dir_ad2b3518b6ff8020e6ece2469bc5e793.xml + +// File: dir_f805d5279cb05653177a87a05b432f21.xml + +// File: dir_59d233a1711e1dd823533c8983d914f6.xml + +// File: dir_42d929c8dbf52848391b2c813969d717.xml + +// File: dir_4a2979e7724b3af16c43d59799dc78e7.xml + +// File: dir_10125a6defe251d1210214134d64796c.xml + +// File: dir_d522931ffa1371640980b621734a4381.xml + +// File: indexpage.xml + diff --git a/wrapper/sbol.py b/wrapper/sbol.py index b79ac696..0efd1f52 100644 --- a/wrapper/sbol.py +++ b/wrapper/sbol.py @@ -1,4 +1,4 @@ -## @package sbol +# @package sbol # A Python wrapper for libSBOLc, a module for reading, writing, and constructing # genetic designs according to the standardized specifications of the Synthetic Biology Open Language # @@ -14,4 +14,4 @@ # @namespace sbol.sbol_test # Unit tests -from libsbol import * +from .libsbol import * diff --git a/wrapper/test_assembly.py b/wrapper/test_assembly.py new file mode 100644 index 00000000..5cc559e9 --- /dev/null +++ b/wrapper/test_assembly.py @@ -0,0 +1,53 @@ +from sbol import * + +setHomespace('http://sys-bio.org') +doc = Document() + +gene = ComponentDefinition('gene_example') +promoter = ComponentDefinition('R0010') +CDS = ComponentDefinition('B0032') +RBS = ComponentDefinition('E0040') +terminator = ComponentDefinition('B0012') + +promoter.roles = SO_PROMOTER +CDS.roles = SO_CDS +RBS.roles = SO_RBS +terminator.roles = SO_TERMINATOR + +doc.addComponentDefinition(gene) +doc.addComponentDefinition(promoter) +doc.addComponentDefinition(CDS) +doc.addComponentDefinition(RBS) +doc.addComponentDefinition(terminator) + +gene.assemblePrimaryStructure([ promoter, RBS, CDS, terminator ]) + +first = gene.getFirstComponent() +print(first.identity) +last = gene.getLastComponent() +print(last.identity) + +promoter_seq = Sequence('R0010', 'ggctgca') +RBS_seq = Sequence('B0032', 'aattatataaa') +CDS_seq = Sequence('E0040', "atgtaa") +terminator_seq = Sequence('B0012', 'attcga') +gene_seq = Sequence('BB0001') + +doc.addSequence([promoter_seq, CDS_seq, RBS_seq, terminator_seq, gene_seq]) + +promoter.sequences = promoter_seq.identity +CDS.sequences = CDS_seq.identity +RBS.sequences = RBS_seq.identity +terminator.sequences = terminator_seq.identity +gene.sequences = gene_seq.identity + +gene_seq.assemble() + +print(promoter_seq.elements) +print(RBS_seq.elements) +print(CDS_seq.elements) +print(terminator_seq.elements) +print(gene_seq.elements) + +result = doc.write('gene_cassette.xml') +print(result) diff --git a/wrapper/unit_tests.py b/wrapper/unit_tests.py index ad151722..60606db0 100644 --- a/wrapper/unit_tests.py +++ b/wrapper/unit_tests.py @@ -1,5 +1,5 @@ import unittest -from sbol import * +from .libsbol import * import random import string import os, sys @@ -23,32 +23,32 @@ TEST_FILES_SBOL2 = [] for i in FILES_SBOL2: - if i.endswith('rdf'): - TEST_FILES_SBOL2.append(i) - if i.endswith('xml'): - TEST_FILES_SBOL2.append(i) + if i.endswith('rdf'): + TEST_FILES_SBOL2.append(i) + if i.endswith('xml'): + TEST_FILES_SBOL2.append(i) def random_string(limit=10): - length = random.randint(0, limit) - string = ''.join(random.choice(RANDOM_CHARS) for n in range(length)) - return string + length = random.randint(0, limit) + string = ''.join(random.choice(RANDOM_CHARS) for n in range(length)) + return string def random_uri(limit=10): - while True: - uri = random_string() - global URIS_USED - if not uri in URIS_USED: - URIS_USED.add(uri) - return uri + while True: + uri = random_string() + global URIS_USED + if not uri in URIS_USED: + URIS_USED.add(uri) + return uri def random_valid_position(limit=1000): - return random.randint(0, limit) + return random.randint(0, limit) def random_invalid_position(limit=1000): - position = 0 - while position == 0: - position = -1 * random_valid_position(limit) - return position + position = 0 + while position == 0: + position = -1 * random_valid_position(limit) + return position ############## # unit tests @@ -59,585 +59,868 @@ def random_invalid_position(limit=1000): #class TestWrite(unittest.TestCase): class TestRoundTripSBOL2(unittest.TestCase): - def setUp(self): - # Create temp directory - self.temp_out_dir = tempfile.mkdtemp() + def setUp(self): + # Create temp directory + self.temp_out_dir = tempfile.mkdtemp() - def tearDown(self): - # Remove directory after the test - shutil.rmtree(self.temp_out_dir) + def tearDown(self): + # Remove directory after the test + shutil.rmtree(self.temp_out_dir) - def run_round_trip(self, test_file): - print(str(test_file)) - split_path = os.path.splitext(test_file) - self.doc = Document() # Document for read and write - self.doc.read(os.path.join(TEST_LOC_SBOL2, split_path[0] + split_path[1])) - self.doc.write(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) + def run_round_trip(self, test_file): + print(str(test_file)) + split_path = os.path.splitext(test_file) + self.doc = Document() # Document for read and write + self.doc.read(os.path.join(TEST_LOC_SBOL2, split_path[0] + split_path[1])) + self.doc.write(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) - self.doc2 = Document() # Document to compare for equality - self.doc2.read(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) - self.assertEqual(self.doc.compare(self.doc2), 1) - - def test_case000(self): - self.run_round_trip(str(TEST_FILES_SBOL2[0])) + self.doc2 = Document() # Document to compare for equality + self.doc2.read(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) + self.assertEqual(self.doc.compare(self.doc2), 1) - def test_case001(self): - self.run_round_trip(str(TEST_FILES_SBOL2[1])) + def test_case000(self): + self.run_round_trip(str(TEST_FILES_SBOL2[0])) - def test_case002(self): - self.run_round_trip(str(TEST_FILES_SBOL2[2])) + def test_case001(self): + self.run_round_trip(str(TEST_FILES_SBOL2[1])) - def test_case003(self): - self.run_round_trip(str(TEST_FILES_SBOL2[3])) + def test_case002(self): + self.run_round_trip(str(TEST_FILES_SBOL2[2])) - def test_case005(self): - self.run_round_trip(str(TEST_FILES_SBOL2[5])) + def test_case003(self): + self.run_round_trip(str(TEST_FILES_SBOL2[3])) - def test_case006(self): - self.run_round_trip(str(TEST_FILES_SBOL2[6])) + def test_case004(self): + self.run_round_trip(str(TEST_FILES_SBOL2[4])) - def test_case007(self): - self.run_round_trip(str(TEST_FILES_SBOL2[7])) + def test_case005(self): + self.run_round_trip(str(TEST_FILES_SBOL2[5])) - def test_case008(self): - self.run_round_trip(str(TEST_FILES_SBOL2[8])) + def test_case006(self): + self.run_round_trip(str(TEST_FILES_SBOL2[6])) - def test_case009(self): - self.run_round_trip(str(TEST_FILES_SBOL2[9])) + def test_case007(self): + self.run_round_trip(str(TEST_FILES_SBOL2[7])) - def test_case010(self): - self.run_round_trip(str(TEST_FILES_SBOL2[10])) + def test_case008(self): + self.run_round_trip(str(TEST_FILES_SBOL2[8])) - def test_case011(self): - self.run_round_trip(str(TEST_FILES_SBOL2[11])) + def test_case009(self): + self.run_round_trip(str(TEST_FILES_SBOL2[9])) - def test_case012(self): - self.run_round_trip(str(TEST_FILES_SBOL2[12])) + def test_case010(self): + self.run_round_trip(str(TEST_FILES_SBOL2[10])) - def test_case013(self): - self.run_round_trip(str(TEST_FILES_SBOL2[13])) + def test_case011(self): + self.run_round_trip(str(TEST_FILES_SBOL2[11])) - def test_case014(self): - self.run_round_trip(str(TEST_FILES_SBOL2[14])) + def test_case012(self): + self.run_round_trip(str(TEST_FILES_SBOL2[12])) - def test_case015(self): - self.run_round_trip(str(TEST_FILES_SBOL2[15])) + def test_case013(self): + self.run_round_trip(str(TEST_FILES_SBOL2[13])) - def test_case016(self): - self.run_round_trip(str(TEST_FILES_SBOL2[16])) + def test_case014(self): + self.run_round_trip(str(TEST_FILES_SBOL2[14])) - def test_case017(self): - self.run_round_trip(str(TEST_FILES_SBOL2[17])) + def test_case015(self): + self.run_round_trip(str(TEST_FILES_SBOL2[15])) - def test_case018(self): - self.run_round_trip(str(TEST_FILES_SBOL2[18])) + def test_case016(self): + self.run_round_trip(str(TEST_FILES_SBOL2[16])) - def test_case019(self): - self.run_round_trip(str(TEST_FILES_SBOL2[19])) + def test_case017(self): + self.run_round_trip(str(TEST_FILES_SBOL2[17])) - def test_case020(self): - self.run_round_trip(str(TEST_FILES_SBOL2[20])) + def test_case018(self): + self.run_round_trip(str(TEST_FILES_SBOL2[18])) - def test_case021(self): - self.run_round_trip(str(TEST_FILES_SBOL2[21])) + def test_case019(self): + self.run_round_trip(str(TEST_FILES_SBOL2[19])) - def test_case023(self): - self.run_round_trip(str(TEST_FILES_SBOL2[23])) + def test_case020(self): + self.run_round_trip(str(TEST_FILES_SBOL2[20])) - def test_case024(self): - self.run_round_trip(str(TEST_FILES_SBOL2[24])) + def test_case021(self): + self.run_round_trip(str(TEST_FILES_SBOL2[21])) - def test_case025(self): - self.run_round_trip(str(TEST_FILES_SBOL2[25])) + def test_case022(self): + self.run_round_trip(str(TEST_FILES_SBOL2[22])) - def test_case026(self): - self.run_round_trip(str(TEST_FILES_SBOL2[26])) + def test_case023(self): + self.run_round_trip(str(TEST_FILES_SBOL2[23])) - def test_case027(self): - self.run_round_trip(str(TEST_FILES_SBOL2[27])) + def test_case024(self): + self.run_round_trip(str(TEST_FILES_SBOL2[24])) - def test_case028(self): - self.run_round_trip(str(TEST_FILES_SBOL2[28])) + def test_case025(self): + self.run_round_trip(str(TEST_FILES_SBOL2[25])) - def test_case029(self): - self.run_round_trip(str(TEST_FILES_SBOL2[29])) + def test_case026(self): + self.run_round_trip(str(TEST_FILES_SBOL2[26])) - def test_case030(self): - self.run_round_trip(str(TEST_FILES_SBOL2[30])) + def test_case027(self): + self.run_round_trip(str(TEST_FILES_SBOL2[27])) - def test_case031(self): - self.run_round_trip(str(TEST_FILES_SBOL2[31])) + def test_case028(self): + self.run_round_trip(str(TEST_FILES_SBOL2[28])) - def test_case032(self): - self.run_round_trip(str(TEST_FILES_SBOL2[32])) + def test_case029(self): + self.run_round_trip(str(TEST_FILES_SBOL2[29])) - def test_case033(self): - self.run_round_trip(str(TEST_FILES_SBOL2[33])) + def test_case030(self): + self.run_round_trip(str(TEST_FILES_SBOL2[30])) - def test_case034(self): - self.run_round_trip(str(TEST_FILES_SBOL2[34])) + def test_case031(self): + self.run_round_trip(str(TEST_FILES_SBOL2[31])) - def test_case035(self): - self.run_round_trip(str(TEST_FILES_SBOL2[35])) + def test_case032(self): + self.run_round_trip(str(TEST_FILES_SBOL2[32])) - def test_case036(self): - self.run_round_trip(str(TEST_FILES_SBOL2[36])) + def test_case033(self): + self.run_round_trip(str(TEST_FILES_SBOL2[33])) - def test_case037(self): - self.run_round_trip(str(TEST_FILES_SBOL2[37])) + def test_case034(self): + self.run_round_trip(str(TEST_FILES_SBOL2[34])) - def test_case038(self): - self.run_round_trip(str(TEST_FILES_SBOL2[38])) + def test_case035(self): + self.run_round_trip(str(TEST_FILES_SBOL2[35])) - def test_case039(self): - self.run_round_trip(str(TEST_FILES_SBOL2[39])) + def test_case036(self): + self.run_round_trip(str(TEST_FILES_SBOL2[36])) - def test_case040(self): - self.run_round_trip(str(TEST_FILES_SBOL2[40])) + def test_case037(self): + self.run_round_trip(str(TEST_FILES_SBOL2[37])) - def test_case041(self): - self.run_round_trip(str(TEST_FILES_SBOL2[41])) + def test_case038(self): + self.run_round_trip(str(TEST_FILES_SBOL2[38])) - def test_case042(self): - self.run_round_trip(str(TEST_FILES_SBOL2[42])) + def test_case039(self): + self.run_round_trip(str(TEST_FILES_SBOL2[39])) - def test_case043(self): - self.run_round_trip(str(TEST_FILES_SBOL2[43])) + def test_case040(self): + self.run_round_trip(str(TEST_FILES_SBOL2[40])) - def test_case044(self): - self.run_round_trip(str(TEST_FILES_SBOL2[44])) + def test_case041(self): + self.run_round_trip(str(TEST_FILES_SBOL2[41])) - def test_case045(self): - self.run_round_trip(str(TEST_FILES_SBOL2[45])) + def test_case042(self): + self.run_round_trip(str(TEST_FILES_SBOL2[42])) - def test_case046(self): - self.run_round_trip(str(TEST_FILES_SBOL2[46])) + def test_case043(self): + self.run_round_trip(str(TEST_FILES_SBOL2[43])) - def test_case047(self): - self.run_round_trip(str(TEST_FILES_SBOL2[47])) + def test_case044(self): + self.run_round_trip(str(TEST_FILES_SBOL2[44])) - def test_case048(self): - self.run_round_trip(str(TEST_FILES_SBOL2[48])) + def test_case045(self): + self.run_round_trip(str(TEST_FILES_SBOL2[45])) - def test_case049(self): - self.run_round_trip(str(TEST_FILES_SBOL2[49])) + def test_case046(self): + self.run_round_trip(str(TEST_FILES_SBOL2[46])) - def test_case050(self): - self.run_round_trip(str(TEST_FILES_SBOL2[50])) + def test_case047(self): + self.run_round_trip(str(TEST_FILES_SBOL2[47])) - def test_case051(self): - self.run_round_trip(str(TEST_FILES_SBOL2[51])) + def test_case048(self): + self.run_round_trip(str(TEST_FILES_SBOL2[48])) - def test_case052(self): - self.run_round_trip(str(TEST_FILES_SBOL2[52])) + def test_case049(self): + self.run_round_trip(str(TEST_FILES_SBOL2[49])) - def test_case053(self): - self.run_round_trip(str(TEST_FILES_SBOL2[53])) + def test_case050(self): + self.run_round_trip(str(TEST_FILES_SBOL2[50])) - def test_case054(self): - self.run_round_trip(str(TEST_FILES_SBOL2[54])) + def test_case051(self): + self.run_round_trip(str(TEST_FILES_SBOL2[51])) - def test_case055(self): - self.run_round_trip(str(TEST_FILES_SBOL2[55])) + def test_case052(self): + self.run_round_trip(str(TEST_FILES_SBOL2[52])) - def test_case056(self): - self.run_round_trip(str(TEST_FILES_SBOL2[56])) + def test_case053(self): + self.run_round_trip(str(TEST_FILES_SBOL2[53])) - def test_case057(self): - self.run_round_trip(str(TEST_FILES_SBOL2[57])) + def test_case054(self): + self.run_round_trip(str(TEST_FILES_SBOL2[54])) - def test_case058(self): - self.run_round_trip(str(TEST_FILES_SBOL2[58])) + def test_case055(self): + self.run_round_trip(str(TEST_FILES_SBOL2[55])) - def test_case059(self): - self.run_round_trip(str(TEST_FILES_SBOL2[59])) + def test_case056(self): + self.run_round_trip(str(TEST_FILES_SBOL2[56])) - def test_case060(self): - self.run_round_trip(str(TEST_FILES_SBOL2[60])) + def test_case057(self): + self.run_round_trip(str(TEST_FILES_SBOL2[57])) - def test_case061(self): - self.run_round_trip(str(TEST_FILES_SBOL2[61])) + def test_case058(self): + self.run_round_trip(str(TEST_FILES_SBOL2[58])) - def test_case062(self): - self.run_round_trip(str(TEST_FILES_SBOL2[62])) + def test_case059(self): + self.run_round_trip(str(TEST_FILES_SBOL2[59])) - def test_case063(self): - self.run_round_trip(str(TEST_FILES_SBOL2[63])) + def test_case060(self): + self.run_round_trip(str(TEST_FILES_SBOL2[60])) - def test_case064(self): - self.run_round_trip(str(TEST_FILES_SBOL2[64])) - - def test_case065(self): - self.run_round_trip(str(TEST_FILES_SBOL2[65])) + def test_case061(self): + self.run_round_trip(str(TEST_FILES_SBOL2[61])) - def test_case066(self): - self.run_round_trip(str(TEST_FILES_SBOL2[66])) - - def test_case067(self): - self.run_round_trip(str(TEST_FILES_SBOL2[67])) + def test_case062(self): + self.run_round_trip(str(TEST_FILES_SBOL2[62])) - def test_case068(self): - self.run_round_trip(str(TEST_FILES_SBOL2[68])) - - def test_case069(self): - self.run_round_trip(str(TEST_FILES_SBOL2[69])) + def test_case063(self): + self.run_round_trip(str(TEST_FILES_SBOL2[63])) - def test_case070(self): - self.run_round_trip(str(TEST_FILES_SBOL2[70])) - - def test_case071(self): - self.run_round_trip(str(TEST_FILES_SBOL2[71])) + def test_case064(self): + self.run_round_trip(str(TEST_FILES_SBOL2[64])) - def test_case072(self): - self.run_round_trip(str(TEST_FILES_SBOL2[72])) - - def test_case073(self): - self.run_round_trip(str(TEST_FILES_SBOL2[73])) + def test_case065(self): + self.run_round_trip(str(TEST_FILES_SBOL2[65])) - def test_case074(self): - self.run_round_trip(str(TEST_FILES_SBOL2[74])) + def test_case066(self): + self.run_round_trip(str(TEST_FILES_SBOL2[66])) - def test_case075(self): - self.run_round_trip(str(TEST_FILES_SBOL2[75])) + def test_case067(self): + self.run_round_trip(str(TEST_FILES_SBOL2[67])) - def test_case076(self): - self.run_round_trip(str(TEST_FILES_SBOL2[76])) + def test_case068(self): + self.run_round_trip(str(TEST_FILES_SBOL2[68])) - def test_case077(self): - self.run_round_trip(str(TEST_FILES_SBOL2[77])) + def test_case069(self): + self.run_round_trip(str(TEST_FILES_SBOL2[69])) - def test_case078(self): - self.run_round_trip(str(TEST_FILES_SBOL2[78])) + def test_case070(self): + self.run_round_trip(str(TEST_FILES_SBOL2[70])) - def test_case079(self): - self.run_round_trip(str(TEST_FILES_SBOL2[79])) + def test_case071(self): + self.run_round_trip(str(TEST_FILES_SBOL2[71])) - def test_case080(self): - self.run_round_trip(str(TEST_FILES_SBOL2[80])) + def test_case072(self): + self.run_round_trip(str(TEST_FILES_SBOL2[72])) - def test_case081(self): - self.run_round_trip(str(TEST_FILES_SBOL2[81])) + def test_case073(self): + self.run_round_trip(str(TEST_FILES_SBOL2[73])) - def test_case083(self): - self.run_round_trip(str(TEST_FILES_SBOL2[83])) + def test_case074(self): + self.run_round_trip(str(TEST_FILES_SBOL2[74])) - def test_case085(self): - self.run_round_trip(str(TEST_FILES_SBOL2[85])) + def test_case075(self): + self.run_round_trip(str(TEST_FILES_SBOL2[75])) - def test_case087(self): - self.run_round_trip(str(TEST_FILES_SBOL2[87])) + def test_case076(self): + self.run_round_trip(str(TEST_FILES_SBOL2[76])) - def test_case089(self): - self.run_round_trip(str(TEST_FILES_SBOL2[89])) + def test_case077(self): + self.run_round_trip(str(TEST_FILES_SBOL2[77])) - def test_case091(self): - self.run_round_trip(str(TEST_FILES_SBOL2[91])) + def test_case078(self): + self.run_round_trip(str(TEST_FILES_SBOL2[78])) - def test_case093(self): - self.run_round_trip(str(TEST_FILES_SBOL2[93])) + def test_case079(self): + self.run_round_trip(str(TEST_FILES_SBOL2[79])) - def test_case094(self): - self.run_round_trip(str(TEST_FILES_SBOL2[94])) + def test_case080(self): + self.run_round_trip(str(TEST_FILES_SBOL2[80])) - def test_case095(self): - self.run_round_trip(str(TEST_FILES_SBOL2[95])) + def test_case081(self): + self.run_round_trip(str(TEST_FILES_SBOL2[81])) - def test_case096(self): - self.run_round_trip(str(TEST_FILES_SBOL2[96])) + def test_case082(self): + self.run_round_trip(str(TEST_FILES_SBOL2[82])) - def test_case097(self): - self.run_round_trip(str(TEST_FILES_SBOL2[97])) + def test_case083(self): + self.run_round_trip(str(TEST_FILES_SBOL2[83])) - def test_case098(self): - self.run_round_trip(str(TEST_FILES_SBOL2[98])) + def test_case084(self): + self.run_round_trip(str(TEST_FILES_SBOL2[84])) - def test_case099(self): - self.run_round_trip(str(TEST_FILES_SBOL2[99])) + def test_case085(self): + self.run_round_trip(str(TEST_FILES_SBOL2[85])) - def test_case100(self): - self.run_round_trip(str(TEST_FILES_SBOL2[100])) + def test_case086(self): + self.run_round_trip(str(TEST_FILES_SBOL2[86])) - def test_case101(self): - self.run_round_trip(str(TEST_FILES_SBOL2[101])) + def test_case087(self): + self.run_round_trip(str(TEST_FILES_SBOL2[87])) - def test_case102(self): - self.run_round_trip(str(TEST_FILES_SBOL2[102])) + def test_case088(self): + self.run_round_trip(str(TEST_FILES_SBOL2[88])) - def test_case103(self): - self.run_round_trip(str(TEST_FILES_SBOL2[103])) + def test_case089(self): + self.run_round_trip(str(TEST_FILES_SBOL2[89])) - def test_case104(self): - self.run_round_trip(str(TEST_FILES_SBOL2[104])) + def test_case090(self): + self.run_round_trip(str(TEST_FILES_SBOL2[90])) - def test_case105(self): - self.run_round_trip(str(TEST_FILES_SBOL2[105])) + def test_case091(self): + self.run_round_trip(str(TEST_FILES_SBOL2[91])) - def test_case106(self): - self.run_round_trip(str(TEST_FILES_SBOL2[106])) + def test_case092(self): + self.run_round_trip(str(TEST_FILES_SBOL2[92])) - def test_case107(self): - self.run_round_trip(str(TEST_FILES_SBOL2[107])) + def test_case093(self): + self.run_round_trip(str(TEST_FILES_SBOL2[93])) - def test_case108(self): - self.run_round_trip(str(TEST_FILES_SBOL2[108])) + def test_case094(self): + self.run_round_trip(str(TEST_FILES_SBOL2[94])) - def test_case109(self): - self.run_round_trip(str(TEST_FILES_SBOL2[109])) + def test_case095(self): + self.run_round_trip(str(TEST_FILES_SBOL2[95])) - def test_case110(self): - self.run_round_trip(str(TEST_FILES_SBOL2[110])) + def test_case096(self): + self.run_round_trip(str(TEST_FILES_SBOL2[96])) - def test_case111(self): - self.run_round_trip(str(TEST_FILES_SBOL2[111])) + def test_case097(self): + self.run_round_trip(str(TEST_FILES_SBOL2[97])) + + def test_case098(self): + self.run_round_trip(str(TEST_FILES_SBOL2[98])) + + def test_case099(self): + self.run_round_trip(str(TEST_FILES_SBOL2[99])) + + def test_case100(self): + self.run_round_trip(str(TEST_FILES_SBOL2[100])) + + def test_case101(self): + self.run_round_trip(str(TEST_FILES_SBOL2[101])) + + def test_case102(self): + self.run_round_trip(str(TEST_FILES_SBOL2[102])) + + def test_case103(self): + self.run_round_trip(str(TEST_FILES_SBOL2[103])) + + def test_case104(self): + self.run_round_trip(str(TEST_FILES_SBOL2[104])) + + def test_case105(self): + self.run_round_trip(str(TEST_FILES_SBOL2[105])) + + def test_case106(self): + self.run_round_trip(str(TEST_FILES_SBOL2[106])) + + def test_case107(self): + self.run_round_trip(str(TEST_FILES_SBOL2[107])) + + def test_case108(self): + self.run_round_trip(str(TEST_FILES_SBOL2[108])) + + def test_case109(self): + self.run_round_trip(str(TEST_FILES_SBOL2[109])) + + def test_case110(self): + self.run_round_trip(str(TEST_FILES_SBOL2[110])) + + def test_case111(self): + self.run_round_trip(str(TEST_FILES_SBOL2[111])) + + def test_case112(self): + self.run_round_trip(str(TEST_FILES_SBOL2[112])) + + def test_case113(self): + self.run_round_trip(str(TEST_FILES_SBOL2[113])) - def test_case112(self): - self.run_round_trip(str(TEST_FILES_SBOL2[112])) - def test_case113(self): - self.run_round_trip(str(TEST_FILES_SBOL2[113])) - - class TestRoundTripFailSBOL2(unittest.TestCase): - def setUp(self): - # Create temp directory - self.temp_out_dir = tempfile.mkdtemp() - - def tearDown(self): - # Remove directory after the test - shutil.rmtree(self.temp_out_dir) - - def run_round_trip_assert_fail(self, test_file): - print(str(test_file)) - split_path = os.path.splitext(test_file) - self.doc = Document() # Document for read and write - self.doc.read(os.path.join(TEST_LOC_SBOL2, split_path[0] + split_path[1])) - self.doc.write(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) - - self.doc2 = Document() # Document to compare for equality - self.doc2.read(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) - # Expected to fail - self.assertRaises(AssertionError, lambda: self.assertEqual(self.doc.compare(self.doc2), 1)) - - def test_case04(self): - self.run_round_trip_assert_fail(str(TEST_FILES_SBOL2[4])) - -# Disabled because it raises RuntimeError -# def test_case22(self): -# self.run_round_trip_runtime_fail(str(TEST_FILES_SBOL2[22])) - - def test_case82(self): - self.run_round_trip_assert_fail(str(TEST_FILES_SBOL2[82])) - - def test_case84(self): - self.run_round_trip_assert_fail(str(TEST_FILES_SBOL2[84])) - - def test_case86(self): - self.run_round_trip_assert_fail(str(TEST_FILES_SBOL2[86])) - - def test_case88(self): - self.run_round_trip_assert_fail(str(TEST_FILES_SBOL2[88])) - - def test_case90(self): - self.run_round_trip_assert_fail(str(TEST_FILES_SBOL2[90])) - - def test_case92(self): - self.run_round_trip_assert_fail(str(TEST_FILES_SBOL2[92])) - - - + def setUp(self): + # Create temp directory + self.temp_out_dir = tempfile.mkdtemp() + + def tearDown(self): + # Remove directory after the test + shutil.rmtree(self.temp_out_dir) + + def run_round_trip_assert_fail(self, test_file): + print(str(test_file)) + split_path = os.path.splitext(test_file) + self.doc = Document() # Document for read and write + self.doc.read(os.path.join(TEST_LOC_SBOL2, split_path[0] + split_path[1])) + self.doc.write(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) + + self.doc2 = Document() # Document to compare for equality + self.doc2.read(os.path.join(self.temp_out_dir, split_path[0] + '_out' + split_path[1])) + # Expected to fail + self.assertRaises(AssertionError, lambda: self.assertEqual(self.doc.compare(self.doc2), 1)) + + + class TestComponentDefinitions(unittest.TestCase): - - def setUp(self): - pass - - def testAddComponentDefinition(self): - test_CD = ComponentDefinition("BB0001") - doc = Document() - doc.addComponentDefinition(test_CD) - self.assertIsNotNone(doc.componentDefinitions.get("BB0001")) - displayId = doc.componentDefinitions.get("BB0001").displayId - self.assertEqual(displayId, "BB0001") - - def testRemoveComponentDefinition(self): - test_CD = ComponentDefinition("BB0001") - doc = Document() - doc.addComponentDefinition(test_CD) - doc.componentDefinitions.remove(0) - self.assertRaises(RuntimeError, lambda: doc.componentDefinitions.get("BB0001")) - - def testCDDisplayId(self): - listCD_read = [] - doc = Document() - doc.read(os.path.join(MODULE_LOCATION, 'crispr_example.xml')) - - # List of displayIds - listCD = ['CRP_b', 'CRa_U6', 'EYFP', 'EYFP_cds', 'EYFP_gene', 'Gal4VP16', - 'Gal4VP16_cds', 'Gal4VP16_gene', 'cas9_gRNA_complex', 'cas9_generic', - 'cas9m_BFP', 'cas9m_BFP_cds', 'cas9m_BFP_gRNA_b', 'cas9m_BFP_gene', - 'gRNA_b', 'gRNA_b_gene', 'gRNA_b_nc', 'gRNA_b_terminator', - 'gRNA_generic', 'mKate', 'mKate_cds', 'mKate_gene', 'pConst', - 'target', 'target_gene'] - - for CD in doc.componentDefinitions: - listCD_read.append(CD.displayId) - - # Python 3 compatability - if sys.version_info[0] < 3: - self.assertItemsEqual(listCD_read, listCD) - else: - self.assertCountEqual(listCD_read, listCD) - - def testPrimarySequenceIteration(self): - listCD = [] - listCD_true = ["R0010", "E0040", "B0032", "B0012"] - doc = Document() - gene = ComponentDefinition("BB0001") - promoter = ComponentDefinition("R0010") - CDS = ComponentDefinition("B0032") - RBS = ComponentDefinition("E0040") - terminator = ComponentDefinition("B0012") - - doc.addComponentDefinition([gene, promoter, CDS, RBS, terminator]) - - gene.assemblePrimaryStructure([ promoter, RBS, CDS, terminator ]) - primary_sequence = gene.getPrimaryStructure() - for component in primary_sequence: - listCD.append(component.displayId) - - # Python 3 compatability - if sys.version_info[0] < 3: - self.assertItemsEqual(listCD, listCD_true) - else: - self.assertCountEqual(listCD, listCD_true) + def setUp(self): + pass + + def testAddComponentDefinition(self): + test_CD = ComponentDefinition("BB0001") + doc = Document() + doc.addComponentDefinition(test_CD) + self.assertIsNotNone(doc.componentDefinitions.get("BB0001")) + displayId = doc.componentDefinitions.get("BB0001").displayId + self.assertEqual(displayId, "BB0001") + + def testRemoveComponentDefinition(self): + test_CD = ComponentDefinition("BB0001") + doc = Document() + doc.addComponentDefinition(test_CD) + doc.componentDefinitions.remove(0) + self.assertRaises(RuntimeError, lambda: doc.componentDefinitions.get("BB0001")) + + def testCDDisplayId(self): + listCD_read = [] + doc = Document() + doc.read(os.path.join(MODULE_LOCATION, 'crispr_example.xml')) + + # List of displayIds + listCD = ['CRP_b', 'CRa_U6', 'EYFP', 'EYFP_cds', 'EYFP_gene', 'Gal4VP16', + 'Gal4VP16_cds', 'Gal4VP16_gene', 'cas9_gRNA_complex', 'cas9_generic', + 'cas9m_BFP', 'cas9m_BFP_cds', 'cas9m_BFP_gRNA_b', 'cas9m_BFP_gene', + 'gRNA_b', 'gRNA_b_gene', 'gRNA_b_nc', 'gRNA_b_terminator', + 'gRNA_generic', 'mKate', 'mKate_cds', 'mKate_gene', 'pConst', + 'target', 'target_gene'] + + for CD in doc.componentDefinitions: + listCD_read.append(CD.displayId) + + self.assertSequenceEqual(listCD_read, listCD) + # # Python 3 compatability + # if sys.version_info[0] < 3: + # self.assertItemsEqual(listCD_read, listCD) + # else: + # self.assertCountEqual(listCD_read, listCD) + + def testPrimaryStructureIteration(self): + listCD = [] + listCD_true = ["R0010", "E0040", "B0032", "B0012"] + doc = Document() + gene = ComponentDefinition("BB0001") + promoter = ComponentDefinition("R0010") + RBS = ComponentDefinition("B0032") + CDS = ComponentDefinition("E0040") + terminator = ComponentDefinition("B0012") + + doc.addComponentDefinition([gene, promoter, RBS, CDS, terminator]) + + gene.assemblePrimaryStructure([ promoter, RBS, CDS, terminator ]) + primary_sequence = gene.getPrimaryStructure() + for component in primary_sequence: + listCD.append(component.displayId) + + # Python 3 compatability + if sys.version_info[0] < 3: + self.assertItemsEqual(listCD, listCD_true) + else: + self.assertCountEqual(listCD, listCD_true) + +class TestAssemblyRoutines(unittest.TestCase): + + def setUp(self): + pass + + def testCompileSequence(self): + doc = Document() + Config.setOption('sbol_typed_uris', True) + gene = ComponentDefinition("BB0001") + promoter = ComponentDefinition("R0010") + CDS = ComponentDefinition("B0032") + RBS = ComponentDefinition("E0040") + terminator = ComponentDefinition("B0012") + scar = ComponentDefinition('scar') + + promoter.sequence = Sequence('R0010') + RBS.sequence = Sequence('B0032') + CDS.sequence = Sequence('E0040') + terminator.sequence = Sequence('B0012') + scar.sequence = Sequence('scar') + + promoter.sequence.elements = 'aaa' + RBS.sequence.elements = 'aaa' + CDS.sequence.elements = 'aaa' + terminator.sequence.elements = 'aaa' + scar.sequence.elements = 'ttt' + + doc.addComponentDefinition(gene) + gene.assemblePrimaryStructure([ promoter, scar, RBS, scar, CDS, scar, terminator ]) + target_seq = gene.compile() + + self.assertEquals(target_seq, 'aaatttaaatttaaatttaaa') + self.assertEquals(target_seq, gene.sequence.elements) + + def testRecursiveCompile(self): + doc = Document() + cd1 = ComponentDefinition('cd1') + cd2 = ComponentDefinition('cd2') + cd3 = ComponentDefinition('cd3') + cd4 = ComponentDefinition('cd4') + cd5 = ComponentDefinition('cd5') + cd1.sequence = Sequence('cd1') + cd2.sequence = Sequence('cd2') + cd3.sequence = Sequence('cd3') + cd4.sequence = Sequence('cd4') + cd5.sequence = Sequence('cd5') + cd1.sequence.elements = 'tt' + cd2.sequence.elements = 'gg' + cd3.sequence.elements = 'n' + cd4.sequence.elements = 'aa' + cd5.sequence.elements = 'n' + doc.addComponentDefinition([cd1, cd2, cd3, cd4, cd5]) + cd3.assemblePrimaryStructure([cd1, cd2]) + cd5.assemblePrimaryStructure([cd4, cd3]) + cd5.compile() + self.assertEquals(cd3.sequence.elements, 'ttgg') + self.assertEquals(cd5.sequence.elements, 'aattgg') + r1 = cd3.sequenceAnnotations['cd1_annotation_0'].locations['cd1_annotation_0_range'] + r2 = cd3.sequenceAnnotations['cd2_annotation_0'].locations['cd2_annotation_0_range'] + r4 = cd5.sequenceAnnotations['cd4_annotation_0'].locations['cd4_annotation_0_range'] + self.assertEquals(r1.start, 3) + self.assertEquals(r1.end, 4) + self.assertEquals(r2.start, 5) + self.assertEquals(r2.end, 6) + self.assertEquals(r4.start, 1) + self.assertEquals(r4.end, 2) + + def testStandardAssembly(self): + doc = Document() + gene = ComponentDefinition("BB0001") + promoter = ComponentDefinition("R0010") + RBS = ComponentDefinition("B0032") + CDS = ComponentDefinition("E0040") + terminator = ComponentDefinition("B0012") + + promoter.sequence = Sequence('R0010') + RBS.sequence = Sequence('B0032') + CDS.sequence = Sequence('E0040') + terminator.sequence = Sequence('B0012') + + promoter.sequence.elements = 'a' + RBS.sequence.elements = 't' + CDS.sequence.elements = 'c' + terminator.sequence.elements = 'g' + + promoter.roles = SO_PROMOTER + RBS.roles = SO_RBS + CDS.roles = SO_CDS + terminator.roles = SO_TERMINATOR + + doc.addComponentDefinition(gene) + gene.assemblePrimaryStructure([ promoter, RBS, CDS, terminator ], IGEM_STANDARD_ASSEMBLY) + target_seq = gene.compile() + + self.assertEquals(target_seq, 'atactagagttactagctactagagg') + + def testAssembleWithDisplayIds(self): + Config.setOption('sbol_typed_uris', True) + + doc = Document() + gene = ComponentDefinition("BB0001") + promoter = ComponentDefinition("R0010") + RBS = ComponentDefinition("B0032") + CDS = ComponentDefinition("E0040") + terminator = ComponentDefinition("B0012") + + promoter.sequence = Sequence('R0010') + RBS.sequence = Sequence('B0032') + CDS.sequence = Sequence('E0040') + terminator.sequence = Sequence('B0012') + + promoter.sequence.elements = 'a' + RBS.sequence.elements = 't' + CDS.sequence.elements = 'c' + terminator.sequence.elements = 'g' + + promoter.roles = SO_PROMOTER + RBS.roles = SO_RBS + CDS.roles = SO_CDS + terminator.roles = SO_TERMINATOR + + doc.addComponentDefinition([ gene, promoter, RBS, CDS, terminator ]) + gene.assemblePrimaryStructure([ 'R0010', 'B0032', 'E0040', 'B0012' ], IGEM_STANDARD_ASSEMBLY) + target_seq = gene.compile() + + self.assertEquals(target_seq, 'atactagagttactagctactagagg') + + def testApplyCallbackRecursively(self): + # Assemble module hierarchy + doc = Document() + root = ModuleDefinition('root') + sub = ModuleDefinition('sub') + leaf = ModuleDefinition('leaf') + doc.addModuleDefinition([root, sub, leaf]) + root.assemble([sub]) + sub.assemble([leaf]) + + # Define callback which performs an operation on the given ModuleDefinition + def callback(md, params): + level = params[0] + level += 1 + params[0] = level + + # Apply callback + level = 0 + params = [ level ] + flattened_module_tree = root.applyToModuleHierarchy(callback, params) + level = params[0] + flattened_module_tree = [md.identity for md in flattened_module_tree] + expected_module_tree = [md.identity for md in [root, sub, leaf]] + self.assertSequenceEqual(flattened_module_tree, expected_module_tree) + self.assertEquals(level, 3) class TestSequences(unittest.TestCase): - - def setUp(self): - pass - - def testAddSeqence(self): - test_seq = Sequence("R0010", "ggctgca") - doc = Document() - doc.addSequence(test_seq) - seq = doc.sequences.get("R0010").elements - - self.assertEqual(seq, 'ggctgca') - - def testRemoveSequence(self): - test_seq = Sequence("R0010", "ggctgca") - doc = Document() - doc.addSequence(test_seq) - doc.sequences.remove(0) - self.assertRaises(RuntimeError, lambda: doc.sequences.get("R0010")) - - def testSeqDisplayId(self): - listseq_read = [] - doc = Document() - doc.read(os.path.join(MODULE_LOCATION, 'crispr_example.xml')) - - # List of displayIds - listseq = ['CRP_b_seq', 'CRa_U6_seq', 'gRNA_b_seq', 'mKate_seq'] - - for seq in doc.sequences: - listseq_read.append(seq.displayId) - - # Python 3 compatability - if sys.version_info[0] < 3: - self.assertItemsEqual(listseq_read, listseq) - else: - self.assertCountEqual(listseq_read, listseq) - - def testSequenceElement(self): - setHomespace('http://sbols.org/CRISPR_Example') - Config.setOption('sbol_typed_uris', False) - doc = Document() - doc.read(os.path.join(MODULE_LOCATION, 'crispr_example.xml')) - # Sequence to test against - seq = ('GCTCCGAATTTCTCGACAGATCTCATGTGATTACGCCAAGCTACGGGCGGAGTACTGTCCTC' - 'CGAGCGGAGTACTGTCCTCCGAGCGGAGTACTGTCCTCCGAGCGGAGTACTGTCCTCCGAGC' - 'GGAGTTCTGTCCTCCGAGCGGAGACTCTAGATACCTCATCAGGAACATGTTGGAATTCTAGG' - 'CGTGTACGGTGGGAGGCCTATATAAGCAGAGCTCGTTTAGTGAACCGTCAGATCGCCTCGAG' - 'TACCTCATCAGGAACATGTTGGATCCAATTCGACC') - - seq_read = doc.sequences.get('CRP_b_seq').elements - self.assertEquals(seq_read, seq) - -#class TestPythonMethods(unittest.TestCase): - -# def testAnnotations(self): -# for n in range(NUM_SLOW_TESTS): -# self.assertEqual(len(self.testees[0].annotations), n) -# uri = random_uri() -# self.uris.append(uri) -# ann = sbol.SequenceAnnotation(self.doc, uri) -# self.assertFalse(ann in self.testees[0].annotations) -# self.testees[0].annotations += ann -# self.assertTrue(ann in self.testees[0].annotations) -# -#class TestCollection(TestSBOLCompoundObject): -# def createTestees(self): -# uri = random_uri() -# self.uris.append(uri) -# self.testees.append( sbol.Collection(self.doc, uri) ) -# -# def testComponents(self): -# col = self.testees[0] -# for n in range(NUM_SLOW_TESTS): -# self.assertEqual(len(col.components), n) -# uri = random_uri() -# self.uris.append(uri) -# com = sbol.DNAComponent(self.doc, uri) -# self.assertFalse(com in col.components) -# col.components += com -# self.assertTrue(com in col.components) -# self.assertEqual(len(col.components), n+1) + + def setUp(self): + pass + + def testAddSeqence(self): + test_seq = Sequence("R0010", "ggctgca") + doc = Document() + doc.addSequence(test_seq) + seq = doc.sequences.get("R0010").elements + + self.assertEqual(seq, 'ggctgca') + + def testRemoveSequence(self): + test_seq = Sequence("R0010", "ggctgca") + doc = Document() + doc.addSequence(test_seq) + doc.sequences.remove(0) + self.assertRaises(RuntimeError, lambda: doc.sequences.get("R0010")) + + def testSeqDisplayId(self): + listseq_read = [] + doc = Document() + doc.read(os.path.join(MODULE_LOCATION, 'crispr_example.xml')) + + # List of displayIds + listseq = ['CRP_b_seq', 'CRa_U6_seq', 'gRNA_b_seq', 'mKate_seq'] + + for seq in doc.sequences: + listseq_read.append(seq.displayId) + + # Python 3 compatability + if sys.version_info[0] < 3: + self.assertItemsEqual(listseq_read, listseq) + else: + self.assertCountEqual(listseq_read, listseq) + + def testSequenceElement(self): + setHomespace('http://sbols.org/CRISPR_Example') + Config.setOption('sbol_typed_uris', False) + doc = Document() + doc.read(os.path.join(MODULE_LOCATION, 'crispr_example.xml')) + # Sequence to test against + seq = ('GCTCCGAATTTCTCGACAGATCTCATGTGATTACGCCAAGCTACGGGCGGAGTACTGTCCTC' + 'CGAGCGGAGTACTGTCCTCCGAGCGGAGTACTGTCCTCCGAGCGGAGTACTGTCCTCCGAGC' + 'GGAGTTCTGTCCTCCGAGCGGAGACTCTAGATACCTCATCAGGAACATGTTGGAATTCTAGG' + 'CGTGTACGGTGGGAGGCCTATATAAGCAGAGCTCGTTTAGTGAACCGTCAGATCGCCTCGAG' + 'TACCTCATCAGGAACATGTTGGATCCAATTCGACC') + + seq_read = doc.sequences.get('CRP_b_seq').elements + self.assertEquals(seq_read, seq) class TestMemory(unittest.TestCase): - - def setUp(self): - pass - - def testDiscard(self): - doc = Document() - cd = ComponentDefinition() - bool1 = cd.thisown - doc.addComponentDefinition(cd) - bool2 = cd.thisown - self.assertNotEquals(bool1, bool2) + + def setUp(self): + pass + + def testDiscard(self): + doc = Document() + cd = ComponentDefinition() + bool1 = cd.thisown + doc.addComponentDefinition(cd) + bool2 = cd.thisown + self.assertNotEquals(bool1, bool2) + +class TestExtensionClass(unittest.TestCase): + + def testExtensionClass(self): + class ModuleDefinitionExtension(ModuleDefinition): + def __init__(self, id = 'example'): + ModuleDefinition.__init__(self, id) + self.x_coordinate = TextProperty(self.this, 'http://dnaplotlib.org#xCoordinate', '0', '1', '10') # Initialize property value to 10 + self.y_coordinate = IntProperty(self.this, 'http://dnaplotlib.org#yCoordinate', '0', '1', 10) # Initialize property value to 10 + + doc = Document() + doc.addNamespace('http://dnaplotlib.org#', 'dnaplotlib') + md = ModuleDefinitionExtension('md_example') + md_id = md.identity + md.y_coordinate = 5 + self.assertEquals(md.x_coordinate, '10') + self.assertEquals(md.y_coordinate, 5) + doc.addExtensionObject(md) + doc.readString(doc.writeString()) + md = doc.getExtensionObject(md_id) + self.assertEquals(md.x_coordinate, '10') + self.assertEquals(md.y_coordinate, 5) class TestIterators(unittest.TestCase): - def setUp(self): - pass - - def testOwnedObjectIterator(self): - cd = ComponentDefinition() - sa1 = cd.sequenceAnnotations.create('sa1').this - sa2 = cd.sequenceAnnotations.create('sa2').this - annotations = [] - for sa in cd.sequenceAnnotations: - annotations.append(sa.this) - self.assertEquals(annotations, [sa1, sa2]) - -# List of tests -default_test_list = [TestRoundTripSBOL2, TestComponentDefinitions, TestSequences, TestMemory, TestIterators] - -def runTests(test_list = default_test_list): - print("Setting up") - #exec(open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "CRISPR_example.py")).read()) - suite_list = [] - loader = unittest.TestLoader() - for test_class in test_list: - suite = loader.loadTestsFromTestCase(test_class) - suite_list.append(suite) - - full_test_suite = unittest.TestSuite(suite_list) - - unittest.TextTestRunner(verbosity=2,stream=sys.stderr).run(full_test_suite) - -if __name__ == '__main__': - runTests() + def setUp(self): + pass + + def testDocumentIterator(self): + doc = Document() + cds = [] + for i_cd in range(0, 10): + cd = doc.componentDefinitions.create('cd%d' %i_cd) + cds.append(cd.identity) + self.assertEquals(cd.displayId, 'cd%d' %i_cd) # Verify TopLevel properties are accessible + i_cd = 0 + for obj in doc: + cds.remove(obj.identity) + self.assertEquals([], cds) + + def testOwnedObjectIterator(self): + cd = ComponentDefinition() + sa1 = cd.sequenceAnnotations.create('sa1').this + sa2 = cd.sequenceAnnotations.create('sa2').this + annotations = [] + for sa in cd.sequenceAnnotations: + annotations.append(sa.this) + self.assertEquals(annotations, [sa1, sa2]) + +class TestCopy(unittest.TestCase): + + def setUp(self): + pass + + def testCloneObject(self): + cd = ComponentDefinition() + cd_copy = cd.copy() + self.assertEquals(cd.compare(cd_copy), 1) + + def testCopyAndIncrementVersion(self): + Config.setOption('sbol_typed_uris', False) + doc = Document() + comp = ComponentDefinition('foo', BIOPAX_DNA, '1.0.0') + doc.addComponentDefinition(comp) + + # Copy an object within a single Document, the version should be automatically incrememented + comp_copy = comp.copy() + self.assertEquals(comp.version, '1.0.0') + self.assertEquals(comp_copy.version, '2.0.0') + self.assertEquals(comp_copy.identity, comp.persistentIdentity + '/2.0.0') + self.assertEquals(comp_copy.wasDerivedFrom[0], comp.identity) + self.assertEquals(comp_copy.types[0], BIOPAX_DNA) + + def testCopyToNewDocument(self): + Config.setOption('sbol_typed_uris', False) + doc = Document() + comp1 = doc.componentDefinitions.create('cd1') + comp2 = doc.componentDefinitions.create('cd2') + comp2.wasDerivedFrom = comp1.identity + + # Clone the object to another Document, the wasDerivedFrom should not be a circular reference + doc2 = Document() + comp3 = comp2.copy(doc2) + self.assertEquals(comp3.wasDerivedFrom[0], comp1.identity) + self.assertNotEqual(comp3.wasDerivedFrom[0], comp2.identity) + + def testImportObjectIntoNewNamespace(self): + Config.setOption('sbol_typed_uris', False) + doc = Document() + doc2 = Document() + comp = doc.componentDefinitions.create('hi') + + # Import the object into a new namespace and update the version + homespace = getHomespace() + setHomespace('https://hub.sd2e.org/user/sd2e/test') + comp_copy = comp.copy(doc2, homespace, '2') # Import from old homespace into new homespace + self.assertEquals(comp_copy.identity, 'https://hub.sd2e.org/user/sd2e/test/hi/2') + setHomespace('http://examples.org') + + def testExtensionObjects(self): + class GenericTopLevel(TopLevel): + def __init__(self, id = 'example'): + TopLevel.__init__(self, 'http://extension_namespace.com#GenericTopLevel', id, '1.0.0') + + tl1 = GenericTopLevel() + doc = Document() + doc.addExtensionObject(tl1) + tl2 = doc.getExtensionObject(tl1.identity) + self.assertEquals(tl1.this, tl2.this) + + def testCopyExtensionObjects(self): + class GenericTopLevel(TopLevel): + def __init__(self, id = 'example'): + TopLevel.__init__(self, 'http://extension_namespace.com#GenericTopLevel', id, '1.0.0') + + tl = GenericTopLevel() + doc = Document() + doc.addExtensionObject(tl) + doc2 = doc.copy(getHomespace()) + tl = doc2.getExtensionObject(tl.identity) + self.assertEquals(tl.thisown, False) + +class TestDBTL(unittest.TestCase): + + def setUp(self): + pass + + def testDBTL(self): + setHomespace("http://examples.org") + + doc = Document() + workflow_step_1 = Activity('build_1') + workflow_step_2 = Activity('build_2') + workflow_step_3 = Activity('build_3') + workflow_step_4 = Activity('build_4') + workflow_step_5 = Activity('build_5') + workflow_step_6 = Activity('test_1') + workflow_step_7 = Activity('analysis_1') + + workflow_step_1.plan = Plan('PCR_protocol_part1') + workflow_step_2.plan = Plan('PCR_protocol_part2') + workflow_step_3.plan = Plan('PCR_protocol_part3') + workflow_step_4.plan = Plan('gibson_assembly') + workflow_step_5.plan = Plan('transformation') + workflow_step_6.plan = Plan('promoter_characterization') + workflow_step_7.plan = Plan('parameter_optimization') + + setHomespace('') + Config.setOption('sbol_compliant_uris', False) # Temporarily disable auto-construction of URIs + + workflow_step_1.agent = Agent('mailto:jdoe@sbols.org') + workflow_step_2.agent = workflow_step_1.agent + workflow_step_3.agent = workflow_step_1.agent + workflow_step_4.agent = workflow_step_1.agent + workflow_step_5.agent = workflow_step_1.agent + workflow_step_6.agent = Agent('http://sys-bio.org/plate_reader_1') + workflow_step_7.agent = Agent('http://tellurium.analogmachine.org') + + Config.setOption('sbol_compliant_uris', True) + setHomespace("http://examples.org") + + doc.addActivity([workflow_step_1, workflow_step_2, workflow_step_3, workflow_step_4, workflow_step_5, workflow_step_6, workflow_step_7]) + + doc.componentDefinitions.create('cd') + target = Design('target') + part1 = workflow_step_1.generateBuild('part1', target) + part2 = workflow_step_2.generateBuild('part2', target) + part3 = workflow_step_3.generateBuild('part3', target) + gibson_mix = workflow_step_4.generateBuild('gibson_mix', target, [part1, part2, part3]) + clones = workflow_step_5.generateBuild(['clone1', 'clone2', 'clone3'], target, gibson_mix) + experiment1 = workflow_step_6.generateTest('experiment1', clones) + analysis1 = workflow_step_7.generateAnalysis('analysis1', experiment1) + doc.readString(doc.writeString()) + + activity = doc.activities['build_1'] + self.assertEquals(activity.agent.identity, activity.associations[0].agent) + self.assertEquals(activity.plan.identity, activity.associations[0].plan) + + +def runTests(test_list = [TestComponentDefinitions, TestSequences, TestMemory, TestIterators, TestCopy, TestDBTL, TestAssemblyRoutines, TestExtensionClass ]): + #exec(open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "CRISPR_example.py")).read()) + suite_list = [] + loader = unittest.TestLoader() + for test_class in test_list: + suite = loader.loadTestsFromTestCase(test_class) + suite_list.append(suite) + + full_test_suite = unittest.TestSuite(suite_list) + + unittest.TextTestRunner(verbosity=2,stream=sys.stderr).run(full_test_suite) + +def runRoundTripTests(test_list = [TestRoundTripSBOL2, TestRoundTripFailSBOL2]): + runTests(test_list) - \ No newline at end of file +if __name__ == '__main__': + runTests()