Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Hotfix/2087-efNet6
  • Hotfix/2365-targetClassWorks
  • Hotfix/2452-linkedDeletion
  • Hotfix/2459-EncodingPath
  • Hotfix/2562-organizations
  • Issue/1792-newMetadataStructure
  • Issue/1910-MigrationtoNET6.0
  • Issue/1953-owlImports
  • Issue/2269-niceKpiParser
  • Issue/2295-singleOrganizationFix
  • Issue/2309-docs
  • Issue/2328-noFailOnLog
  • Issue/2353-dropShapeFix
  • Issue/2462-removeTraces
  • Issue/2464-invalidateMeta
  • Issue/2484-filterExtracted
  • Issue/2583-treeBug
  • Issues/0028-maxQuotaFix
  • Product/1094-fasterQuery
  • Product/1287-dotnet5Sharepoint
  • Product/1414-fhPrivileges
  • Product/1549-speedupQuerying
  • Product/407-net5migration
  • Product/704-basicReporting
  • Sprint/2020-20
  • Sprint/2020-21
  • Sprint/2021-01
  • Sprint/2021-03
  • Sprint/2021-08
  • Sprint/2021-12
  • Sprint/2021-19
  • Sprint/2021-20
  • Sprint/2022-01
  • Topic/1051-basicReporting
  • Topic/1165-fasterQuery
  • Topic/1226-metadataLibraryMigration
  • Topic/1334-dotnet5migration
  • Topic/1425-fhPrivileges
  • Topic/1598-speedupQuerying
  • dev
  • gitkeep
  • master
  • v2.5.2-Hotfix2365
  • v1.0.0
  • v1.0.1
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.2.0
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.4.0
  • v1.5.0
  • v1.6.0
  • v2.0.0
  • v2.1.0
  • v2.2.0
  • v2.3.0
  • v2.4.0
  • v2.4.1
  • v2.5.0
  • v2.5.1
  • v2.5.2
  • v2.5.3
  • v2.6.0
  • v2.6.1
  • v2.6.2
  • v2.7.0
  • v2.7.1
  • v2.7.2
  • v2.8.0
  • v2.8.1
  • v2.8.2
  • v2.9.0
75 results

Target

Select target project
  • coscine/backend/libraries/metadata
1 result
Select Git revision
  • Hotfix/2087-efNet6
  • Hotfix/2365-targetClassWorks
  • Hotfix/2452-linkedDeletion
  • Hotfix/2459-EncodingPath
  • Hotfix/2562-organizations
  • Issue/1792-newMetadataStructure
  • Issue/1910-MigrationtoNET6.0
  • Issue/1953-owlImports
  • Issue/2269-niceKpiParser
  • Issue/2295-singleOrganizationFix
  • Issue/2309-docs
  • Issue/2328-noFailOnLog
  • Issue/2353-dropShapeFix
  • Issue/2462-removeTraces
  • Issue/2464-invalidateMeta
  • Issue/2484-filterExtracted
  • Issue/2583-treeBug
  • Issues/0028-maxQuotaFix
  • Product/1094-fasterQuery
  • Product/1287-dotnet5Sharepoint
  • Product/1414-fhPrivileges
  • Product/1549-speedupQuerying
  • Product/407-net5migration
  • Product/704-basicReporting
  • Sprint/2020-20
  • Sprint/2020-21
  • Sprint/2021-01
  • Sprint/2021-03
  • Sprint/2021-08
  • Sprint/2021-12
  • Sprint/2021-19
  • Sprint/2021-20
  • Sprint/2022-01
  • Topic/1051-basicReporting
  • Topic/1165-fasterQuery
  • Topic/1226-metadataLibraryMigration
  • Topic/1334-dotnet5migration
  • Topic/1425-fhPrivileges
  • Topic/1598-speedupQuerying
  • dev
  • gitkeep
  • master
  • v2.5.2-Hotfix2365
  • v1.0.0
  • v1.0.1
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.2.0
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.4.0
  • v1.5.0
  • v1.6.0
  • v2.0.0
  • v2.1.0
  • v2.2.0
  • v2.3.0
  • v2.4.0
  • v2.4.1
  • v2.5.0
  • v2.5.1
  • v2.5.2
  • v2.5.3
  • v2.6.0
  • v2.6.1
  • v2.6.2
  • v2.7.0
  • v2.7.1
  • v2.7.2
  • v2.8.0
  • v2.8.1
  • v2.8.2
  • v2.9.0
