Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KPI Reporting Generator
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coscine
backend
scripts
KPI Reporting Generator
Merge requests
!4
New: Extended with Application Profile Reporting
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
New: Extended with Application Profile Reporting
Issue/2185-kpiGeneratorAP
into
dev
Overview
0
Commits
8
Pipelines
3
Changes
5
Merged
Petar Hristov
requested to merge
Issue/2185-kpiGeneratorAP
into
dev
2 years ago
Overview
0
Commits
8
Pipelines
3
Changes
5
Expand
coscine/issues#2185
0
0
Merge request reports
Compare
dev
version 2
8212461f
2 years ago
version 1
17f21b5e
2 years ago
dev (base)
and
latest version
latest version
76408bda
8 commits,
2 years ago
version 2
8212461f
7 commits,
2 years ago
version 1
17f21b5e
6 commits,
2 years ago
5 files
+
80
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
src/KPI Generator/Reportings/ApplicationProfile/ApplicationProfileReporting.cs
+
64
−
5
Options
using
KPIGenerator.Utils
;
using
Newtonsoft.Json
;
using
VDS.RDF.Query
;
using
static
KPIGenerator
.
Utils
.
CommandLineOptions
;
namespace
KPIGenerator.Reportings.ApplicationProfile
;
@@ -12,10 +14,67 @@ public class ApplicationProfileReporting : Reporting<ApplicationProfileReporting
public
override
IEnumerable
<
ReportingFileObject
>
GenerateReporting
()
{
/*
* 1. Collect the reporting for the whole database -- General/{ReportingReportingFileName}
* --> See envisioned folder structure.
*/
throw
new
NotImplementedException
();
var
reportingFiles
=
new
List
<
ReportingFileObject
>();
var
returnObjects
=
GetApplicationProfiles
();
// General File
reportingFiles
.
Add
(
new
ReportingFileObject
{
Path
=
GetReportingPathGeneral
(
ReportingFileName
),
Content
=
ConvertStringContentsToStream
(
JsonConvert
.
SerializeObject
(
returnObjects
,
Formatting
.
Indented
))
});
return
reportingFiles
;
}
private
List
<
ReturnObject
>
GetApplicationProfiles
()
{
var
_applicationProfile
=
"applicationProfile"
;
var
_title
=
"title"
;
var
_publisher
=
"publisher"
;
var
_rights
=
"rights"
;
var
_license
=
"license"
;
var
returnObjects
=
new
List
<
ReturnObject
>();
var
queryString
=
new
SparqlParameterizedString
{
CommandText
=
$@"PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT * WHERE
{{
?{
_applicationProfile
}
a
<
http
:
//www.w3.org/ns/shacl#NodeShape> .
OPTIONAL
{{
?{
_applicationProfile
}
dcterms
:{
_title
}
?{
_title
}.
}}
OPTIONAL
{{
?{
_applicationProfile
}
dcterms
:{
_publisher
}
?{
_publisher
}
.
}}
OPTIONAL
{{
?{
_applicationProfile
}
dcterms
:{
_rights
}
?{
_rights
}
.
}}
OPTIONAL
{{
?{
_applicationProfile
}
dcterms
:{
_license
}
?{
_license
}
.
}}
}}
"
};
using
var
result
=
RdfStoreConnector
.
QueryEndpoint
.
QueryWithResultSet
(
queryString
.
ToString
());
var
grouped
=
result
.
GroupBy
(
ap
=>
new
{
Uri
=
ap
.
Value
(
_applicationProfile
).
ToString
(),
Publisher
=
ap
.
HasValue
(
_publisher
)
&&
ap
.
Value
(
_publisher
)
is
not
null
?
ap
.
Value
(
_publisher
).
ToString
()
:
null
,
Rights
=
ap
.
HasValue
(
_rights
)
&&
ap
.
Value
(
_rights
)
is
not
null
?
ap
.
Value
(
_rights
).
ToString
()
:
null
,
License
=
ap
.
HasValue
(
_license
)
&&
ap
.
Value
(
_license
)
is
not
null
?
ap
.
Value
(
_license
).
ToString
()
:
null
},
t
=>
t
.
HasValue
(
_title
)
&&
t
.
Value
(
_title
)
is
not
null
?
t
.
Value
(
_title
).
ToString
()
:
null
);
foreach
(
var
ap
in
grouped
)
{
returnObjects
.
Add
(
new
ReturnObject
{
Uri
=
ap
.
Key
.
Uri
,
Publisher
=
ap
.
Key
.
Publisher
,
Rights
=
ap
.
Key
.
Rights
,
License
=
ap
.
Key
.
License
,
Titles
=
ap
.
Select
(
t
=>
{
if
(
t
is
not
null
)
{
return
t
[..
t
.
IndexOf
(
'@'
)];
}
return
t
;
}).
ToList
()
});
}
return
returnObjects
;
}
}
Loading