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
  • Fix/xxxx-activateGitlab
  • Fix/xxxx-brokenTag
  • Heinrichs-main-patch-59520
  • Hotfix/2132-editingDeletingInclusion
  • Hotfix/2141-fileUploadErrors
  • Hotfix/2202-fixNaNQuota
  • Hotfix/2254-fixContentLenghtCalculation
  • Hotfix/2307-noLinkedTimeout
  • Hotfix/2313-fixModifiedDate
  • Hotfix/2346-fixPolicy
  • Hotfix/2371-fixGitLabinRCV
  • Hotfix/2428-savingRwthRdsS3
  • Hotfix/2452-linkedDeletion
  • Hotfix/2459-EncodingPath
  • Hotfix/xxxx-lock
  • Issue/1792-newMetadataStructure
  • Issue/1951-quotaImplementation
  • Issue/1999-gitlabResourcesLib
  • Issue/2000-gitlabResourcesAPI
  • Issue/2072-wormResourceType
  • Issue/2101-gitLabResTypeUi
  • Issue/2102-gitLabResTypeRCV
  • Issue/2151-NamespaceRDSWorm
  • Issue/2155-ArchiveLinkedResource
  • Issue/2162-fixFolderResponse
  • Issue/2162-fixFolderResponsev2
  • Issue/2195-missingModifiedDate
  • Issue/2246-quotaResoval
  • Issue/2275-DocuGitlabResourceType
  • Issue/2278-gitlabToS
  • Issue/2279-gitlabMetaInformation
  • Issue/2309-docs
  • Issue/2326-supportedOrganizations
  • Issue/2328-noFailOnLog
  • Issue/2349-gitlabHttps
  • Issue/2414-resourceTypesAffilAndAllocQuota
  • Issue/2433-resourcesApi
  • Issue/2462-removeTraces
  • Issue/2464-invalidateMeta
  • Issue/2583-treeBug
  • Issue/2586-migrateBlob
  • Test/xxxx-enablingGitLab
  • Test/xxxx-usingPresignedForUL
  • dev
  • gitkeep
  • main
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.1.3
  • v1.1.4
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.11.1
  • v1.2.0
  • v1.3.0
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.5.2
  • v1.5.3
  • v1.5.4
  • v1.6.0
  • v1.6.1
  • v1.7.0
  • v1.7.1
  • v1.7.2
  • v1.7.3
  • v1.8.0
  • v1.8.1
  • v1.8.2
  • v1.8.3
  • v1.8.4
  • v1.8.5
  • v1.8.6
  • v1.8.7
  • v1.9.0
  • v1.9.1
  • v1.9.2
  • v1.9.3
  • v1.9.4
83 results

Target

Select target project
  • coscine/backend/libraries/resource-types
1 result
Select Git revision
  • Fix/xxxx-activateGitlab
  • Fix/xxxx-brokenTag
  • Heinrichs-main-patch-59520
  • Hotfix/2132-editingDeletingInclusion
  • Hotfix/2141-fileUploadErrors
  • Hotfix/2202-fixNaNQuota
  • Hotfix/2254-fixContentLenghtCalculation
  • Hotfix/2307-noLinkedTimeout
  • Hotfix/2313-fixModifiedDate
  • Hotfix/2346-fixPolicy
  • Hotfix/2371-fixGitLabinRCV
  • Hotfix/2428-savingRwthRdsS3
  • Hotfix/2452-linkedDeletion
  • Hotfix/2459-EncodingPath
  • Hotfix/xxxx-lock
  • Issue/1792-newMetadataStructure
  • Issue/1951-quotaImplementation
  • Issue/1999-gitlabResourcesLib
  • Issue/2000-gitlabResourcesAPI
  • Issue/2072-wormResourceType
  • Issue/2101-gitLabResTypeUi
  • Issue/2102-gitLabResTypeRCV
  • Issue/2151-NamespaceRDSWorm
  • Issue/2155-ArchiveLinkedResource
  • Issue/2162-fixFolderResponse
  • Issue/2162-fixFolderResponsev2
  • Issue/2195-missingModifiedDate
  • Issue/2246-quotaResoval
  • Issue/2275-DocuGitlabResourceType
  • Issue/2278-gitlabToS
  • Issue/2279-gitlabMetaInformation
  • Issue/2309-docs
  • Issue/2326-supportedOrganizations
  • Issue/2328-noFailOnLog
  • Issue/2349-gitlabHttps
  • Issue/2414-resourceTypesAffilAndAllocQuota
  • Issue/2433-resourcesApi
  • Issue/2462-removeTraces
  • Issue/2464-invalidateMeta
  • Issue/2583-treeBug
  • Issue/2586-migrateBlob
  • Test/xxxx-enablingGitLab
  • Test/xxxx-usingPresignedForUL
  • dev
  • gitkeep
  • main
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.1.3
  • v1.1.4
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.11.1
  • v1.2.0
  • v1.3.0
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.5.2
  • v1.5.3
  • v1.5.4
  • v1.6.0
  • v1.6.1
  • v1.7.0
  • v1.7.1
  • v1.7.2
  • v1.7.3
  • v1.8.0
  • v1.8.1
  • v1.8.2
  • v1.8.3
  • v1.8.4
  • v1.8.5
  • v1.8.6
  • v1.8.7
  • v1.9.0
  • v1.9.1
  • v1.9.2
  • v1.9.3
  • v1.9.4
83 results
Show changes
Commits on Source (9)
Showing
with 114 additions and 40 deletions
......@@ -5,7 +5,7 @@ include:
stages:
- build
# - test
- test
- publish
variables:
......@@ -17,8 +17,8 @@ build-branch:
build-nuget-release:
extends: .build-nuget-release
# test:
# extends: .test
test:
extends: .test
publish-branch-prerelease:
extends: .publish-branch-prerelease
......
# Coscine Resource Types
This library contains all resource type implementations for Coscine (RDS, RDS-S3, RDS-S3-WORM, Linked, Gitlab).
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
......@@ -18,7 +18,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Coscine.Metadata" Version="2.*-*" />
<PackageReference Include="Coscine.Metadata" Version="*-*" />
<PackageReference Include="GitLabApiClient" Version="1.8.1-beta.5" />
</ItemGroup>
......
......@@ -15,6 +15,7 @@ public class LinkedResourceType : BaseResourceType
private readonly string _epicPrefix;
private readonly string _predicate = "https://purl.org/coscine/terms/linked#body";
private readonly RdfStoreConnector _rdfStoreConnector;
private readonly CoscineLDPHelper _coscineLDPHelper;
public LinkedResourceType(LinkedResourceTypeConfiguration linkedResourceTypeConfiguration) : base(linkedResourceTypeConfiguration)
{
......@@ -27,11 +28,7 @@ public class LinkedResourceType : BaseResourceType
{
_rdfStoreConnector = new();
}
}
private string GetGraphName(string id, string key)
{
return $"{GetSubjectName(id, key)}&data";
_coscineLDPHelper = new CoscineLDPHelper(_rdfStoreConnector, _epicPrefix);
}
private string GetGraphNameForFilter(string id, string key)
......@@ -58,11 +55,12 @@ public class LinkedResourceType : BaseResourceType
key = "/" + key;
}
var graph = _rdfStoreConnector.GetGraph(GetGraphName(id, key));
var urlId = _coscineLDPHelper.GetId(id, key, true, false, "data");
var graph = _rdfStoreConnector.GetGraph(urlId);
if (!graph.IsEmpty)
{
_rdfStoreConnector.DeleteGraph(GetGraphName(id, key));
_rdfStoreConnector.DeleteGraph(urlId);
}
return Task.CompletedTask;
......@@ -75,14 +73,15 @@ public class LinkedResourceType : BaseResourceType
key = "/" + key;
}
var graph = _rdfStoreConnector.GetGraph(GetGraphName(id, key));
var urlId = _coscineLDPHelper.GetId(id, key, true, false, "data");
var graph = _rdfStoreConnector.GetGraph(urlId);
if (graph.IsEmpty)
{
return Task.FromResult<ResourceEntry?>(null);
}
var triples = graph.GetTriplesWithSubjectPredicate(graph.CreateUriNode(new Uri(GetSubjectName(id, key))), graph.CreateUriNode(new Uri(_predicate)));
var triples = graph.GetTriplesWithPredicate(graph.CreateUriNode(new Uri(_predicate)));
if (!triples.Any())
{
......@@ -125,6 +124,24 @@ public class LinkedResourceType : BaseResourceType
return GetEntry(id, key).Result;
}).Where(x => x != null).Cast<ResourceEntry>().ToList();
// Add the new results as well
var currentDataList = _rdfStoreConnector.ListData(id);
if (currentDataList != null)
{
var resourceGraphUri = $"https://purl.org/coscine/resources/{id}";
var currentDataPaths = currentDataList.Select((entry) => entry?[..entry.LastIndexOf("/")].Replace(resourceGraphUri, ""));
var bothDataPaths = currentDataPaths.Where((currentDataPath) => resultList.Any((resultEntry) => resultEntry.Key == currentDataPath));
var newDataPaths = currentDataPaths.Where((currentDataPath) => !resultList.Any((resultEntry) => resultEntry.Key == currentDataPath));
// Remove the ones which are in both since the ones from the new structure would have the newest information
resultList.RemoveAll((entry) => bothDataPaths.Any((dataPath) => dataPath == entry.Key));
resultList.AddRange(currentDataPaths
.Where(x => x is not null)
.Select((x) => GetEntry(id, x!).Result)
.Where(x => x != null).Cast<ResourceEntry>());
}
return Task.FromResult(resultList);
}
......@@ -135,14 +152,16 @@ public class LinkedResourceType : BaseResourceType
key = "/" + key;
}
var graph = _rdfStoreConnector.GetGraph(GetGraphName(id, key));
var urlId = _coscineLDPHelper.GetId(id, key, true, false, "data");
var graph = _rdfStoreConnector.GetGraph(urlId);
if (graph.IsEmpty)
{
return Task.FromResult<Stream?>(null);
}
var triples = graph.GetTriplesWithSubjectPredicate(graph.CreateUriNode(new Uri(GetSubjectName(id, key))), graph.CreateUriNode(new Uri(_predicate)));
var triples = graph.GetTriplesWithPredicate(graph.CreateUriNode(new Uri(_predicate)));
if (!triples.Any())
{
......@@ -173,19 +192,21 @@ public class LinkedResourceType : BaseResourceType
Array.Resize(ref buffer, size);
var graph = _rdfStoreConnector.GetGraph(GetGraphName(id, key));
var urlId = _coscineLDPHelper.GetId(id, key, true, false, "data");
var graph = _rdfStoreConnector.GetGraph(urlId);
if (!graph.IsEmpty)
{
var triples = graph.GetTriplesWithSubjectPredicate(graph.CreateUriNode(new Uri(GetSubjectName(id, key))), graph.CreateUriNode(new Uri(_predicate)));
var triples = graph.GetTriplesWithPredicate(graph.CreateUriNode(new Uri(_predicate)));
graph.Retract(triples.ToArray());
}
else
{
_rdfStoreConnector.CreateNamedGraph(GetGraphName(id, key));
_rdfStoreConnector.CreateNamedGraph(urlId);
}
graph.Assert(new Triple(graph.CreateUriNode(new Uri(GetSubjectName(id, key))), graph.CreateUriNode(new Uri(_predicate)), graph.CreateLiteralNode(Encoding.UTF8.GetString(buffer))));
graph.Assert(new Triple(graph.CreateUriNode(urlId), graph.CreateUriNode(new Uri(_predicate)), graph.CreateLiteralNode(Encoding.UTF8.GetString(buffer))));
_rdfStoreConnector.AddGraph(graph);
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
......@@ -18,7 +18,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Coscine.Metadata" Version="2.*-*" />
<PackageReference Include="Coscine.Metadata" Version="*-*" />
<PackageReference Include="dotNetRDF" Version="2.7.4" />
</ItemGroup>
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
......
......@@ -29,9 +29,17 @@ public static class Helpers
// Linked has no quota.
var baseResourceType = ResourceTypeFactory.Instance.GetResourceType(resource);
if (baseResourceType.GetResourceTypeInformation().Result.IsQuotaAvailable)
{
try
{
return baseResourceType.GetResourceQuotaAvailable(resource.Id.ToString(), _resourceModel.GetResourceTypeOptions(resource.Id)).Result;
}
catch (Exception)
{
// Error in communicating with the resource
return 0;
}
}
else
{
return 0;
......@@ -134,8 +142,16 @@ public static class Helpers
if (returnObject.ResourceTypeOption.ContainsKey("Size"))
{
var resourceTypeDefinition = ResourceTypeFactory.Instance.GetResourceType(resource);
try
{
returnObject.ResourceTypeOption["Size"] = resourceTypeDefinition.GetResourceQuotaAvailable(resource.Id.ToString()).Result;
}
catch (Exception)
{
// Error in communicating with the resource
returnObject.ResourceTypeOption["Size"] = 0;
}
}
return returnObject;
}
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<RootNamespace>Coscine.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<AssemblyName>Coscine.$(MSBuildProjectName)</AssemblyName>
<Version>1.8.7</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<PropertyGroup>
......
......@@ -29,7 +29,10 @@
"en": "RDS"
},
"status": "active",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [
"https://ror.org/04xfq0f34",
"https://ror.org/04tqgg260"
]
},
"rdsude": {
"type": "rds",
......@@ -41,7 +44,7 @@
"en": "RDS UDE"
},
"status": "active",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [ "https://ror.org/04mz5ra38" ]
},
"rdsnrw": {
"type": "rds",
......@@ -53,7 +56,20 @@
"en": "RDS NRW"
},
"status": "hidden",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [
"https://ror.org/00edvg943",
"https://ror.org/04x02q560",
"https://ror.org/03hj8rz96",
"https://ror.org/03dv91853",
"https://ror.org/00ftx0026",
"https://ror.org/04p7ekn23",
"https://ror.org/04wdt0z89",
"https://ror.org/014nnvj65",
"https://ror.org/04eka8j06",
"https://ror.org/02nkxrq89",
"https://ror.org/00pv45a02",
"https://ror.org/04m2anh63"
]
},
"rdstudo": {
"type": "rds",
......@@ -65,7 +81,7 @@
"en": "RDS TUDo"
},
"status": "hidden",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [ "https://ror.org/01k97gp34" ]
},
"rdss3rwth": {
"type": "rdss3",
......@@ -78,7 +94,10 @@
"en": "RDS S3"
},
"status": "active",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [
"https://ror.org/04xfq0f34",
"https://ror.org/04tqgg260"
]
},
"rdss3ude": {
"type": "rdss3",
......@@ -91,7 +110,7 @@
"en": "RDS S3 UDE"
},
"status": "active",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [ "https://ror.org/04mz5ra38" ]
},
"rdss3nrw": {
"type": "rdss3",
......@@ -104,7 +123,20 @@
"en": "RDS S3 NRW"
},
"status": "active",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [
"https://ror.org/00edvg943",
"https://ror.org/04x02q560",
"https://ror.org/03hj8rz96",
"https://ror.org/03dv91853",
"https://ror.org/00ftx0026",
"https://ror.org/04p7ekn23",
"https://ror.org/04wdt0z89",
"https://ror.org/014nnvj65",
"https://ror.org/04eka8j06",
"https://ror.org/02nkxrq89",
"https://ror.org/00pv45a02",
"https://ror.org/04m2anh63"
]
},
"rdss3tudo": {
"type": "rdss3",
......@@ -118,7 +150,7 @@
"en": "RDS S3 TUDo"
},
"status": "hidden",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [ "https://ror.org/01k97gp34" ]
},
"rdss3wormrwth": {
"type": "rdss3",
......@@ -132,6 +164,9 @@
"en": "RDS S3 Worm RWTH"
},
"status": "active",
"supportedOrganizations": [ "*" ]
"supportedOrganizations": [
"https://ror.org/04xfq0f34",
"https://ror.org/04tqgg260"
]
}
}