IntoRdf 2.1.6
dotnet add package IntoRdf --version 2.1.6
NuGet\Install-Package IntoRdf -Version 2.1.6
<PackageReference Include="IntoRdf" Version="2.1.6" />
paket add IntoRdf --version 2.1.6
#r "nuget: IntoRdf, 2.1.6"
// Install IntoRdf as a Cake Addin #addin nuget:?package=IntoRdf&version=2.1.6 // Install IntoRdf as a Cake Tool #tool nuget:?package=IntoRdf&version=2.1.6
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- DocumentFormat.OpenXml (>= 3.1.1)
- dotnetRDF (>= 3.3.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
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 | 735 | 10/23/2024 |
2.1.5 | 81 | 10/23/2024 |
2.1.2 | 752 | 8/30/2024 |
2.0.9 | 863 | 8/7/2024 |
2.0.8 | 111 | 8/7/2024 |
2.0.7 | 109 | 8/7/2024 |
2.0.6 | 130 | 8/7/2024 |
2.0.5 | 104 | 8/7/2024 |
2.0.4 | 114 | 8/7/2024 |
2.0.3 | 745 | 7/11/2024 |
2.0.2 | 92 | 6/18/2024 |
2.0.1 | 594 | 6/3/2024 |
2.0.0 | 2,511 | 4/30/2024 |
1.1.4 | 408 | 4/15/2024 |
1.1.4-prerelease | 110 | 4/15/2024 |
1.1.3 | 441 | 4/3/2024 |
1.1.2 | 545 | 3/18/2024 |
1.1.1 | 134 | 3/15/2024 |
1.1.0 | 1,605 | 1/18/2024 |
1.0.0 | 1,093 | 11/23/2023 |
0.3.6 | 131 | 10/11/2023 |
0.3.4 | 4,406 | 6/26/2023 |
0.3.3 | 157 | 5/11/2023 |
0.3.2 | 140 | 5/8/2023 |
0.3.1 | 1,461 | 5/2/2023 |
0.3.0 | 169 | 4/14/2023 |
0.2.1 | 177 | 4/12/2023 |
0.2.0 | 767 | 3/30/2023 |
0.1.0 | 218 | 3/29/2023 |
0.0.1 | 210 | 3/23/2023 |
# Changelog
## [0.4.5](https://github.com/equinor/into-rdf/compare/v0.4.4...v0.4.5) (2024-03-18)
### Other
* **deps:** bump DocumentFormat.OpenXml from 3.0.1 to 3.0.2 ([#125](https://github.com/equinor/into-rdf/issues/125)) ([f5cf260](https://github.com/equinor/into-rdf/commit/f5cf260e32a2ec1f7a9a16b8488cbf467cb46010))
## [0.4.4](https://github.com/equinor/into-rdf/compare/v0.4.3...v0.4.4) (2024-03-15)
### Other
* added introdcuedby checker action ([#117](https://github.com/equinor/into-rdf/issues/117)) ([85f8d5e](https://github.com/equinor/into-rdf/commit/85f8d5e69b360aec32a340f27bf12836c7476a0c))
* **deps:** bump coverlet.collector from 6.0.0 to 6.0.2 ([#122](https://github.com/equinor/into-rdf/issues/122)) ([e1a6395](https://github.com/equinor/into-rdf/commit/e1a63952f0f8f2649929f33d25414af0b8c1af3a))
* **deps:** bump DocumentFormat.OpenXml from 2.20.0 to 3.0.1 ([#110](https://github.com/equinor/into-rdf/issues/110)) ([bc6e104](https://github.com/equinor/into-rdf/commit/bc6e1041984c1f7746e54d2f6e635dc76f5aed00))
* **deps:** bump Microsoft.Extensions.DependencyInjection from 7.0.0 to 8.0.0 ([#105](https://github.com/equinor/into-rdf/issues/105)) ([b1bf620](https://github.com/equinor/into-rdf/commit/b1bf620d8aa924d8d75e14c3ea8e99563224639a))
* **deps:** bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.9.0 ([#119](https://github.com/equinor/into-rdf/issues/119)) ([04aa218](https://github.com/equinor/into-rdf/commit/04aa2180148b855cc6da62b71e00397985e918ef))
* **deps:** bump Spectre.Console.Cli from 0.47.0 to 0.48.0 ([#106](https://github.com/equinor/into-rdf/issues/106)) ([e398d3e](https://github.com/equinor/into-rdf/commit/e398d3e77ccf70b4edb8e85dcf80de7f31689770))
* **deps:** bump xunit from 2.6.6 to 2.7.0 ([#123](https://github.com/equinor/into-rdf/issues/123)) ([7ba4898](https://github.com/equinor/into-rdf/commit/7ba48988d2f2feca58534f6eb84e9b99b778ad52))
* **deps:** bump xunit.runner.console from 2.6.6 to 2.7.0 ([#121](https://github.com/equinor/into-rdf/issues/121)) ([ab3ce4e](https://github.com/equinor/into-rdf/commit/ab3ce4e3492bdcae815217d1167aafebc48e7963))
* **deps:** bump xunit.runner.visualstudio from 2.5.6 to 2.5.7 ([#120](https://github.com/equinor/into-rdf/issues/120)) ([3d2baf6](https://github.com/equinor/into-rdf/commit/3d2baf6c44e2a53090fba953f7f7a57f097f5231))
## [0.4.3](https://github.com/equinor/into-rdf/compare/v0.4.2...v0.4.3) (2024-01-18)
### Other
* **deps:** bump xunit from 2.5.1 to 2.6.6 ([#113](https://github.com/equinor/into-rdf/issues/113)) ([7cbdf4f](https://github.com/equinor/into-rdf/commit/7cbdf4f3be4b8ae674dcd574617e53106174918e))
## [0.4.2](https://github.com/equinor/into-rdf/compare/v0.4.1...v0.4.2) (2024-01-18)
### Other
* **deps:** bump Spectre.Console from 0.47.0 to 0.48.0 ([#104](https://github.com/equinor/into-rdf/issues/104)) ([d24587b](https://github.com/equinor/into-rdf/commit/d24587bab45f55ec960bd229c769196e09234a76))
* **deps:** bump xunit.runner.console from 2.5.1 to 2.6.6 ([#114](https://github.com/equinor/into-rdf/issues/114)) ([07b0f52](https://github.com/equinor/into-rdf/commit/07b0f521b25c7221ac26d891c21187d58d6fff07))
* **deps:** bump xunit.runner.visualstudio from 2.5.1 to 2.5.6 ([#109](https://github.com/equinor/into-rdf/issues/109)) ([6f70c52](https://github.com/equinor/into-rdf/commit/6f70c52cc626c40ac489e84440a84a4e483140d5))
## [1.0.0](https://github.com/equinor/into-rdf/compare/v0.4.0...v0.4.1) (2023-11-23)
### Other
* trigger release please ([#102](https://github.com/equinor/into-rdf/issues/102)) ([978868b](https://github.com/equinor/into-rdf/commit/978868b5d866e9c44b06dd6070d9ba9113675fe0))
## [1.0.0](https://github.com/equinor/into-rdf/compare/v0.3.7...v0.4.0) (2023-11-22)
### Features
* Validation intoRDF ([#99](https://github.com/equinor/into-rdf/issues/99)) ([4c8c063](https://github.com/equinor/into-rdf/commit/4c8c0637a726c4183ac2942cf3c33b27f450b755))
## [0.3.7](https://github.com/equinor/into-rdf/compare/v0.3.6...v0.3.7) (2023-11-21)
### Documentation
* Initial handover document ([#71](https://github.com/equinor/into-rdf/issues/71)) ([a3b9507](https://github.com/equinor/into-rdf/commit/a3b950720d9803513097aa80fa71c9ec967412e1))
## [0.3.6](https://github.com/equinor/into-rdf/compare/v0.3.5...v0.3.6) (2023-10-11)
### Other
* Upgrade githb action setup dotnet to v3 ([#78](https://github.com/equinor/into-rdf/issues/78)) ([a10902e](https://github.com/equinor/into-rdf/commit/a10902ed9fbd2adebe5151441cfb18b402b7f2c7))
## [0.3.5](https://github.com/equinor/into-rdf/compare/v0.3.4...v0.3.5) (2023-10-11)
### Other
* fix indentation ([#76](https://github.com/equinor/into-rdf/issues/76)) ([e29bfca](https://github.com/equinor/into-rdf/commit/e29bfca81775f49454364855c6595dcda19c1eb7))
* Remove sync csproj step ([#74](https://github.com/equinor/into-rdf/issues/74)) ([707efc0](https://github.com/equinor/into-rdf/commit/707efc0318ee54b91f4e48a6bd21f75d69c82fde))
* small change to trigger release please ([#73](https://github.com/equinor/into-rdf/issues/73)) ([09b3b13](https://github.com/equinor/into-rdf/commit/09b3b13499734fedc040b782df8753311461f58e))
* Upgraded available nuget packages ([#72](https://github.com/equinor/into-rdf/issues/72)) ([c635635](https://github.com/equinor/into-rdf/commit/c63563596f58e21672bd3e611f20a4d7575f4d05))
### CI/CD
* Update release please ([#75](https://github.com/equinor/into-rdf/issues/75)) ([f37cc23](https://github.com/equinor/into-rdf/commit/f37cc23ee734b24d9720225511f59151a78bc748))
## [0.3.4](https://github.com/equinor/into-rdf/compare/v0.3.3...v0.3.4) (2023-06-26)
### Bug Fixes
* add option to custom escape certain chars ([#66](https://github.com/equinor/into-rdf/issues/66)) ([ac6c523](https://github.com/equinor/into-rdf/commit/ac6c52348fd839d8b301d00c1949186c39d3f223))
## [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 -> 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))