Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TreeApi
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
apis
TreeApi
Commits
400e1cc4
Commit
400e1cc4
authored
2 years ago
by
Benedikt Heinrichs
Browse files
Options
Downloads
Patches
Plain Diff
Performance Enhancements
parent
84b4f45a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!90
New: Use the new metadata structure (coscine/issues#1792)
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Tree/Controllers/TreeController.cs
+7
-3
7 additions, 3 deletions
src/Tree/Controllers/TreeController.cs
with
7 additions
and
3 deletions
src/Tree/Controllers/TreeController.cs
+
7
−
3
View file @
400e1cc4
...
...
@@ -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
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment