Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/cargo/clap-4.4.18
Browse files Browse the repository at this point in the history
  • Loading branch information
subotic authored Jan 29, 2024
2 parents f230244 + f4a6162 commit fcc59ab
Show file tree
Hide file tree
Showing 12 changed files with 407 additions and 21 deletions.
11 changes: 9 additions & 2 deletions data/dokubib.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ project {

// reference to datasets (1-n)
datasets = ["http://ns.dasch.swiss/repository#dsp-0804-dataset-000"]

// reference to grants (0-n)
grants = ["http://ns.dasch.swiss/repository#dsp-0804-grant-000"]
}

dataset {
Expand Down Expand Up @@ -124,8 +127,12 @@ dmp {
}

grant {
name = "Ordinary Budget"
funder = "http://ns.dasch.swiss/repository#dsp-0804-organization-000" // reference to person or organization
id = "http://ns.dasch.swiss/repository#dsp-0804-grant-000"
created_at = 1630601300976368000
created_by = "dsp-metadata-gui"
type = "Funding"
name = "Ordinary Budget"
funders = ["http://ns.dasch.swiss/repository#dsp-0804-organization-000"] // reference to person or organization
}

organization {
Expand Down
13 changes: 10 additions & 3 deletions data/hdm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ project {
fr = "1766-1905"
}
datasets = ["http://ns.dasch.swiss/repository#dsp-081C-dataset-000"]

// reference to grants (0-n)
grants = ["http://ns.dasch.swiss/repository#dsp-081C-grant-000"]
}

dataset {
Expand Down Expand Up @@ -141,8 +144,12 @@ dataset {
}

grant {
name = "Ordinary Budget"
funder = "http://ns.dasch.swiss/repository#dsp-081C-organization-000" // reference to organization
id = "http://ns.dasch.swiss/repository#dsp-081C-grant-000"
created_at = 1630601285796580000
created_by = "dsp-metadata-gui"
type = "funding"
name = "Hôtel de Musique Bern"
funders = ["http://ns.dasch.swiss/repository#dsp-081C-organization-000"]
}

organization {
Expand All @@ -154,7 +161,7 @@ organization {

url {
href = "https://www.musik.unibe.ch"
description = "https://www.musik.unibe.ch"
label = "https://www.musik.unibe.ch"
}

address {
Expand Down
32 changes: 18 additions & 14 deletions data/incunabula.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ project {
text = "Schweizer Tobias, Development of a Topographical Transcription Method, in Clivaz Claire u. a. (ed.), ebook, auf der Plattform http://www.ppur.info/lire-demain.html, Lausanne, 671-680."
}
datasets = ["http://ns.dasch.swiss/repository#dsp-0803-dataset-000"]

grants = ["http://ns.dasch.swiss/repository#dsp-0803-grant-000"]
}

dataset {
Expand Down Expand Up @@ -138,6 +140,21 @@ dataset {
}
}

grant {
id = "http://ns.dasch.swiss/repository#dsp-0803-grant-000"
created_at = "1637624150958979000"
created_by = "dsp-metadata-gui"
type = "Project funding"
name = "Project funding"
number = "120378"
funders = ["http://ns.dasch.swiss/repository#dsp-0803-organization-003"] // reference to person or organization (1-n)

url {
href = "https://data.snf.ch/grants/grant/120378"
label = "https://data.snf.ch/grants/grant/120378"
}
}

person "barbara_schellewald" {
id = "http://ns.dasch.swiss/repository#dsp-0803-person-000"
created_at = "1637624150958979000"
Expand Down Expand Up @@ -233,20 +250,7 @@ organization "dhlab_basel" {
name = "Digital Humanities Lab Philosophisch-Historische Fakultät Universität Basel"
}

organization "snf" {
organization {
id = "http://ns.dasch.swiss/repository#dsp-0803-organization-003"
name = "Swiss National Science Foundation (SNSF)"
}

grant {
name = "Project funding"
number = "120378"
// reference to person or organization (1-n)
funders = ["snf"]

url {
href = "https://data.snf.ch/grants/grant/120378"
description = "https://data.snf.ch/grants/grant/120378"
}

}
12 changes: 11 additions & 1 deletion dsp-domain/src/metadata/entity/grant.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
use serde::Serialize;

use crate::metadata::value::funder::Funder;
use crate::metadata::value::identifier::GrantId;
use crate::metadata::value::url::Url;
use crate::metadata::value::{CreatedAt, CreatedBy, GrantNumber, GrantType, Name};

#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct Grant {
pub id: GrantId,
pub id: GrantId, // (1)
pub created_at: CreatedAt, // (1)
pub created_by: CreatedBy, // (1)
pub type_of_grant: GrantType, // (1)
pub name: Option<Name>, // (0-1)
pub number: Option<GrantNumber>, // (0-1)
pub url: Option<Url>, // (0-1)
pub funders: Vec<Funder>, // (1-n)
}
2 changes: 1 addition & 1 deletion dsp-domain/src/metadata/entity/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod dataset;
pub(crate) mod grant;
pub mod grant;
mod organization;
mod person;
pub mod project;
Expand Down
2 changes: 2 additions & 0 deletions dsp-domain/src/metadata/value/funder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize)]
pub struct Funder(pub String);
7 changes: 7 additions & 0 deletions dsp-domain/src/metadata/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub mod attribution;
pub mod data_type;
pub mod description;
pub mod discipline;
pub mod funder;
pub mod identifier;
pub mod iso_code;
pub mod keyword;
Expand Down Expand Up @@ -63,3 +64,9 @@ pub struct Title(pub String);

#[derive(Debug, Default, Clone, PartialEq, Serialize)]
pub struct DatePublished(pub u64);

#[derive(Debug, Default, Clone, PartialEq, Serialize)]
pub struct GrantType(pub String);

#[derive(Debug, Default, Clone, PartialEq, Serialize)]
pub struct GrantNumber(pub String);
5 changes: 5 additions & 0 deletions dsp-meta/src/api/convert/axum/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ impl IntoResponse for DspMetaError {
format!("Something went wrong: {}", err),
)
.into_response(),
DspMetaError::ParseGrant(err) => (
StatusCode::INTERNAL_SERVER_ERROR,
format!("Something went wrong: {}", err),
)
.into_response(),
DspMetaError::CreateDomainObject(_) => {
(StatusCode::INTERNAL_SERVER_ERROR, "Something went wrong:").into_response()
}
Expand Down
Loading

0 comments on commit fcc59ab

Please sign in to comment.