Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add versions to domain model #40

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ data class DataService(
tilgjengelighet (dcatap:availability)
*/
val availability: String? = null,

/*
versjon (dcat:version)
*/
val versions: List<String>? = null,
)

data class RegisterDataService(
Expand Down Expand Up @@ -153,6 +158,8 @@ data class RegisterDataService(
val type: String? = null,

val availability: String? = null,

val versions: List<String>? = null,
)

data class LocalizedStrings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class DataServiceHandler(private val repository: DataServiceRepository) {
license = registerDataService.license,
mediaTypes = registerDataService.mediaTypes,
accessRights = registerDataService.accessRights,
type = registerDataService.type
type = registerDataService.type,
availability = registerDataService.availability,
versions = registerDataService.versions
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ fun Model.addDataService(dataService: DataService, dataServiceUri: String) {
)
}

dataService.versions?.filter(String::isNotBlank)?.forEach {
dataServiceResource.addProperty(
ResourceFactory.createProperty("${DCAT.NS}version"), it
)
}

dataService.themes?.filter(FileUtils::isURI)?.forEach {
dataServiceResource.addProperty(
DCAT.theme, ResourceFactory.createResource(URIref.encode(it))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class RDFHandlerTest {
dct:accessRights <http://access-rights.com>;
dct:description "description"@en;
dct:format <http://format.com>;
dcat:version "1.0.1" , "2.0.0.beta";
dct:license <http://license.com>;
dct:title "title"@en;
dct:type <http://type.com>;
Expand Down Expand Up @@ -193,6 +194,7 @@ class RDFHandlerTest {
dct:accessRights <http://access-rights.com>;
dct:description "description"@en;
dct:format <http://format.com>;
dcat:version "1.0.1" , "2.0.0.beta";
dct:license <http://license.com>;
dct:title "title"@en;
dct:type <http://type.com>;
Expand Down Expand Up @@ -288,6 +290,7 @@ class RDFHandlerTest {
dct:accessRights <http://access-rights.com>;
dct:description "description"@en;
dct:format <http://format.com>;
dcat:version "1.0.1" , "2.0.0.beta";
dct:license <http://license.com>;
dct:title "title"@en;
dct:type <http://type.com>;
Expand Down Expand Up @@ -357,6 +360,7 @@ class RDFHandlerTest {
mediaTypes = listOf("https://www.iana.org/assignments/media-types/application/json"),
accessRights = "http://access-rights.com",
type = "http://type.com",
availability = "http://publications.europa.eu/resource/authority/planned-availability/STABLE"
availability = "http://publications.europa.eu/resource/authority/planned-availability/STABLE",
versions = listOf("1.0.1", "2.0.0.beta"),
)
}