Skip to content
Snippets Groups Projects
Commit 400e1cc4 authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Performance Enhancements

parent 84b4f45a
Branches
Tags
1 merge request!90New: Use the new metadata structure (coscine/issues#1792)
......@@ -142,10 +142,12 @@ namespace Coscine.Api.Tree.Controllers
var resourceTypeInformation = resourceTypeDefinition.GetResourceTypeInformation().Result;
var metadataInfos = new List<ResourceEntry>(fileInfos);
var metadataIds = _rdfStoreConnector.GetMaxMetadataIds(resourceId);
// Add to metadata infos, if no "physical" file for it exists
if (!metadataInfos.Any((metadataInfo) => metadataInfo.Key == path))
{
metadataInfos.Add(new ResourceEntry(path, true, 0, _coscineLDPHelper.GetId(resourceId, path, true).AbsoluteUri, null, DateTime.Now, DateTime.Now));
metadataInfos.Add(new ResourceEntry(path, true, 0, _coscineLDPHelper.GetId(resourceId, path, true, false, "metadata", metadataIds).AbsoluteUri, null, DateTime.Now, DateTime.Now));
}
var applicationProfileGraph = _rdfStoreConnector.GetGraph(resource.ApplicationProfile);
......@@ -156,7 +158,7 @@ namespace Coscine.Api.Tree.Controllers
int metadataCount = 0;
foreach (var info in metadataInfos)
{
var id = _coscineLDPHelper.GetId(resourceId, info.Key, true);
var id = _coscineLDPHelper.GetId(resourceId, info.Key, true, false, "metadata", metadataIds);
if (_rdfStoreConnector.HasGraph(id.AbsoluteUri))
{
var graph = _rdfStoreConnector.GetGraph(id);
......@@ -440,7 +442,9 @@ namespace Coscine.Api.Tree.Controllers
// BaseUri must be set for the sparql query
graph.BaseUri = graphNameUri;
_rdfStoreConnector.AddMetadata(graph);
// Call Async Add Metadata method and let it finish in the background (client does not need to be bothered)
_rdfStoreConnector.AddMetadataAsync(graph);
return NoContent();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment