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.
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+.
See under OSLC4Net_SDK/Examples/OSLC4NetExamples.Server.NetCoreApi for an example of a ASP.NET Core 8+ API that showcases support for
- OSLC Root Services document under
/.well-known
path - OSLC Service Provider Catalog
- OSLC Service Provider
Create a new console application targeting .NET 8+, add a NuGet dependency to
OSLC4Net.Client
and add the following code:
var oslcClient = OslcClient.ForBasicAuth(username, password, loggerFactory.CreateLogger<OslcClient>());
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.Resources?.SingleOrDefault() is not null)
{
var changeRequestResource = response.Resources.Single();
logger.LogInformation(
"{shortTitle} {title}", changeRequestResource.GetShortTitle(),
changeRequestResource.GetTitle());
}
else
{
var responseStatusCode = response.StatusCode is null ? -1 : (int)response.StatusCode;
logger.LogError("Something went wrong: {} {}", responseStatusCode,
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.
We welcome contributions! Please see our CONTRIBUTING.md file for details on how to contribute.
OSLC4Net is licensed under the Eclipse Public License 1.0
- Steve Pitschke (IBM) did the majority of the initial implementation in 2012-2013.