Skip to content
Commits on Source (7)
This diff is collapsed.
......@@ -10,9 +10,9 @@ public class ConnectionConfiguration
/// </summary>
public static readonly string Section = "ConnectionConfiguration";
[JsonPropertyName("ProxyUrl")]
[JsonPropertyName("ServiceUrl")]
[Required]
public required string ProxyUrl { get; set; }
public required string ServiceUrl { get; set; }
[JsonPropertyName("ApplicationProfiles")]
[Required]
......
......@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.9.2</Version>
<Version>1.10.0</Version>
</PropertyGroup>
<ItemGroup>
......
......@@ -10,7 +10,7 @@ namespace Coscine.Api.Core.Entities.Models.QuadStore;
[RdfClass(LDP.Container)]
[RdfClass(LDP.BasicContainer)]
[RdfClass(FDP_O.MetadataService)]
public class DataCatalog(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class DataCatalog(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
/// <summary>
/// Gets or sets the ID of the associated metadata catalog.
......
using Semiodesk.Trinity;
namespace Coscine.Api.Core.Entities.Models.QuadStore;
[RdfClass("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashType")]
public class HashEntity(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
[RdfProperty("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashFunction")]
public string? HashFunction { get; set; }
[RdfProperty("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hashValue")]
public string? HashValue { get; set; }
}
......@@ -7,7 +7,7 @@ namespace Coscine.Api.Core.Entities.Models.QuadStore;
/// Represents a catalog of metadata entries within the data catalog.
/// </summary>
[RdfClass(DCAT.Catalog)]
public class MetadataCatalog(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class MetadataCatalog(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
/// <summary>
/// Gets or sets the list of entity URIs in the metadata catalog.
......
......@@ -7,7 +7,7 @@ namespace Coscine.Api.Core.Entities.Models.QuadStore;
/// Represents a metadata entry within the metadata catalog.
/// </summary>
[RdfClass("http://www.w3.org/ns/prov#Entity")]
public class MetadataEntity(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class MetadataEntity(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
/// <summary>
/// Gets or sets the date and time when the metadata was generated.
......@@ -27,7 +27,22 @@ public class MetadataEntity(UriRef uri) : Semiodesk.Trinity.Resource(uri)
/// </summary>
/// <remarks>Corresponds to the <see cref="MetadataEntity"/> class.</remarks>
[RdfProperty("http://www.w3.org/ns/prov#wasRevisionOf")]
public Uri? WasRevisionOf { get; set; }
public List<Uri> WasRevisionOf { get; set; } = [];
/// <summary>
/// Gets or sets the URI of the entity that this one is a revision of.
/// </summary>
/// <remarks>Corresponds to the <see cref="MetadataEntity"/> class.</remarks>
[RdfProperty("https://purl.org/coscine/terms/metadatatracker#hasVariant")]
public List<Uri> HasVariant { get; set; } = [];
/// <summary>
/// Gets or sets the similarity to the last version.
/// String because of compatibility issues with Virtuoso.
/// </summary>
/// <remarks>Corresponds to the <see cref="MetadataEntity"/> class.</remarks>
[RdfProperty("https://purl.org/coscine/terms/metadatatracker#similarityToLastVersion")]
public string? SimilarityToLastVersion { get; set; }
/// <summary>
/// Gets or sets the URI of the extracted data related to this entity.
......
......@@ -6,7 +6,7 @@ namespace Coscine.Api.Core.Entities.Models.QuadStore;
/// Represents extracted metadata information.
/// </summary>
[RdfClass("https://purl.org/coscine/terms/metatadataextraction#Entity")]
public class MetadataExtractedEntity(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class MetadataExtractedEntity(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
/// <summary>
/// Gets or sets the version of the extracted metadata.
......
......@@ -9,7 +9,7 @@ namespace Coscine.Api.Core.Entities.Models.QuadStore;
[RdfClass(ORG.OrganizationalCollaboration)]
[RdfClass(VCARD.Group)]
[RdfClass(LDP.Container)]
public class ProjectRdf(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class ProjectRdf(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
[RdfProperty(DCTERMS.title)]
public string? ProjectName { get; set; }
......
......@@ -4,7 +4,7 @@ using Semiodesk.Trinity;
namespace Coscine.Api.Core.Entities.Models.QuadStore;
[RdfClass(DCAT.Catalog)]
public class RawDataCatalog(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class RawDataCatalog(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
[RdfProperty("http://www.w3.org/ns/ldp#describedBy")]
public Uri? DescribedBy { get; set; }
......@@ -15,4 +15,11 @@ public class RawDataCatalog(UriRef uri) : Semiodesk.Trinity.Resource(uri)
/// <remarks>Corresponds to the <see cref="RawDataEntity"/> class.</remarks>
[RdfProperty("http://www.w3.org/ns/dcat#dataset")]
public List<Uri> EntityIds { get; set; } = [];
/// <summary>
/// Gets or sets the list of extracted URIs in the metadata catalog.
/// </summary>
/// <remarks>Corresponds to the <see cref="RawDataEntity"/> class.</remarks>
[RdfProperty("http://www.w3.org/ns/dcat#distribution")]
public List<Uri> ExtractedIds { get; set; } = [];
}
......@@ -4,7 +4,7 @@ using Semiodesk.Trinity;
namespace Coscine.Api.Core.Entities.Models.QuadStore;
[RdfClass("http://www.w3.org/ns/prov#Entity")]
public class RawDataEntity(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class RawDataEntity(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
[RdfProperty("http://www.w3.org/ns/prov#generatedAtTime")]
public DateTime? GeneratedAt { get; set; }
......@@ -13,11 +13,14 @@ public class RawDataEntity(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public Uri? InvalidatedBy { get; set; }
[RdfProperty("http://www.w3.org/ns/prov#wasRevisionOf")]
public Uri? WasRevisionOf { get; set; }
public List<Uri> WasRevisionOf { get; set; } = [];
[RdfProperty("https://purl.org/coscine/terms/metatadataextraction#extracted")]
public Uri? ExtractedId { get; set; }
[RdfProperty("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hash")]
public Uri? Hash { get; set; }
/// <summary>
/// Gets the Version of this entity.
/// </summary>
......
......@@ -3,7 +3,7 @@
namespace Coscine.Api.Core.Entities.Models.QuadStore;
[RdfClass("https://purl.org/coscine/terms/metatadataextraction#Entity")]
public class RawDataExtractedEntity(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class RawDataExtractedEntity(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
[RdfProperty("https://purl.org/coscine/terms/metatadataextraction#version")]
public string? ExtractedVersion { get; set; }
......
......@@ -6,7 +6,7 @@ using Semiodesk.Trinity;
namespace Coscine.Api.Core.Entities.Models.QuadStore;
[RdfClass(DCAT.Catalog)]
public class ResourceRdf(UriRef uri) : Semiodesk.Trinity.Resource(uri)
public class ResourceRdf(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
[RdfProperty(DCAT.service)]
public Uri? TypeId { get; set; }
......
using Semiodesk.Trinity;
namespace Coscine.Api.Core.Entities.Models.QuadStore;
/// <summary>
/// Represents a variant within the metadata catalog.
/// </summary>
[RdfClass("https://purl.org/coscine/terms/metadatatracker#Variant")]
public class Variant(Uri uri) : Semiodesk.Trinity.Resource(uri)
{
/// <summary>
/// Gets or sets the URI of the entity that it is a variant of.
/// </summary>
/// <remarks>Corresponds to the <see cref="Variant"/> class.</remarks>
[RdfProperty("https://purl.org/coscine/terms/metadatatracker#isVariantOf")]
public Uri? VariantOf { get; set; }
/// <summary>
/// Gets or sets the similarity value.
/// String because of compatibility issues with Virtuoso.
/// </summary>
/// <remarks>Corresponds to the <see cref="Variant"/> class.</remarks>
[RdfProperty("https://purl.org/coscine/terms/metadatatracker#similarity")]
public string? Similarity { get; set; }
}
......@@ -6,18 +6,23 @@ public static class ResourceOperations
{
public static OperationAuthorizationRequirement Create { get; } = new() { Name = nameof(Create) };
public static OperationAuthorizationRequirement CreateBlob { get; } = new() { Name = nameof(CreateBlob) };
public static OperationAuthorizationRequirement CreateExtractionTree { get; } = new() { Name = nameof(CreateExtractionTree) };
public static OperationAuthorizationRequirement CreateTree { get; } = new() { Name = nameof(CreateTree) };
public static OperationAuthorizationRequirement Read { get; } = new() { Name = nameof(Read) };
public static OperationAuthorizationRequirement ReadBlob { get; } = new() { Name = nameof(ReadBlob) };
public static OperationAuthorizationRequirement ReadProvenance { get; } = new() { Name = nameof(ReadProvenance) };
public static OperationAuthorizationRequirement ReadTree { get; } = new() { Name = nameof(ReadTree) };
public static OperationAuthorizationRequirement ReadQuota { get; } = new() { Name = nameof(ReadQuota) };
public static OperationAuthorizationRequirement ReadOptions { get; } = new() { Name = nameof(ReadOptions) };
public static OperationAuthorizationRequirement Update { get; } = new() { Name = nameof(Update) };
public static OperationAuthorizationRequirement UpdateBlob { get; } = new() { Name = nameof(UpdateBlob) };
public static OperationAuthorizationRequirement UpdateExtractionTree { get; } = new() { Name = nameof(UpdateExtractionTree) };
public static OperationAuthorizationRequirement UpdateProvenance { get; } = new() { Name = nameof(UpdateProvenance) };
public static OperationAuthorizationRequirement UpdateTree { get; } = new() { Name = nameof(UpdateTree) };
public static OperationAuthorizationRequirement Delete { get; } = new() { Name = nameof(Delete) };
public static OperationAuthorizationRequirement DeleteBlob { get; } = new() { Name = nameof(DeleteBlob) };
public static OperationAuthorizationRequirement DeleteTree { get; } = new() { Name = nameof(DeleteTree) };
}
\ No newline at end of file
using System.Security.Cryptography;
namespace Coscine.Api.Core.Entities.OtherModels;
public class HashParameters
{
public required HashAlgorithmName AlgorithmName { get; init; }
public required string Value { get; init; }
}
......@@ -4,10 +4,13 @@ namespace Coscine.Api.Core.Entities.OtherModels;
public class MetadataTree : Tree
{
public Uri Id { get; init; } = null!;
public Uri? Id { get; init; }
public string Version { get; init; } = null!;
public IEnumerable<string> AvailableVersions { get; init; } = new List<string>();
public string Definition { get; init; } = null!;
public string? Definition { get; init; } = null!;
public RdfFormat Format { get; init; }
public bool SkipValidation { get; init; } = false;
public bool ForceNewMetadataVersion { get; init; } = false;
public MetadataTreeExtracted? Extracted { get; init; }
public Provenance? Provenance { get; init; }
}
namespace Coscine.Api.Core.Entities.OtherModels;
public class Provenance
{
public required Uri Id { get; init; }
public DateTime? GeneratedAt { get; init; }
public required IEnumerable<Uri> WasRevisionOf { get; init; }
public required IEnumerable<Variant> Variants { get; init; }
public Uri? WasInvalidatedBy { get; init; }
public string? MetadataExtractorVersion { get; init; }
public decimal? SimilarityToLastVersion { get; init; }
public HashParameters? HashParameters { get; init; }
/// <summary>
/// Represents the variants of this specific metadata tree.
/// </summary>
/// <param name="GraphName">Name of the graph.</param>
/// <param name="Similarity">Similarity value 0-1</param>
public record Variant(Uri GraphName, double Similarity);
}
using System.Text.RegularExpressions;
using System.Web;
namespace Coscine.Api.Core.Entities.OtherModels;
......@@ -20,7 +21,7 @@ public partial class TreeUriResolver
/// <summary>
/// The tree graph data path (file and folder).
/// URL Encoded!
/// URL Decoded!
/// </summary>
/// <remarks>
/// Does not start nor end with a slash '<c>/</c>'.
......@@ -67,6 +68,18 @@ public partial class TreeUriResolver
var typeMatch = TypeRegex().Match(absoluteUri);
Type = typeMatch.Groups[1].Value;
GraphId = CreateGraphUri(uri);
// Extract Path as string (everything after the ResourceId)
var pathStartIndex =
GraphId.AbsoluteUri.IndexOf(ResourceId.ToString(), StringComparison.Ordinal) + ResourceId.ToString().Length + 1; // + 1 is '/'
Path = HttpUtility.UrlDecode(GraphId.AbsoluteUri[pathStartIndex..]); // Will never start or end with a '/'
}
public static Uri CreateGraphUri(Uri uri)
{
var absoluteUri = uri.AbsoluteUri;
// Extract General Graph Name as Uri (URL without query parameters and /@type)
var uriWithoutQueryAndType = absoluteUri[..absoluteUri.LastIndexOf('/')];
......@@ -78,11 +91,6 @@ public partial class TreeUriResolver
uriWithoutQueryAndType = uriWithoutQueryAndType[..typeIndex];
}
GraphId = new Uri(uriWithoutQueryAndType); // Without trailing '/'
// Extract Path as string (everything after the ResourceId)
var pathStartIndex =
GraphId.AbsoluteUri.IndexOf(ResourceId.ToString(), StringComparison.Ordinal) + ResourceId.ToString().Length + 1; // + 1 is '/'
Path = GraphId.AbsoluteUri[pathStartIndex..]; // Will never start or end with a '/'
return new Uri(uriWithoutQueryAndType); // Without trailing '/'
}
}
......@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.9.2</Version>
<Version>1.10.0</Version>
</PropertyGroup>
<ItemGroup>
......