Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TrellisMigrator
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
Coscine
backend
scripts
TrellisMigrator
Commits
a7125088
Commit
a7125088
authored
2 years ago
by
Benedikt Heinrichs
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Speedup of file listing
parent
9be4ef29
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TrellisMigrator/Implementations/ResourceStructuralData.cs
+43
-20
43 additions, 20 deletions
...TrellisMigrator/Implementations/ResourceStructuralData.cs
with
43 additions
and
20 deletions
src/TrellisMigrator/Implementations/ResourceStructuralData.cs
+
43
−
20
View file @
a7125088
...
...
@@ -40,6 +40,26 @@ namespace TrellisMigrator.Implementations
return
graphs
;
}
public
IEnumerable
<
Uri
>
ListFileGraphs
(
string
id
)
{
var
cmdString
=
new
SparqlParameterizedString
{
CommandText
=
@"SELECT DISTINCT ?g
WHERE { GRAPH ?g { ?s a <http://purl.org/fdp/fdp-o#MetadataService> }
FILTER(contains(str(?g), @graph)) }"
};
cmdString
.
SetLiteral
(
"graph"
,
id
);
var
resultSet
=
QueryEndpoint
.
QueryWithResultSet
(
cmdString
.
ToString
());
var
graphs
=
new
List
<
Uri
>();
foreach
(
SparqlResult
r
in
resultSet
)
{
graphs
.
Add
((
r
.
Value
(
"g"
)
as
UriNode
)?.
Uri
);
}
return
graphs
;
}
public
override
IEnumerable
<
IGraph
>
ConvertToLinkedData
(
IEnumerable
<
Resource
>
entries
)
{
var
graph
=
WrapRequest
(()
=>
GetGraph
(
"http://www.trellisldp.org/ns/trellis#PreferServerManaged"
));
...
...
@@ -98,7 +118,7 @@ namespace TrellisMigrator.Implementations
AddModifiedDate
(
graph
,
dctermsModifiedNode
,
baseNode
);
}
var
fileGraphs
=
WrapRequest
(()
=>
ListGraphs
(
resourceGraphName
+
"/"
));
var
fileGraphs
=
WrapRequest
(()
=>
List
File
Graphs
(
resourceGraphName
+
"/"
));
foreach
(
var
fileGraph
in
fileGraphs
)
{
if
(
fileGraph
.
ToString
()
!=
resourceGraphName
+
"/"
)
...
...
@@ -125,8 +145,10 @@ namespace TrellisMigrator.Implementations
var
resourceACLGraphName
=
$"
{
resourceUrlPrefix
}
/
{
entry
.
Id
}
?ext=acl"
;
var
entryAlreadyExists
=
WrapRequest
(()
=>
HasGraph
(
resourceACLGraphName
));
if
(!
entryAlreadyExists
)
{
var
resourceGraphExists
=
WrapRequest
(()
=>
HasGraph
(
resourceGraphName
));
if
(
!
entryAlreadyExists
&&
resourceGraphExists
)
if
(
resourceGraphExists
)
{
var
resourceGraph
=
WrapRequest
(()
=>
GetGraph
(
resourceGraphName
));
var
aclSubjects
=
resourceGraph
.
GetTriplesWithObject
(
new
Uri
(
"http://www.w3.org/ns/auth/acl#Authorization"
)).
Select
((
triple
)
=>
triple
.
Subject
);
...
...
@@ -152,6 +174,7 @@ namespace TrellisMigrator.Implementations
graphs
.
Add
(
aclGraph
);
}
}
}
return
graphs
;
}
...
...
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