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
cdea641e
Commit
cdea641e
authored
3 years ago
by
Hanna Führ
Browse files
Options
Downloads
Patches
Plain Diff
Update: Migrate resourceType structured data to linked data (coscine/issues#2083)
parent
32bc81eb
No related branches found
No related tags found
2 merge requests
!7
Fix: Migrate resourceType structured data to linked data - fixes
,
!5
Fix: Migrate resourceType structured data to linked data
Pipeline
#750428
skipped
Stage: commands
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SQL2Linked/Implementations/ResourceTypeStructuralData.cs
+44
-2
44 additions, 2 deletions
src/SQL2Linked/Implementations/ResourceTypeStructuralData.cs
with
44 additions
and
2 deletions
src/SQL2Linked/Implementations/ResourceTypeStructuralData.cs
+
44
−
2
View file @
cdea641e
...
...
@@ -6,10 +6,52 @@ 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
())
{
// check if a resourcetype graph already exists
var
exists
=
RdfStoreConnector
.
HasGraph
(
resourceTypeGraphName
);
if
(!
exists
)
{
RdfStoreConnector
.
CreateNamedGraph
(
resourceTypeGraphName
);
}
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.
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