75 results
Show changes
Commits on Source (6)
# Metadata Library
## Metadata Library
Includes a simple wrapper and helper functions for Virtuoso, using dotNetRdf.
[[_TOC_]]
## 📝 Overview
The Metadata library for .NET simplifies metadata interactions within Coscine by providing a simple wrapper and helper functions for Virtuoso using `dotNetRdf`, allowing for easier management of metadata and reducing the amount of boilerplate code required to perform metadata-related tasks.
## ⚙️ Configuration
To install this library, you can use the NuGet package manager or you can install it using the .NET CLI.
```powershell
Install-Package Coscine.Metadata
```
or using the .NET CLI
```powershell
dotnet add package Coscine.Metadata
```
## 📖 Usage
For examples on how we use this library, look into the source code of the following open-source [Coscine APIs](https://git.rwth-aachen.de/coscine/backend/apis) found in our public GitLab repository:
- `Resources`
... and others.
## 👥 Contributing
As an open source plattform and project, we welcome contributions from our community in any form. You can do so by submitting bug reports or feature requests, or by directly contributing to Coscine's source code. To submit your contribution please follow our [Contributing Guideline](https://git.rwth-aachen.de/coscine/docs/public/wiki/-/blob/master/Contributing%20To%20Coscine.md).
## 📄 License
The current open source repository is licensed under the **MIT License**, which is a permissive license that allows the software to be used, modified, and distributed for both commercial and non-commercial purposes, with limited restrictions (see `LICENSE` file)
> The MIT License allows for free use, modification, and distribution of the software and its associated documentation, subject to certain conditions. The license requires that the copyright notice and permission notice be included in all copies or substantial portions of the software. The software is provided "as is" without any warranties, and the authors or copyright holders cannot be held liable for any damages or other liability arising from its use.
## 🆘 Support
1. **Check the documentation**: Before reaching out for support, check the help pages provided by the team at https://docs.coscine.de/en/. This may have the information you need to solve the issue.
2. **Contact the team**: If the documentation does not help you or if you have a specific question, you can reach out to our support team at `servicedesk@itc.rwth-aachen.de` 📧. Provide a detailed description of the issue you're facing, including any error messages or screenshots if applicable.
3. **Be patient**: Our team will do their best to provide you with the support you need, but keep in mind that they may have a lot of requests to handle. Be patient and wait for their response.
4. **Provide feedback**: If the support provided by our support team helps you solve the issue, let us know! This will help us improve our documentation and support processes for future users.
By following these simple steps, you can get the support you need to use Coscine's services as an external user.
## 📦 Release & Changelog
External users can find the _Releases and Changelog_ inside each project's repository. The repository contains a section for Releases (`Deployments > Releases`), where users can find the latest release changelog and source. Withing the Changelog you can find a list of all the changes made in that particular release and version.
By regularly checking for new releases and changes in the Changelog, you can stay up-to-date with the latest improvements and bug fixes by our team and community!
\ No newline at end of file
......@@ -45,13 +45,12 @@ namespace Coscine.Metadata.Tests
public void TestValidation()
{
string metadata = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\r\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\r\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.\r\n\r\n<https://hdl.handle.net/11148/865c34ff-0b34-49ce-a3cb-9e63026e540d@path=%2Findex.ttl> <http://purl.obolibrary.org/obo/NCIT_C12801> \"Heart\";\r\n <http://purl.obolibrary.org/obo/NCIT_C25219> \"wer\";\r\n <http://purl.obolibrary.org/obo/NCIT_C42790> \"awt\";\r\n <http://purl.obolibrary.org/obo/NCIT_C45293> \"Human\";\r\n <http://purl.obolibrary.org/obo/NCIT_C48163> \"FFPE\";\r\n <http://purl.obolibrary.org/obo/NCIT_C80225> \"eweraerawrawerawerwearawerwaerawerawerer\";\r\n <http://purl.obolibrary.org/obo/SCDO_0002829> \"awt\";\r\n <http://purl.org/dc/terms/created> \"2023-01-18\"^^xsd:date;\r\n <http://purl.org/dc/terms/creator> \"Benedikt Heinrichs\";\r\n a <https://purl.org/coscine/ap/kuppelab/merfish/>;\r\n <https://purl.org/coscine/terms/4978e908-8918-4022-aed6-f295a5d6a2d8/> \"wer\".\r\n";
Uri graphNameUri = new Uri("https://hdl.handle.net/11148/865c34ff-0b34-49ce-a3cb-9e63026e540d@path=%2Findex.ttl");
Uri graphNameUri = new("https://hdl.handle.net/11148/865c34ff-0b34-49ce-a3cb-9e63026e540d@path=%2Findex.ttl");
var graph = _rdfStoreConnector.ParseGraph(metadata, new TurtleParser());
graph.BaseUri = new Uri("https://hdl.handle.net/11148/865c34ff-0b34-49ce-a3cb-9e63026e540d@path=%2Findex.ttl");
Assert.IsTrue(_rdfStoreConnector.ValidateShacl(graph, graphNameUri, new Uri("https://purl.org/coscine/ap/kuppelab/merfish/1669378490042/")));
}
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<RootNamespace>Coscine.Metadata.Tests</RootNamespace>
<AssemblyName>Coscine.Metadata.Tests</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
<Version>2.6.2</Version></PropertyGroup>
<Version>2.7.0</Version></PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Metadata\Metadata.csproj" />
</ItemGroup>
......
......@@ -36,7 +36,7 @@ namespace Coscine.Metadata
/// <summary>
/// How many items can be retrieved at a time from the metadata store
/// </summary>
public int QUERY_LIMIT { get; private set; } = 1000;
public int QUERY_LIMIT { get; } = 1000;
/// <summary>
/// Default base constructur
......@@ -502,7 +502,7 @@ namespace Coscine.Metadata
{
Policy
.Handle<Exception>()
.WaitAndRetry(5, retryNumber => TimeSpan.FromMilliseconds(200))
.WaitAndRetry(5, _ => TimeSpan.FromMilliseconds(200))
.Execute(() => action.Invoke());
}
......@@ -516,7 +516,7 @@ namespace Coscine.Metadata
{
return Policy
.Handle<Exception>()
.WaitAndRetry(5, retryNumber => TimeSpan.FromMilliseconds(200))
.WaitAndRetry(5, _ => TimeSpan.FromMilliseconds(200))
.ExecuteAndCapture(() => function.Invoke()).Result;
}
......@@ -528,6 +528,5 @@ namespace Coscine.Metadata
ReadWriteSparqlConnector.Dispose();
GC.SuppressFinalize(this);
}
}
}
......@@ -11,19 +11,6 @@ namespace Coscine.Metadata
public class CoscineLDPHelper
{
private readonly MetadataRdfStoreConnector _rdfStoreConnector;
private readonly string _prefix;
/// <summary>
/// Obsolete since handle prefix will be removed at some point
/// </summary>
/// <param name="rdfStoreConnector"></param>
/// <param name="prefix">Handle Prefix</param>
[Obsolete]
public CoscineLDPHelper(MetadataRdfStoreConnector rdfStoreConnector, string prefix)
{
_rdfStoreConnector = rdfStoreConnector;
_prefix = prefix;
}
/// <summary>
/// Default Constructor
......@@ -32,8 +19,6 @@ namespace Coscine.Metadata
public CoscineLDPHelper(MetadataRdfStoreConnector rdfStoreConnector)
{
_rdfStoreConnector = rdfStoreConnector;
// Remove, when the obsolete constructor is removed
_prefix = "21.11102";
}
/// <summary>
......@@ -103,7 +88,7 @@ namespace Coscine.Metadata
path = "/" + path;
}
var searchString = $"{resourceId}{path}";
var searchString = resourceId + path;
var currentId = givenIds?.FirstOrDefault((givenId) => givenId.Contains(searchString));
if (currentId == null)
{
......@@ -119,7 +104,7 @@ namespace Coscine.Metadata
if (currentId == null && retrieve)
{
return GenerateOldId(resourceId, path, type);
return GenerateId(resourceId, path, type);
}
else if (currentId == null || storing)
{
......@@ -130,28 +115,5 @@ namespace Coscine.Metadata
return new CustomUri(currentId);
}
}
/// <summary>
/// Generates Id
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path">Path to file</param>
/// <param name="type">data or metadata</param>
/// <returns> Uri </returns>
public Uri GenerateOldId(string resourceId, string path, string type = "metadata")
{
if (!path.StartsWith("/"))
{
path = "/" + path;
}
var uriString = $"https://hdl.handle.net/{_prefix}/{resourceId}@path={Uri.EscapeDataString(path)}";
if (type == "data")
{
uriString += "&data";
}
return new CustomUri(uriString);
}
}
}
......@@ -4,7 +4,7 @@
<RootNamespace>Coscine.Metadata</RootNamespace>
<AssemblyName>Coscine.Metadata</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
<Version>2.6.2</Version>
<Version>2.7.0</Version>
</PropertyGroup>
<PropertyGroup>
<Authors>RWTH Aachen University</Authors>
......
......@@ -25,7 +25,7 @@ namespace Coscine.Metadata.Models
private List<string> AdaptExternalIds(IEnumerable<ExternalId> externalIds)
{
List<string> adaptedIds = new List<string>();
List<string> adaptedIds = new();
var externalAuthenticatorModel = new ExternalAuthenticatorModel();
var orcid = externalAuthenticatorModel.GetWhere((exAuth) => exAuth.DisplayName == "ORCiD");
......@@ -170,7 +170,6 @@ namespace Coscine.Metadata.Models
{
graph.Retract(membershipLink);
}
}
public IEnumerable<Triple> GetTriplesByPredicate(IGraph graph, Uri predicate)
......
......@@ -308,7 +308,6 @@ namespace Coscine.Metadata
return triples;
}
private string PrepareIncludeString(List<string> externalIds)
{
var res = "";
......@@ -544,6 +543,5 @@ namespace Coscine.Metadata
return defaultResourceQuotaModels;
}
}
}
\ No newline at end of file
......@@ -13,7 +13,6 @@ namespace Coscine.Metadata.Util
/// <param name="uri"></param>
public CustomUri(string uri) : base(uri)
{
}
/// <summary>
......
......@@ -345,5 +345,4 @@ public class MetadataGraphsCreator
}
}
}
}
\ No newline at end of file
......@@ -9,57 +9,57 @@ namespace Coscine.Metadata.Util
{
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public static readonly Uri OrgPrefix = new Uri("http://www.w3.org/ns/org#");
public static readonly Uri FoafPrefix = new Uri("http://xmlns.com/foaf/0.1/");
public static readonly Uri OrgPrefix = new("http://www.w3.org/ns/org#");
public static readonly Uri FoafPrefix = new("http://xmlns.com/foaf/0.1/");
public static readonly Uri A = new Uri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
public static readonly Uri A = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
// Coscine
public static readonly Uri CoscineLinkedBody = new Uri("https://purl.org/coscine/terms/linked#body");
public static readonly Uri CoscineMetadataTrackerAgent = new Uri("https://purl.org/coscine/terms/metadatatracker#Agent");
public static readonly Uri CoscineUserAgent = new Uri("https://purl.org/coscine/terms/user#Agent");
public static readonly Uri CoscineResourcePrefix = new Uri("https://purl.org/coscine/resources");
public static readonly Uri CoscineMetadataExtractionVersion = new Uri("https://purl.org/coscine/terms/metatadataextraction#version");
public static readonly Uri CoscineLinkedBody = new("https://purl.org/coscine/terms/linked#body");
public static readonly Uri CoscineMetadataTrackerAgent = new("https://purl.org/coscine/terms/metadatatracker#Agent");
public static readonly Uri CoscineUserAgent = new("https://purl.org/coscine/terms/user#Agent");
public static readonly Uri CoscineResourcePrefix = new("https://purl.org/coscine/resources");
public static readonly Uri CoscineMetadataExtractionVersion = new("https://purl.org/coscine/terms/metatadataextraction#version");
// Dcat
public static readonly Uri DcatCatalog = new Uri("http://www.w3.org/ns/dcat#catalog");
public static readonly Uri DcatCatalogClass = new Uri("http://www.w3.org/ns/dcat#Catalog");
public static readonly Uri DcatDataset = new Uri("http://www.w3.org/ns/dcat#dataset");
public static readonly Uri DcatDatasetClass = new Uri("http://www.w3.org/ns/dcat#Dataset");
public static readonly Uri DcatDistribution = new Uri("http://www.w3.org/ns/dcat#distribution");
public static readonly Uri DcatCatalog = new("http://www.w3.org/ns/dcat#catalog");
public static readonly Uri DcatCatalogClass = new("http://www.w3.org/ns/dcat#Catalog");
public static readonly Uri DcatDataset = new("http://www.w3.org/ns/dcat#dataset");
public static readonly Uri DcatDatasetClass = new("http://www.w3.org/ns/dcat#Dataset");
public static readonly Uri DcatDistribution = new("http://www.w3.org/ns/dcat#distribution");
// Dcterms
public static readonly Uri DctermsIdentifier = new Uri("http://purl.org/dc/terms/identifier");
public static readonly Uri DctermsIsPartOf = new Uri("http://purl.org/dc/terms/isPartOf");
public static readonly Uri DctermsModified = new Uri("http://purl.org/dc/terms/modified");
public static readonly Uri DctermsIdentifier = new("http://purl.org/dc/terms/identifier");
public static readonly Uri DctermsIsPartOf = new("http://purl.org/dc/terms/isPartOf");
public static readonly Uri DctermsModified = new("http://purl.org/dc/terms/modified");
// Ebucore
public static readonly Uri EbocoreHashFunction = new Uri("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashFunction");
public static readonly Uri EbocoreHashType = new Uri("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashType");
public static readonly Uri EbocoreHashValue = new Uri("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashValue");
public static readonly Uri EbocoreHashFunction = new("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashFunction");
public static readonly Uri EbocoreHashType = new("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashType");
public static readonly Uri EbocoreHashValue = new("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashValue");
// FDP
public static readonly Uri FdpMetadataService = new Uri("http://purl.org/fdp/fdp-o#MetadataService");
public static readonly Uri FdpHasMetadata = new Uri("http://purl.org/fdp/fdp-o#hasMetadata");
public static readonly Uri FdpIsMetadataOf = new Uri("http://purl.org/fdp/fdp-o#isMetadataOf");
public static readonly Uri FdpMetadataService = new("http://purl.org/fdp/fdp-o#MetadataService");
public static readonly Uri FdpHasMetadata = new("http://purl.org/fdp/fdp-o#hasMetadata");
public static readonly Uri FdpIsMetadataOf = new("http://purl.org/fdp/fdp-o#isMetadataOf");
// LDP
public static readonly Uri LdpBasicContainer = new Uri("http://www.w3.org/ns/ldp#BasicContainer");
public static readonly Uri LdpNonRDFSource = new Uri("http://www.w3.org/ns/ldp#NonRDFSource");
public static readonly Uri LdpRDFSource = new Uri("http://www.w3.org/ns/ldp#RDFSource");
public static readonly Uri LdpDescribedBy = new Uri("http://www.w3.org/ns/ldp#describedBy");
public static readonly Uri LdpBasicContainer = new("http://www.w3.org/ns/ldp#BasicContainer");
public static readonly Uri LdpNonRDFSource = new("http://www.w3.org/ns/ldp#NonRDFSource");
public static readonly Uri LdpRDFSource = new("http://www.w3.org/ns/ldp#RDFSource");
public static readonly Uri LdpDescribedBy = new("http://www.w3.org/ns/ldp#describedBy");
// PROV
public static readonly Uri ProvEntity = new Uri("http://www.w3.org/ns/prov#Entity");
public static readonly Uri ProvGeneratedAtTime = new Uri("http://www.w3.org/ns/prov#generatedAtTime");
public static readonly Uri ProvWasInvalidatedBy = new Uri("http://www.w3.org/ns/prov#wasInvalidatedBy");
public static readonly Uri ProvWasRevisionOf = new Uri("http://www.w3.org/ns/prov#wasRevisionOf");
public static readonly Uri ProvEntity = new("http://www.w3.org/ns/prov#Entity");
public static readonly Uri ProvGeneratedAtTime = new("http://www.w3.org/ns/prov#generatedAtTime");
public static readonly Uri ProvWasInvalidatedBy = new("http://www.w3.org/ns/prov#wasInvalidatedBy");
public static readonly Uri ProvWasRevisionOf = new("http://www.w3.org/ns/prov#wasRevisionOf");
// Trellis
public static readonly Uri TrellisGraph = new Uri("http://www.trellisldp.org/ns/trellis#PreferServerManaged");
public static readonly Uri TrellisGraph = new("http://www.trellisldp.org/ns/trellis#PreferServerManaged");
// Xsd
public static readonly Uri XsdHexBinary = new Uri("http://www.w3.org/2001/XMLSchema#hexBinary");
public static readonly Uri XsdHexBinary = new("http://www.w3.org/2001/XMLSchema#hexBinary");
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
}
......