Skip to main content
Homepage
Explore
Search or go to…
/
Sign in
Explore
Primary navigation
Project
S
SQL2Linked
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
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
Coscine
backend
scripts
SQL2Linked
Commits
77f7ba3e
This project is archived. Its data is
read-only
.
Commit
77f7ba3e
authored
Jan 19, 2024
by
Benedikt Heinrichs
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Reinstate Catalog Relations
parent
11089c38
No related branches found
No related tags found
1 merge request
!29
Fix: Working new version
Pipeline
#1220472
passed
Jan 19, 2024
Status:
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SQL2Linked/Implementations/ResourceStructuralData.cs
+28
-2
28 additions, 2 deletions
src/SQL2Linked/Implementations/ResourceStructuralData.cs
with
28 additions
and
2 deletions
src/SQL2Linked/Implementations/ResourceStructuralData.cs
+
28
−
2
View file @
77f7ba3e
...
...
@@ -3,6 +3,7 @@ using Coscine.ApiClient.Core.Model;
using
Newtonsoft.Json
;
using
SQL2Linked.Utils
;
using
VDS.RDF
;
using
VDS.RDF.Parsing
;
namespace
SQL2Linked.Implementations
;
...
...
@@ -120,7 +121,32 @@ public class ResourceStructuralData : StructuralData<ResourceAdminDto>
Console
.
WriteLine
(
$"For resource '
{
entry
.
DisplayName
}
' will migrate triple '
{
resourceGraphName
}
{
RdfUris
.
FoafHomepage
}
{
resourceGraphName
}
'. "
);
AssertToGraphLiteralNode
(
graph
,
resourceGraphName
,
RdfUris
.
CoscineTermsResourceDeleted
,
entry
.
Deleted
.
ToString
().
ToLower
(),
new
Uri
(
"http://www.w3.org/2001/XMLSchema#boolean"
));
Console
.
WriteLine
(
$"For project '
{
entry
.
DisplayName
}
' will migrate triple '
{
resourceGraphName
}
{
RdfUris
.
CoscineTermsResourceDeleted
}
{
entry
.
Deleted
}
'. "
);
Console
.
WriteLine
(
$"For resource '
{
entry
.
DisplayName
}
' will migrate triple '
{
resourceGraphName
}
{
RdfUris
.
CoscineTermsResourceDeleted
}
{
entry
.
Deleted
}
'. "
);
// Reinstate the catalog assignments
var
oldResourceGraphResponse
=
await
_adminApi
.
GetMetadataGraphAsync
(
resourceGraphName
.
AbsoluteUri
,
RdfFormat
.
TextTurtle
);
if
(
oldResourceGraphResponse
is
not
null
)
{
var
oldResourceGraph
=
new
Graph
();
var
ttlparser
=
new
TurtleParser
();
ttlparser
.
Load
(
oldResourceGraph
,
new
StringReader
(
oldResourceGraphResponse
.
Data
.
Content
));
foreach
(
var
result
in
oldResourceGraph
.
GetTriplesWithPredicate
(
RdfUris
.
DcatCatalog
))
{
if
(
result
.
Object
.
NodeType
==
NodeType
.
Uri
)
{
var
catalogedUri
=
result
.
Object
as
IUriNode
;
if
(
catalogedUri
is
not
null
)
{
AssertToGraphUriNode
(
graph
,
resourceGraphName
,
RdfUris
.
DcatCatalog
,
catalogedUri
.
Uri
);
Console
.
WriteLine
(
$"For resource '
{
entry
.
DisplayName
}
' will migrate triple '
{
resourceGraphName
}
{
RdfUris
.
DcatCatalog
}
{
catalogedUri
.
Uri
}
'. "
);
}
}
}
}
foreach
(
var
projectResource
in
entry
.
ProjectResources
)
{
...
...
@@ -151,7 +177,7 @@ public class ResourceStructuralData : StructuralData<ResourceAdminDto>
if
(
entry
.
DateCreated
is
not
null
&&
entry
.
DateCreated
.
HasValue
)
{
AssertToGraphLiteralNode
(
graph
,
resourceGraphName
,
RdfUris
.
DcTermsCreated
,
entry
.
DateCreated
.
Value
.
ToString
(),
new
Uri
(
"http://www.w3.org/2001/XMLSchema#dateTime"
));
Console
.
WriteLine
(
$"For
project
'
{
entry
.
DisplayName
}
' will migrate triple '
{
resourceGraphName
}
{
RdfUris
.
DcTermsCreated
}
{
entry
.
DateCreated
}
'. "
);
Console
.
WriteLine
(
$"For
resource
'
{
entry
.
DisplayName
}
' will migrate triple '
{
resourceGraphName
}
{
RdfUris
.
DcTermsCreated
}
{
entry
.
DateCreated
}
'. "
);
}
graphs
.
Add
(
graph
);
...
...
...
...
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
sign in
to comment