IntoRdf 0.3.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package IntoRdf --version 0.3.3                
NuGet\Install-Package IntoRdf -Version 0.3.3                
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="IntoRdf" Version="0.3.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IntoRdf --version 0.3.3                
#r "nuget: IntoRdf, 0.3.3"                
#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 IntoRdf as a Cake Addin
#addin nuget:?package=IntoRdf&version=0.3.3

// Install IntoRdf as a Cake Tool
#tool nuget:?package=IntoRdf&version=0.3.3                

IntoRdf

IntoRdf is a NuGet package for transforming Excel (XLSX) files into RDF (Resource Description Framework) format. This package helps developers easily convert spreadsheet data into RDF triples using a simple and convenient API.

Features

Transform Excel (XLSX) files into Turtle or JSON-LD RDF formats. Easily define custom namespaces and predicates for RDF individuals. Supports various spreadsheet configurations, such as different sheet names, header rows, and data rows/columns.

Installation

Install the IntoRdf NuGet package using the following command:

dotnet install IntoRdf

Usage

To use IntoRdf, import the following namespaces:

using IntoRdf;
using IntoRdf.Models;

Create an instance of ITransformerService to transform spreadsheets into RDF:

ITransformerService transformerService = new TransformerService();

Then, create SpreadsheetDetails and TransformationDetails objects to define the input spreadsheet structure and the desired RDF output:

var spreadsheetDetails = new SpreadsheetDetails(sheetName: "Sheet1", headerRow: 1, dataStartRow: 2, startColumn: 1);

var transformationDetails = new TransformationDetails(
    baseUri: new Uri("http://example.com/"),
    predicateBaseUri: new Uri("http://example.com/predicates/"),
    IdentifierSegment: new TargetPathSegment("id", "identifier"),
    targetPathSegments: new List<TargetPathSegment> { new TargetPathSegment("name", "name") },
    outputFormat: RdfFormat.Turtle
);

Finally, call the TransformSpreadsheet method to perform the transformation:

using var stream = new MemoryStream(Encoding.UTF8.GetBytes(spreadsheetContent));
string rdfOutput = transformerService.TransformSpreadsheet(spreadsheetDetails, transformationDetails, stream);

API Reference

ITransformerService

TransformSpreadsheet(SpreadsheetDetails spreadsheetDetails, TransformationDetails transformationDetails, Stream content)

Transforms the input spreadsheet into RDF format based on the provided transformation details.

SpreadsheetDetails

SpreadsheetDetails(string sheetName, int headerRow, int dataStartRow, int startColumn) Constructor to create a new SpreadsheetDetails object.

  • sheetName: The name of the sheet containing the data in the input spreadsheet.
  • headerRow: The row number containing the column headers in the input spreadsheet (1-based index).
  • dataStartRow: The row number where the data starts in the input spreadsheet (1-based index).
  • startColumn: The column number where the data starts in the input spreadsheet (1-based index).

TransformationDetails

TransformationDetails(Uri baseUri, Uri predicateBaseUri, TargetPathSegment? IdentifierSegment, List<TargetPathSegment> targetPathSegments, RdfFormat outputFormat)

Constructor to create a new TransformationDetails object.

  • baseUri: The base URI for creating RDF individuals.
  • predicateBaseUri: The base URI for creating RDF predicates.
  • IdentifierSegment: An optional TargetPathSegment for the identifier of RDF individuals. If specified, the subjects for the resulting RDF triples will be created using baseUri + segment + value in the cell gotten from the column matching target. If not specified, the subjects will be created using baseUri + a GUID.
  • targetPathSegments: A list of TargetPathSegment objects to define the RDF individuals' properties.
  • outputFormat: The desired RDF format for the output (Turtle, Trig, or JSON-LD).

TargetPathSegment

TargetPathSegment(string target, string segment)

Constructor to create a new TargetPathSegment object.

  • target: The property name of the literal to turn into an RDF individual. When transforming a spreadsheet, this will refer to a column name.
  • segment: The URI segment to append to the base URI, enabling the creation of specific namespaces for different individuals.

RdfFormat

Enum with the following values: Turtle, Trig, Jsonld

Changelog

For a detailed list of changes in each version, please refer to the CHANGELOG file.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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
2.1.6 461 10/23/2024
2.1.5 76 10/23/2024
2.1.2 747 8/30/2024
2.0.9 858 8/7/2024
2.0.8 107 8/7/2024
2.0.7 103 8/7/2024
2.0.6 125 8/7/2024
2.0.5 100 8/7/2024
2.0.4 110 8/7/2024
2.0.3 741 7/11/2024
2.0.2 88 6/18/2024
2.0.1 589 6/3/2024
2.0.0 2,505 4/30/2024
1.1.4 401 4/15/2024
1.1.4-prerelease 107 4/15/2024
1.1.3 436 4/3/2024
1.1.2 542 3/18/2024
1.1.1 129 3/15/2024
1.1.0 1,600 1/18/2024
1.0.0 1,090 11/23/2023
0.3.6 124 10/11/2023
0.3.4 4,401 6/26/2023
0.3.3 153 5/11/2023
0.3.2 135 5/8/2023
0.3.1 1,456 5/2/2023
0.3.0 164 4/14/2023
0.2.1 172 4/12/2023
0.2.0 762 3/30/2023
0.1.0 213 3/29/2023
0.0.1 206 3/23/2023

