Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BlobApi
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
apis
BlobApi
Commits
f3865a3e
Commit
f3865a3e
authored
Feb 21, 2023
by
Benedikt Heinrichs
Committed by
Petar Hristov
Feb 21, 2023
Browse files
Options
Downloads
Patches
Plain Diff
New: Use the new metadata structure (coscine/issues#1792)
parent
80c2c8f2
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!86
Release: Sprint/2023 04 :robot:
,
!77
New: Use the new metadata structure (coscine/issues#1792)
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+4
-1
4 additions, 1 deletion
README.md
src/Blob/Controllers/BlobController.cs
+3
-13
3 additions, 13 deletions
src/Blob/Controllers/BlobController.cs
src/Blob/Util/CustomUri.cs
+0
-28
0 additions, 28 deletions
src/Blob/Util/CustomUri.cs
with
7 additions
and
42 deletions
README.md
+
4
−
1
View file @
f3865a3e
# Blob API
This API handles the connection to the data stored in Coscine.
This API handles the connection to the
research
data stored in Coscine.
Metadata has to have been provided, before storing of research data can proceed.
Check out the
[
docs
](
https://coscine.rwth-aachen.de/coscine/api/Coscine.Api.Blob/swagger
)
.
This diff is collapsed.
Click to expand it.
src/Blob/Controllers/BlobController.cs
+
3
−
13
View file @
f3865a3e
using
Coscine.Api.Blob.Util
;
using
Coscine.ApiCommons
;
using
Coscine.Configuration
;
using
Coscine.Database.DataModel
;
...
...
@@ -36,6 +35,7 @@ namespace Coscine.Api.Blob.Controllers
private
readonly
CoscineLogger
_coscineLogger
;
private
readonly
AnalyticsLogObject
_analyticsLogObject
;
private
readonly
RdfStoreConnector
_rdfStoreConnector
;
private
readonly
CoscineLDPHelper
_coscineLDPHelper
;
private
readonly
string
_prefix
;
/// <summary>
...
...
@@ -54,17 +54,7 @@ namespace Coscine.Api.Blob.Controllers
_coscineLogger
=
new
CoscineLogger
(
logger
);
_analyticsLogObject
=
new
AnalyticsLogObject
();
_prefix
=
_configuration
.
GetStringAndWait
(
"coscine/global/epic/prefix"
);
}
/// <summary>
/// Generates Id
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path"> Path to file</param>
/// <returns> Uri </returns>
public
Uri
GenerateId
(
string
resourceId
,
string
path
)
{
return
new
CustomUri
(
$"https://hdl.handle.net/
{
_prefix
}
/
{
resourceId
}
@path=
{
Uri
.
EscapeDataString
(
path
)}
"
);
_coscineLDPHelper
=
new
CoscineLDPHelper
(
_rdfStoreConnector
,
_prefix
);
}
/// <summary>
...
...
@@ -225,7 +215,7 @@ namespace Coscine.Api.Blob.Controllers
return
BadRequest
(
"Only one file can be uploaded per request."
);
}
var
id
=
Generate
Id
(
resourceId
,
$"/
{
path
}
"
);
var
id
=
_coscineLDPHelper
.
Get
Id
(
resourceId
,
$"/
{
path
}
"
,
true
);
if
(!
_rdfStoreConnector
.
HasGraph
(
id
))
{
return
StatusCode
((
int
)
HttpStatusCode
.
Forbidden
,
...
...
This diff is collapsed.
Click to expand it.
src/Blob/Util/CustomUri.cs
deleted
100644 → 0
+
0
−
28
View file @
80c2c8f2
using
System
;
namespace
Coscine.Api.Blob.Util
{
/// <summary>
/// Adapts the returned ToString of a Uri
/// </summary>
public
class
CustomUri
:
Uri
{
/// <summary>
/// Constructs a Custom Uri
/// </summary>
/// <param name="uri"></param>
public
CustomUri
(
string
uri
)
:
base
(
uri
)
{
}
/// <summary>
/// Overwrites the ToString for returning the AbsoluteUri (for dotNetRDF)
/// </summary>
/// <returns></returns>
public
override
string
ToString
()
{
return
AbsoluteUri
;
}
}
}
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