Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
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
?
Snippets
Groups
Projects
Show more breadcrumbs
Coscine
backend
scripts
SQL2Linked
Commits
8b7d5627
Commit
8b7d5627
authored
3 years ago
by
Hanna Führ
Committed by
Kimia Beheshti
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Migrate resourceType structured data to linked data
parent
32bc81eb
No related branches found
No related tags found
2 merge requests
!8
Release: Sprint/2022 12 :robot:
,
!5
Fix: Migrate resourceType structured data to linked data
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SQL2Linked/Implementations/ResourceTypeStructuralData.cs
+36
-2
36 additions, 2 deletions
src/SQL2Linked/Implementations/ResourceTypeStructuralData.cs
src/SQL2Linked/Implementations/UserStructuralData.cs
+0
-8
0 additions, 8 deletions
src/SQL2Linked/Implementations/UserStructuralData.cs
with
36 additions
and
10 deletions
src/SQL2Linked/Implementations/ResourceTypeStructuralData.cs
+
36
−
2
View file @
8b7d5627
...
...
@@ -6,10 +6,44 @@ namespace SQL2Linked.Implementations
{
public
class
ResourceTypeStructuralData
:
StructuralData
<
ResourceType
,
ResourceTypeModel
>
{
public
readonly
string
ResourceTypeUrlPrefix
=
"https://purl.org/coscine/resourcetype"
;
public
readonly
Uri
RdfType
=
new
(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
);
public
readonly
Uri
DcatDataService
=
new
(
"http://www.w3.org/ns/dcat#DataService"
);
public
override
IEnumerable
<
IGraph
>
ConvertToLinkedData
(
IEnumerable
<
ResourceType
>
entries
)
{
// ToDo: Implement
throw
new
NotImplementedException
();
var
graphs
=
new
List
<
IGraph
>();
foreach
(
var
entry
in
entries
)
{
var
resourceTypeGraphName
=
$"
{
ResourceTypeUrlPrefix
}
/
{
entry
.
Id
}
"
;
var
graph
=
RdfStoreConnector
.
GetGraph
(
resourceTypeGraphName
);
// check if a triple with a dcat:DataService already exists in the resourcetype graph
var
getTriples
=
graph
.
GetTriplesWithObject
(
DcatDataService
);
if
(!
getTriples
.
Any
())
{
graph
.
Assert
(
new
Triple
(
graph
.
CreateBlankNode
(),
graph
.
CreateUriNode
(
RdfType
),
graph
.
CreateUriNode
(
DcatDataService
)
)
);
graphs
.
Add
(
graph
);
Console
.
WriteLine
(
$"Will migrate resource type '
{
entry
.
DisplayName
}
' with id '
{
entry
.
Id
}
'."
);
}
else
{
Console
.
WriteLine
(
$"Will NOT migrate resource type '
{
entry
.
DisplayName
}
' with id '
{
entry
.
Id
}
'."
);
}
}
return
graphs
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/SQL2Linked/Implementations/UserStructuralData.cs
+
0
−
8
View file @
8b7d5627
...
...
@@ -25,14 +25,6 @@ namespace SQL2Linked.Implementations
if
(!
getTriples
.
Any
())
{
// check if a user graph already exists
var
exists
=
RdfStoreConnector
.
HasGraph
(
userGraphName
);
if
(!
exists
)
{
RdfStoreConnector
.
CreateNamedGraph
(
userGraphName
);
}
graph
.
Assert
(
new
Triple
(
graph
.
CreateBlankNode
(),
...
...
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