# Changelog

## [0.3.3](https://github.com/equinor/into-rdf/compare/v0.3.2...v0.3.3) (2023-05-10)


### Bug Fixes

* trailing slash bug ([#57](https://github.com/equinor/into-rdf/issues/57)) ([54c3ae1](https://github.com/equinor/into-rdf/commit/54c3ae188c0e40e52a604335d4e4fa7be329be4d))

## [0.3.2](https://github.com/equinor/into-rdf/compare/v0.3.1...v0.3.2) (2023-05-04)


### Bug Fixes

* selecting correct data rows ([#55](https://github.com/equinor/into-rdf/issues/55)) ([f3f2d7c](https://github.com/equinor/into-rdf/commit/f3f2d7cbab1544614675a85b71be621dd2ecc9e7))

## [0.3.1](https://github.com/equinor/into-rdf/compare/v0.3.0...v0.3.1) (2023-05-02)


### Bug Fixes

* remove BOM at the start of jsonld ([#53](https://github.com/equinor/into-rdf/issues/53)) ([97da9dd](https://github.com/equinor/into-rdf/commit/97da9dd97cdbd04db45ffb851bc1285ccbbad453))

## [0.3.0](https://github.com/equinor/into-rdf/compare/v0.2.1...v0.3.0) (2023-04-14)


### ⚠ BREAKING CHANGES

* Functions that where previously part of the interface is now removed

### Miscellaneous Chores

* remove ontology and record from interface ([#50](https://github.com/equinor/into-rdf/issues/50)) ([0f98076](https://github.com/equinor/into-rdf/commit/0f9807603fe72f9b13fdc9b1ce7354c9d5fb6632))

## [0.2.1](https://github.com/equinor/into-rdf/compare/v0.2.0...v0.2.1) (2023-04-12)


### Features

* add support for csv ([#42](https://github.com/equinor/into-rdf/issues/42)) ([c532398](https://github.com/equinor/into-rdf/commit/c5323982fd01ca56e662bd2c12b017780ad2ebac))
* Make end-column optional ([#41](https://github.com/equinor/into-rdf/issues/41)) ([e7fe5c3](https://github.com/equinor/into-rdf/commit/e7fe5c36883eda31ce85196e67b5ac9cc025a686))

## [0.2.0](https://github.com/equinor/into-rdf/compare/v0.1.0...v0.2.0) (2023-03-30)


### ⚠ BREAKING CHANGES

* ns IntoRdf.Public -> IntoRdf ([#38](https://github.com/equinor/into-rdf/issues/38))

### Features

* ns IntoRdf.Public -&gt; IntoRdf ([#38](https://github.com/equinor/into-rdf/issues/38)) ([a1eeb32](https://github.com/equinor/into-rdf/commit/a1eeb321e5b47e44b281cffc8a9c888e86305586))

## 0.1.0 (2023-03-29)


### Features

* add cli and fix lowhanging fruits ([#7](https://github.com/equinor/into-rdf/issues/7)) ([cd0eeee](https://github.com/equinor/into-rdf/commit/cd0eeeee0a5ec43ae4e60e965dfbd58c49f8557a))
* Add public endpoint ([#4](https://github.com/equinor/into-rdf/issues/4)) ([26d91f2](https://github.com/equinor/into-rdf/commit/26d91f21ff27c71a9012e322d898777203b57db1))
* do proper escaping of all URLs ([#13](https://github.com/equinor/into-rdf/issues/13)) ([ca23794](https://github.com/equinor/into-rdf/commit/ca23794fd8b650044026c0cf992e93c29df5e127))
* Split spreadsheet and transformation details ([#6](https://github.com/equinor/into-rdf/issues/6)) ([9812645](https://github.com/equinor/into-rdf/commit/98126457c0ffaeefdeecf5f452ac35a42aa92caf))


### Bug Fixes

* correct handling of empty cells ([#19](https://github.com/equinor/into-rdf/issues/19)) ([4941f24](https://github.com/equinor/into-rdf/commit/4941f24f66a2e66144cf1017defd059fa92da318))
* make into rdf compile ([#2](https://github.com/equinor/into-rdf/issues/2)) ([312f4c4](https://github.com/equinor/into-rdf/commit/312f4c4b8d224a2e22db5de042186067337c4efc))