The Object-Relational Mapping

The centre of VyPR’s analysis library is its Object-Relational Mapping. This is a set of classes that map to objects stored by VyPR during program monitoring.

The ORM provides two levels: factory functions and classes. Factory functions can generate one or more instances of classes depending on whether the inputs given to them identify multiple objects in the database.

All factory functions and classes are accessible via the top-level VyPRAnalysis package. For example, you can write

import VyPRAnalysis as va
va.set_server("http://localhost:8080/")
prop = va.property(hash="...")

Factory Functions

Classes for things VyPR measures

VyPRAnalysis.orm.base_classes.function(id=None, fully_qualified_name=None)

Factory function for either getting a single function, or a list of functions, depending on the input.

VyPRAnalysis.orm.base_classes.function_call(id)

Factory function for function calls. The only way this needs to be used is with the ID of the function call. Otherwise, methods on other ORM objects can be used.

VyPRAnalysis.orm.base_classes.property(hash, serialised_structure=None, index_in_specification_file=None)

Factory function for either getting a single property property, or a list, depending on the input.

VyPRAnalysis.orm.base_classes.binding(id=None, binding_space_index=None, function=None, binding_statement_lines=None, property_hash=None)

Factory function for getting either a single binding object, or a list, depending on input.

VyPRAnalysis.orm.base_classes.test_data(id=None, test_name=None, test_result=None, start_time=None, end_time=None)

Factory function for test data rows.

VyPRAnalysis.orm.base_classes.verdict(id=None, binding=None, verdict=None, time_obtained=None, function_call=None, collapsing_atom=None, collapsing_atom_sub_index=None)

Factory function for verdicts. Gives a single Verdict object or a list, depending on input.

VyPRAnalysis.orm.base_classes.transaction(id=None, time_of_transaction=None, time_lower_bound=None, time_upper_bound=None)

Factory function for transactions. Returns a single object or a list depending on the input.

VyPRAnalysis.orm.base_classes.observation(id, instrumentation_point=None, verdict=None, observed_value=None, observation_time=None, observation_end_time=None, atom_index=None, sub_index=None, previous_condition_offset=None)

Factory function for observations.

Classes

Classes for things VyPR measures

class VyPRAnalysis.orm.base_classes.Function(id, fully_qualified_name)

Class for functions. Each monitored function generates its own instance.

get_bindings()

Get the list of Binding objects belonging to this function, regardless of their property.

get_calls()

Get a list of calls for the current function.

get_properties()

Get the list of Property objects for properties that were monitored over the current function.

get_scfg()

Construct the Symbolic Control-Flow Graph of the current function.

class VyPRAnalysis.orm.base_classes.FunctionCall(id, function, time_of_call, end_time_of_call, trans, path_condition_id_sequence)

Class for function calls. Each distinct call of a monitored function generates an instance.

get_observations()

Get the list of observations generated during the current function call.

get_verdicts(value=None, property=None)

Get a list of verdicts generated during the current function call. Value can be 1 or 0.

If value is given, verdicts will only have that value.
Property can either be a property ID or object.
If property is given, verdicts will be associated with that property.
reconstruct_path(scfg)

Locally reconstruct the entire path taken by this function call (if there was path instrumentation).

class VyPRAnalysis.orm.base_classes.Property(hash, serialised_structure=None, index_in_specification_file=None)

Class for properties. Each distinct property used to query the monitored program generates an instance.

class VyPRAnalysis.orm.base_classes.Binding(id, binding_space_index, function, binding_statement_lines, property_hash)

A class for bindings. Each binding recognised by instrumentation generates an instance.

get_verdicts()

Get a list of all verdicts attached to the current binding.

class VyPRAnalysis.orm.base_classes.TestData(id, test_name, test_result, start_time, end_time)

Class for test data instances. Each distinct test case execution, in the testing scenario, generates a distinct instance.

get_function_calls()

Get the list of FunctionCall objects representing function calls during this test case execution.

class VyPRAnalysis.orm.base_classes.Verdict(id, binding=None, verdict=None, time_obtained=None, function_call=None, collapsing_atom=None, collapsing_atom_sub_index=None)

Class for verdicts. Each True or False result generated by monitoring at runtime has an instance.

get_observations()

Get a list of the observations that were needed to obtain the current verdict.

class VyPRAnalysis.orm.base_classes.Transaction(id=None, time_of_transaction=None, time_lower_bound=None, time_upper_bound=None)

Class for transactions. For web services, transactions are HTTP requests. For normal programs, transactions are program runs. For testing, transactions are test class instances generated.

get_calls()

Get a list of all function calls that occurred during the current transaction.

class VyPRAnalysis.orm.base_classes.Observation(id, instrumentation_point=None, verdict=None, observed_value=None, observation_time=None, observation_end_time=None, atom_index=None, sub_index=None, previous_condition_offset=None)

Class for observations. Every measurement made by VyPR to decide whether the property defined by a query is True or False generates an instance.

get_instrumentation_point()

Get the point in the monitored program that generates the current observation.

reconstruct_reaching_path(scfg)

Reconstruct the sequence of edges to reach this observation through the Symbolic Control-Flow Graph given.