CipherTech.CASE.Bindings 0.4.0

.NET Standard 2.0
dotnet add package CipherTech.CASE.Bindings --version 0.4.0
NuGet\Install-Package CipherTech.CASE.Bindings -Version 0.4.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CipherTech.CASE.Bindings" Version="0.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CipherTech.CASE.Bindings --version 0.4.0
#r "nuget: CipherTech.CASE.Bindings, 0.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CipherTech.CASE.Bindings as a Cake Addin
#addin nuget:?package=CipherTech.CASE.Bindings&version=0.4.0

// Install CipherTech.CASE.Bindings as a Cake Tool
#tool nuget:?package=CipherTech.CASE.Bindings&version=0.4.0

CASE Bindings for C#


Generated bindings for version 1.2.0 of the CASE Ontology.

These bindings are write-only: they support creating a CASE-compliant RDF graph from scratch, but not editing or inspecting existing graphs.

Using the bindings

The entry point to the bindings is the CT.CASE.Bindings.DataSet class.

var ds = new DataSet();

The DataSet class exposes a factory method for each owl:Class in the ontology schema. The first parameter on each method is the IRI of the resulting RDF subject; pass null to generate a blank node instead. The remaining parameters map to the properties on the Thing being created.

Optional properties (those with sh:maxCount "1"^^xsd:integer) have a nullable type and default to null, which is taken to mean "no value." Repeated properties (those with no sh:maxCount constraint) have type IEnumerable<T> and also default to null, which is taken as equivalent to the empty Enumerable. Required properties (sh:minCount "1"^^xsd:integer) have no default and must be supplied; a null argument here will throw a NullArgumentException. Given the sheer number of parameters available on most factory methods, it is highly recommended to use C#'s named arguments syntax for the property arguments:

// investigation:Authorization defines four properties:
//     core:endTime (type xsd:dateTime, max count 1)
//     core:startTime (type xsd:dateTime, max count 1)
//     investigation:authorizationType (type xsd:string, max count 1)
//     investigation:authorizationIdentifier (type xsd:string, no max count)
// and inherits ten more from core:UcoObject, including
//     core:description (type xsd:string, no max count)
Authorization auth = ds.CreateAuthorization(
    /* RDF identifier */ UriFactory.Create("http://data.example/00000000-0000-0000-0000-000000000000"),
    authorizationType: "documentation",
    authorizationIdentifier: new string[] { "00000000-0000-0000-0000-000000000000" },
    description: new string[] { "Created as an example." }

The returned object acts as a strongly-typed wrapper around the RDF node and can be passed to subsequent factory methods to link nodes together.

// action:Action defines many properties, including
//     action:result (type core:UcoObject, which investigation:Authorization is a subClassOf)
Action authAction = ds.CreateAction(null, result: new UcoObject[] { auth });

RDF primitive types -- those in the xsd: namespace -- map to C# types according to the following table.

RDF type C# type
xsd:anyURI System.Uri
xsd:boolean bool
xsd:byte sbyte
xsd:dateTime System.DateTime
xsd:decimal decimal
xsd:duration System.TimeSpan
xsd:hexBinary byte[]
xsd:base64binary byte[]
xsd:integer long
xsd:nonNegativeInteger NonNegativeInteger¹
xsd:positiveInteger PositiveInteger¹
xsd:string string
xsd:unsignedInt uint
xsd:unsignedShort ushort

¹ NonNegativeInteger and PositiveInteger are structs defined in this package as thin wrappers around System.Numeric.BigInteger with suitable bounds checks at runtime.

Open vocabularies map to classes with one public static readonly field per member defined in the schema. To create a nonstandard (xsd:string) value, use the public constructor.

// vocabulary:CharacterEncodingVocab is defined as (equivalent to either an xsd:string or) one of
//     "ASCII"^^vocabulary:CharacterEncodingVocab
//     "UTF-16"^^vocabulary:CharacterEncodingVocab
//     "UTF-32"^^vocabulary:CharacterEncodingVocab
//     "UTF-8"^^vocabulary:CharacterEncodingVocab
//     "Windows-1250"^^vocabulary:CharacterEncodingVocab
//     ...and so on...
CharacterEncodingVocab ascii = CharacterEncodingVocab.ASCII; // "ASCII"^^vocabulary:CharacterEncodingVocab
CharacterEncodingVocab custom = new CharacterEncodingVocab("Java-MUTF-8"); // "Java-MUTF-8"^^xsd:string

// The constructor doesn't check if you pass a lexical value that matches
// one of the well-known values. That is, this produces the literal node
// "ASCII"^^xsd:string, NOT "ASCII"^^vocabulary:CharacterEncodingVocab.
CharacterEncodingVocab likelyBug = new CharacterEncodingVocab("ASCII");

The generated graph is available through the Graph property on your DataSet and can be serialized using any of VDS.RDF's serialization mechanisms:

var rdfGraph = ds.Graph;
new VDS.RDF.Writing.CompressingTurtleWriter().Save(rdfGraph, myIoWriter);

Supported Versions

Bindings Version CASE Version .NET Version
0.1.0 1.0.0 Framework 4.7.2
0.2.0 1.0.0 Standard 2.0
0.3.0 1.1.0 Standard 2.0
0.4.0 (latest) 1.2.0 Standard 2.0

Known limitations

Properties with no declared target type are omitted from the bindings. As of CASE version 1.2.0, this only affects the following properties.

RDF class Property path
action:ActionLifecycle action:actionStatus
observable:WirelessNetworkConnectionFacet observable:wirelessNetworkSecurityMode

The Thread class is intentionally unconstructable in this version of the bindings. It maps to the RDF class types:Thread, which is not a bag of properties in the sense of the rest of the classes in the schema, but rather a subClassOf co:Bag with unique semantics.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.0 182 4/3/2023
0.3.0 224 2/7/2023
0.2.0 201 1/19/2023
0.1.0 209 10/31/2022