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
95ae4127
This project is archived. Its data is
read-only
.
Commit
95ae4127
authored
Jul 6, 2022
by
Hanna Führ
Committed by
Benedikt Heinrichs
Jul 6, 2022
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Migrate role structured data to linked data
parent
28df7884
No related branches found
No related tags found
2 merge requests
!8
Release: Sprint/2022 12 :robot:
,
!6
Fix: Migrate role structured data to linked data
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SQL2Linked/Implementations/RoleStructuralData.cs
+57
-2
57 additions, 2 deletions
src/SQL2Linked/Implementations/RoleStructuralData.cs
with
57 additions
and
2 deletions
src/SQL2Linked/Implementations/RoleStructuralData.cs
+
57
−
2
View file @
95ae4127
...
...
@@ -6,10 +6,65 @@ namespace SQL2Linked.Implementations
{
public
class
RoleStructuralData
:
StructuralData
<
Role
,
RoleModel
>
{
public
readonly
string
RoleUrlPrefix
=
"https://purl.org/coscine/roles"
;
public
readonly
Uri
RdfType
=
new
(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
);
public
readonly
Uri
orgRole
=
new
(
"http://www.w3.org/ns/org#Role"
);
public
readonly
Uri
dctermsTitle
=
new
(
"http://purl.org/dc/terms/title"
);
public
override
IEnumerable
<
IGraph
>
ConvertToLinkedData
(
IEnumerable
<
Role
>
entries
)
{
// ToDo: Implement
throw
new
NotImplementedException
();
var
graphs
=
new
List
<
IGraph
>();
foreach
(
var
entry
in
entries
)
{
var
roleGraphName
=
$"
{
RoleUrlPrefix
}
/
{
entry
.
Id
}
"
;
var
graph
=
RdfStoreConnector
.
GetGraph
(
roleGraphName
);
// check if a triple with a org:role already exists in the role graph
var
getTriplesOrgRole
=
graph
.
GetTriplesWithObject
(
orgRole
);
if
(!
getTriplesOrgRole
.
Any
())
{
graph
.
Assert
(
new
Triple
(
graph
.
CreateUriNode
(
new
Uri
(
roleGraphName
)),
graph
.
CreateUriNode
(
RdfType
),
graph
.
CreateUriNode
(
orgRole
)
)
);
Console
.
WriteLine
(
$"For role '
{
entry
.
DisplayName
}
' will migrate triple '
{
graph
.
BaseUri
}
' a org:Role. "
);
}
else
{
Console
.
WriteLine
(
$"For role '
{
entry
.
DisplayName
}
' will NOT migrate triple '
{
graph
.
BaseUri
}
' a org:Role. "
);
}
// check if a triple with dcterms:title '{entry.DisplayName}' already exists in the role graph
var
getTriplesDctermsTitle
=
graph
.
GetTriplesWithPredicate
(
dctermsTitle
);
if
(!
getTriplesDctermsTitle
.
Any
())
{
graph
.
Assert
(
new
Triple
(
graph
.
CreateUriNode
(
new
Uri
(
roleGraphName
)),
graph
.
CreateUriNode
(
dctermsTitle
),
graph
.
CreateLiteralNode
(
entry
.
DisplayName
)
)
);
Console
.
WriteLine
(
$"For role '
{
entry
.
DisplayName
}
' will migrate triple '
{
graph
.
BaseUri
}
' dcterms:title '
{
entry
.
DisplayName
}
'. "
);
}
else
{
Console
.
WriteLine
(
$"For role '
{
entry
.
DisplayName
}
' will NOT migrate triple '
{
graph
.
BaseUri
}
' dcterms:title '
{
entry
.
DisplayName
}
'. "
);
}
if
(!
getTriplesOrgRole
.
Any
()
||
!
getTriplesDctermsTitle
.
Any
())
{
graphs
.
Add
(
graph
);
}
}
return
graphs
;
}
}
}
\ No newline at end of file
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