Header menu logo arc-validate

ARCExpect

Introduction

ARCExpect offers easy to use and understand APIs to create and execute validation cases. The main intention of this library is offering a framework for validation of ControlledVocabulary tokens in Research Data management (RDM) based on testing principles from the world of software development:

User-facing APIs:

Additional APIs:

Creating a validation case

ARCExpect offers a validationCase Computation expression that enables the creation of validation cases in a very concise and readable way.

Suppose you have a metadata token that annotates the value 42 with the term "Thing" from the "Some Ontology" ontology (meaning this token represents "42 Things").

open ControlledVocabulary

let testParam = 
    CvParam(
        CvTerm.create("SO:000001","Thing","Some Ontology"),
        ParamValue.Value 42
    )

Use the validationCase CE to creater a validation case, and use the Validate API to specify the validation step:

let myValidationCase = 
    validationCase (TestID.Name "has value 42") {
        testParam |> Validate.Param.ValueIsEqualTo 42
    }

this will create a validation case that checks if the value of the given token is 42.

Let's take a closer look at some API specifics: The Validate API is designed to be very close to natural language.

Validate.Param.ValueIsEqualTo 42 means:

"validate (for a) Param (that its) value is equal to 42".

Where Param is any type that implements the IParam interface from ControlledVocabulary - an interface that can be used to represent a value annotated with some controlled vocabulary.

Performing validation

Use the Execute API to perform the validation, obtaining a summary object

let validationResults = Execute.Validation(myValidationCase)

validationResults.results
|> List.head
|> snd

{ result = Passed\n count = 1\n meanDuration = 0.0\n maxDuration = 0.0 }
result
Passed
tag
Passed
order
1
isPassed
Passed
isIgnored
Passed
isFailed
Passed
isException
False
count
1
meanDuration
0
maxDuration
0
duration00:00:00

Creating validation badges

Use the BadgeCreation API to create badges that visualize the validation results.

let myBadge = 
    validationResults 
    |> BadgeCreation.ofTestResults(
        labelText = "My validation"
    )

My validation My validation 1/1 1/1

You can also use Execute.BadgeCreation to write directly to a file:

validationResults 
|> Execute.BadgeCreation(
    path = "some/path/here.svg",
    labelText = "My validation"
)

Exporting JUnit XML

Use the Execute.JUnitSummaryCreation API to export the validation results as a junit xml file.

validationResults
|> Execute.JUnitSummaryCreation(
    path = "some/path/here.xml"
)

Performing a ValidationPipeline

use the Execute.ValidationPipeline API to perform a validation pipeline consisting of these steps:

myValidationCase
|> Execute.ValidationPipeline(
    jUnitPath = "some/path/here.xml",
    badgePath = "some/path/here.svg",
    labelText = "My validation"
)
namespace ControlledVocabulary
val testParam: CvParam
Multiple items
type CvParam = inherit CvAttributeCollection interface IParam new: cvAccession: string * cvName: string * cvRef: string * paramValue: ParamValue * attributes: IDictionary<string,IParam> -> CvParam + 6 overloads member Equals: term: CvTerm -> bool + 2 overloads override ToString: unit -> string member WithValue: v: ParamValue -> CvParam static member equals: cvp1: CvParam -> cvp2: CvParam -> bool static member equalsName: cvp1: CvParam -> cvp2: CvParam -> bool static member equalsTerm: term: CvTerm -> cvp: CvParam -> bool static member fromCategory: category: CvTerm -> term: CvTerm -> CvParam ...
<summary> Represents a structured value, annotated with a controlled vocabulary term Attributes can be used to further describe the CvParam </summary>

--------------------
new: cvTerm: CvTerm * pv: ParamValue -> CvParam
new: cvTerm: CvTerm * v: System.IConvertible -> CvParam
new: term: CvTerm * pv: ParamValue * attributes: IParam seq -> CvParam
new: id: string * name: string * ref: string * pv: ParamValue -> CvParam
new: id: string * name: string * ref: string * v: System.IConvertible -> CvParam
new: cvAccession: string * cvName: string * cvRef: string * paramValue: ParamValue * attributes: System.Collections.Generic.IDictionary<string,IParam> -> CvParam
new: id: string * name: string * ref: string * pv: ParamValue * attributes: IParam seq -> CvParam
type CvTerm = { Accession: string Name: string RefUri: string } static member create: accession: string * name: string * ref: string -> CvTerm + 1 overload
<summary> Represents a term from a controlled vocabulary (Cv) in the form of: id|accession ; name|value ; refUri </summary>
static member CvTerm.create: name: string -> CvTerm
static member CvTerm.create: accession: string * name: string * ref: string -> CvTerm
type ParamValue = | Value of v: IConvertible | CvValue of cv: CvTerm | WithCvUnitAccession of cvu: IConvertible * CvUnit static member getValue: param: ParamValue -> IConvertible static member getValueAsInt: param: ParamValue -> int static member getValueAsString: param: ParamValue -> string static member getValueAsTerm: param: ParamValue -> CvTerm static member tryAddAccession: accession: string -> param: ParamValue -> ParamValue option static member tryAddName: name: string -> param: ParamValue -> ParamValue option static member tryAddReference: ref: string -> param: ParamValue -> ParamValue option static member tryAddUnit: unit: CvUnit -> param: ParamValue -> ParamValue option static member tryGetUnit: param: ParamValue -> CvUnit option
<summary> Represent the different cases of a parameter, which is either a simple value, a CvTerm or a simple value with CvUnit </summary>
union case ParamValue.Value: v: System.IConvertible -> ParamValue
val myValidationCase: obj
val validationResults: obj
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...
val head: list: 'T list -> 'T
val snd: tuple: ('T1 * 'T2) -> 'T2
val myBadge: obj

Type something to start searching.