CipherTech.CASE.Bindings 0.3.0

.NET Standard 2.0
dotnet add package CipherTech.CASE.Bindings --version 0.3.0
NuGet\Install-Package CipherTech.CASE.Bindings -Version 0.3.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.3.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.3.0
#r "nuget: CipherTech.CASE.Bindings, 0.3.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.3.0

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

CASE Bindings for C#


Generated bindings for version 1.1.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 (latest) 1.1.0 Standard 2.0

Known limitations

Properties with no declared target type are omitted from the bindings. As of CASE version 1.1.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 Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
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.3.0 179 2/7/2023
0.2.0 161 1/19/2023
0.1.0 172 10/31/2022