OSLC4Net is an SDK and sample applications that help the .NET community adopt Open Services for Lifecycle Collaboration (OSLC, homepage) and build OSLC-conformant tools.
The SDK allows developers to create OSLC servers and clients by adding OSLC annotations to .NET objects to represent them as OSLC resources. It includes a library based on the dotNetRDF package, which assists with representing these resources as RDF and helps parse Turle, RDF/XML, and JSON-LD documents into OSLC .NET objects.
The OSLC4Net.Client package
can be used to help create consumer REST requests. On the server side, the
project offers an RDF-specific MediaTypeFormatter
that can help process OSLC
REST requests within an ASP.NET MVC 5 API (ASP.NET Core 8 migration is
ongoing).
If you do not have a .NET development environment, start by downloading VS Code C# Dev Kit. Make sure to install .NET 8 SDK for development. Libraries target NETStandard 2.0/2.1 and should run on .NET 6 .
Create a new console application targeting .NET 6 , add a NuGet dependency to
OSLC4Net.Client
and add the following code:
var oslcClient = OslcClient.ForBasicAuth(username, password);
var resourceUri =
"https://jazz.net/sandbox01-ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1300";
OslcResponse<ChangeRequest> response = await oslcClient.GetResourceAsync<ChangeRequest>(resourceUri);
if (response.Resource is not null)
{
ChangeRequest wi1300 = response.Resource;
logger.LogInformation($"{wi1300.GetShortTitle()} {wi1300.GetTitle()}");
}
else
{
logger.LogError("Something went wrong: {} {}", (response.StatusCode as int?) ?? -1,
response.ResponseMessage?.ReasonPhrase);
}
Replace resourceUri
with a valid OSLC resource URI. This should give you a
valid response. See full example
project for more details.
Tip
Use https://github.com/oslc-op/refimpl to quickly run a few conformant OSLC servers.
Server parts of the SDK have not yet been migrated from .NET Framework to .NET 8 .
- See the OSLC site for more details on OSLC specifications and community activities.
- See the Eclipse Lyo site for information on OSLC SDKs and samples for other technologies.
OSLC4Net is licensed under the Eclipse Public License 1.0