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
!5
Release: Sprint/2022 18
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Release: Sprint/2022 18
dev
into
main
Overview
0
Commits
4
Pipelines
1
Changes
8
Merged
Petar Hristov
requested to merge
dev
into
main
2 years ago
Overview
0
Commits
4
Pipelines
1
Changes
8
Expand
This Merge Request is automatically created
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
fc9c21e8
4 commits,
2 years ago
8 files
+
341
−
36
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
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