Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DfgStructureParser
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
DfgStructureParser
Commits
3c1a6fbc
Commit
3c1a6fbc
authored
4 years ago
by
qb268076
Browse files
Options
Downloads
Patches
Plain Diff
finalized parsing functionality, removed build doc cd step (coscine/issues#1031)
parent
f19af58f
No related branches found
No related tags found
2 merge requests
!3
Hotfix/921 correct import file
,
!2
Hotfix/921-correctImportFile
Pipeline
#329241
passed
4 years ago
Stage: test
Stage: release
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+0
-10
0 additions, 10 deletions
.gitlab-ci.yml
README.md
+8
-27
8 additions, 27 deletions
README.md
publishDocs.ps1
+0
-19
0 additions, 19 deletions
publishDocs.ps1
src/DfgStructureParser/DfgStructureParser/Program.cs
+33
-4
33 additions, 4 deletions
src/DfgStructureParser/DfgStructureParser/Program.cs
with
41 additions
and
60 deletions
.gitlab-ci.yml
+
0
−
10
View file @
3c1a6fbc
stages
:
-
test
-
docs
-
release
-
releasetrigger
...
...
@@ -19,15 +18,6 @@ cake:Test:
-
master
-
tags
docs
:
stage
:
docs
script
:
-
.\publishDocs.ps1 $GITLAB_TOKEN
variables
:
GIT_STRATEGY
:
clone
only
:
-
tags
cake:Release
:
stage
:
release
script
:
...
...
This diff is collapsed.
Click to expand it.
README.md
+
8
−
27
View file @
3c1a6fbc
#
#
C# Template
#
GraphDeployer
This
template includes:
This
repository transforms RDF data graphs into the turtle format.
*
Automatic building using cake
*
Automatic testing with NUnit
*
Automatic linting with Resharper
*
Automatic documentation publishing using Gitlab CI / CD and a self written script which puts the docs in the docs folder to the wiki
*
Automatic releases using semantic-release (
[
ESLint Code Convention
](
docs/ESLintConvention
)
), cake and Gitlab CI / CD
## Usage
## What you need to do
Source and target file path can be taken given as runtime options. Alternatively, the following consul keys may be registered:
`coscine/global/metadata_vocabularies/dfg_structure/`
`coscine/global/metadata_vocabularies/output`
Place you C# project solution file in .src/.
Make sure Create directory for solution is unticked.

Delete unused docs and update this README.
Add
[
NUnit
](
docs/nunit.md
)
tests to your solution.
## Building
Build this project by running either the build.ps1 or the build
<span></span>
.sh script.
The project will be build and tested.
### Links
*
[
Commit convention
](
docs/ESLintConvention.md
)
*
[
Everything possible with markup
](
docs/testdoc.md
)
*
[
Adding NUnit tests
](
docs/nunit.md
)
\ No newline at end of file
If the source file is to be loaded from Gitlab, register also the following konsul key:
`coscine/global/gitlabtoken/`
This diff is collapsed.
Click to expand it.
publishDocs.ps1
deleted
100644 → 0
+
0
−
19
View file @
f19af58f
param
(
$token
)
$remoteUrl
=
git
config
--get
remote.origin.url
$remoteUrl
=
$remoteUrl
.
replace
(
"git@"
,
""
)
$remoteUrl
=
$remoteUrl
-replace
"https(.*?)@"
,
""
$remoteUrl
=
$remoteUrl
.
replace
(
":"
,
"/"
)
$remoteUrl
=
$remoteUrl
.
replace
(
".git"
,
".wiki.git"
)
$temporaryFolderName
=
"publishDocsTempFolder"
git
clone
"https://gitlab-ci-token:
$(
$token
)
@
$(
$remoteUrl
)
"
$temporaryFolderName
cd
$temporaryFolderName
Remove-Item
*
cp
-r
..
/docs/
*
.
/
git
add
.
git
commit
-m
"Docs: Documentation Update"
git
push
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/DfgStructureParser/DfgStructureParser/Program.cs
+
33
−
4
View file @
3c1a6fbc
...
...
@@ -9,6 +9,7 @@ using NDesk.Options;
using
Coscine.Configuration
;
using
System.Net
;
using
System.IO
;
using
VDS.RDF.Parsing.Contexts
;
namespace
DfgStructureParser
{
...
...
@@ -97,6 +98,10 @@ namespace DfgStructureParser
var
subClassNode
=
g
.
CreateUriNode
(
new
Uri
(
"http://www.w3.org/2000/01/rdf-schema#subClassOf"
));
ReplacePredicate
(
g
,
broaderTriples
,
subClassNode
);
var
inpcompleteSuperClassTriples
=
g
.
GetTriplesWithPredicateObject
(
subClassNode
,
g
.
CreateUriNode
(
new
Uri
(
"http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"
))).
ToList
();
var
dfgParentNode
=
g
.
CreateUriNode
(
new
Uri
(
"http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"
));
ReplaceObject
(
g
,
inpcompleteSuperClassTriples
,
dfgParentNode
);
// remove notation count
var
notationTriples
=
g
.
GetTriples
(
new
Uri
(
"http://www.w3.org/2004/02/skos/core#notation"
)).
ToList
();
RemoveTriples
(
g
,
notationTriples
);
...
...
@@ -151,6 +156,16 @@ namespace DfgStructureParser
}
}
public
static
void
ReplaceObject
(
IGraph
graph
,
List
<
Triple
>
triples
,
INode
replacement
)
{
foreach
(
var
triple
in
triples
)
{
var
newTriple
=
new
Triple
(
triple
.
Subject
,
triple
.
Predicate
,
replacement
);
graph
.
Retract
(
triple
);
graph
.
Assert
(
newTriple
);
}
}
public
static
void
RemoveTriples
(
IGraph
graph
,
List
<
Triple
>
triples
)
{
foreach
(
var
triple
in
triples
)
...
...
@@ -173,11 +188,25 @@ namespace DfgStructureParser
{
var
parentNodeTriples
=
graph
.
GetTriplesWithSubject
(
new
Uri
(
"http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"
)).
ToList
();
var
properParentNode
=
graph
.
GetUriNode
(
new
Uri
(
"http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"
));
// rebind triples to correct parent node
ReplaceSubject
(
graph
,
parentNodeTriples
,
properParentNode
);
graph
.
Assert
(
properParentNode
,
graph
.
CreateUriNode
(
new
Uri
(
"http://purl.org/dc/elements/1.1/publisher"
)),
graph
.
CreateUriNode
(
new
Uri
(
"http://www.dfg.de/"
)));
// remove unnecessary ascribing to schema
List
<
Triple
>
parentTypeTriples
=
graph
.
GetTriplesWithSubjectPredicate
(
graph
.
CreateUriNode
(
new
Uri
(
"http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"
)),
graph
.
CreateUriNode
(
new
Uri
(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
))).
ToList
();
RemoveTriples
(
graph
,
parentTypeTriples
);
// add parent node specific label and copyright notice
graph
.
Assert
(
properParentNode
,
graph
.
CreateUriNode
(
new
Uri
(
"http://purl.org/dc/terms/publisher"
)),
graph
.
CreateUriNode
(
new
Uri
(
"http://www.dfg.de/"
)));
graph
.
Assert
(
properParentNode
,
graph
.
CreateUriNode
(
new
Uri
(
"http://purl.org/dc/terms/rights"
)),
graph
.
CreateLiteralNode
(
"Copyright © 2020 Deutsche Forschungsgemeinschaft"
));
// add "@en" suffix to the title of the parent node
var
titleTripleList
=
graph
.
GetTriplesWithSubjectPredicate
(
graph
.
CreateUriNode
(
new
Uri
(
"http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"
)),
graph
.
CreateUriNode
(
new
Uri
(
"http://purl.org/dc/terms/title"
))).
ToList
();
var
titleTriple
=
titleTripleList
[
0
];
LiteralNode
titleNode
=
(
LiteralNode
)
titleTriple
.
Object
;
ILiteralNode
newTitleNode
=
graph
.
CreateLiteralNode
(
titleNode
.
Value
,
"en"
);
ReplaceObject
(
graph
,
titleTripleList
,
newTitleNode
);
var
schemeNodeTriples
=
graph
.
GetTriples
(
new
Uri
(
"http://www.w3.org/2004/02/skos/core#inScheme"
)).
ToList
();
RemoveTriples
(
graph
,
schemeNodeTriples
);
}
...
...
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