Skip to content

Commit

Permalink
refactor: Merge Vocabularies (#3326)
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone authored Jul 17, 2024
1 parent 4708dcc commit 7030ca1
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 142 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import zio.Task
import zio.ZIO
import zio.stream.ZStream

import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.Value.StringValue
import org.knora.webapi.slice.common.repo.rdf.Errors.RdfError
import org.knora.webapi.slice.common.repo.rdf.RdfResource
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.service.CrudRepository
import org.knora.webapi.store.triplestore.api.TriplestoreService
import org.knora.webapi.store.triplestore.api.TriplestoreService.Queries.Construct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import org.knora.webapi.slice.admin.domain.model.Permission
import org.knora.webapi.slice.admin.domain.model.Permission.Administrative
import org.knora.webapi.slice.admin.domain.model.PermissionIri
import org.knora.webapi.slice.admin.repo.rdf.RdfConversions.*
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.rdf.Errors.ConversionError
import org.knora.webapi.slice.common.repo.rdf.Errors.RdfError
import org.knora.webapi.slice.common.repo.rdf.RdfResource
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.slice.resourceinfo.domain.InternalIri
import org.knora.webapi.store.triplestore.api.TriplestoreService
import org.knora.webapi.store.triplestore.errors.TriplestoreResponseException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import org.knora.webapi.slice.admin.domain.model.KnoraProject.ProjectIri
import org.knora.webapi.slice.admin.domain.model.Permission
import org.knora.webapi.slice.admin.domain.model.PermissionIri
import org.knora.webapi.slice.admin.repo.rdf.RdfConversions.*
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.rdf.Errors.ConversionError
import org.knora.webapi.slice.common.repo.rdf.Errors.RdfError
import org.knora.webapi.slice.common.repo.rdf.RdfResource
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.slice.resourceinfo.domain.InternalIri
import org.knora.webapi.store.triplestore.api.TriplestoreService

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import org.knora.webapi.slice.admin.domain.model.KnoraGroup.Conversions.*
import org.knora.webapi.slice.admin.domain.model.KnoraProject.ProjectIri
import org.knora.webapi.slice.admin.domain.service.KnoraGroupRepo
import org.knora.webapi.slice.admin.repo.rdf.RdfConversions.projectIriConverter
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary.KnoraAdmin.*
import org.knora.webapi.slice.common.repo.rdf.Errors.ConversionError
import org.knora.webapi.slice.common.repo.rdf.Errors.RdfError
import org.knora.webapi.slice.common.repo.rdf.RdfResource
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.rdf.Vocabulary.KnoraAdmin.*
import org.knora.webapi.store.triplestore.api.TriplestoreService

final case class KnoraGroupRepoLive(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import org.knora.webapi.slice.admin.domain.model.KnoraProject.*
import org.knora.webapi.slice.admin.domain.model.RestrictedView
import org.knora.webapi.slice.admin.domain.service.KnoraProjectRepo
import org.knora.webapi.slice.admin.repo.rdf.RdfConversions.*
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.rdf.Errors.RdfError
import org.knora.webapi.slice.common.repo.rdf.RdfResource
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.store.triplestore.api.TriplestoreService

final case class KnoraProjectRepoLive(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ import org.knora.webapi.slice.admin.domain.model.UserStatus
import org.knora.webapi.slice.admin.domain.model.Username
import org.knora.webapi.slice.admin.domain.service.KnoraUserRepo
import org.knora.webapi.slice.admin.repo.rdf.RdfConversions.*
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary.KnoraAdmin.*
import org.knora.webapi.slice.common.repo.rdf.Errors.ConversionError
import org.knora.webapi.slice.common.repo.rdf.Errors.RdfError
import org.knora.webapi.slice.common.repo.rdf.RdfResource
import org.knora.webapi.slice.common.repo.rdf.Vocabulary.KnoraAdmin.*
import org.knora.webapi.store.triplestore.api.TriplestoreService

final case class KnoraUserRepoLive(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,125 @@ package org.knora.webapi.slice.common.repo.rdf

import org.eclipse.rdf4j.model.Namespace
import org.eclipse.rdf4j.model.impl.SimpleNamespace
import org.eclipse.rdf4j.sparqlbuilder.rdf.Iri
import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf
import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf.iri

import org.knora.webapi.messages.OntologyConstants.KnoraAdmin.KnoraAdminPrefixExpansion
import org.knora.webapi.messages.OntologyConstants.KnoraBase.KnoraBasePrefixExpansion
import org.knora.webapi.slice.admin.AdminConstants.adminDataNamedGraph
import org.knora.webapi.slice.admin.AdminConstants.permissionsDataNamedGraph

object Vocabulary {
object KnoraAdmin {
private val ka = KnoraAdminPrefixExpansion
val NS: Namespace = new SimpleNamespace("knora-admin", KnoraAdminPrefixExpansion)

// resource class IRIs
val User: Iri = Rdf.iri(ka, "User")
val UserGroup: Iri = Rdf.iri(ka, "UserGroup")
val KnoraProject: Iri = Rdf.iri(ka, "knoraProject")

// property IRIs
val username: Iri = Rdf.iri(ka, "username")
val email: Iri = Rdf.iri(ka, "email")
val givenName: Iri = Rdf.iri(ka, "givenName")
val familyName: Iri = Rdf.iri(ka, "familyName")
val status: Iri = Rdf.iri(ka, "status")
val preferredLanguage: Iri = Rdf.iri(ka, "preferredLanguage")
val password: Iri = Rdf.iri(ka, "password")
val isInProject: Iri = Rdf.iri(ka, "isInProject")
val isInGroup: Iri = Rdf.iri(ka, "isInGroup")
val isInSystemAdminGroup: Iri = Rdf.iri(ka, "isInSystemAdminGroup")
val isInProjectAdminGroup: Iri = Rdf.iri(ka, "isInProjectAdminGroup")
val hasSelfJoinEnabled: Iri = Rdf.iri(ka, "hasSelfJoinEnabled")

// user group properties
val belongsToProject: Iri = Rdf.iri(ka, "belongsToProject")
val groupName: Iri = Rdf.iri(ka, "groupName")
val groupDescriptions: Iri = Rdf.iri(ka, "groupDescriptions")

// project properties
val projectRestrictedViewSize: Iri = Rdf.iri(ka, "projectRestrictedViewSize")
val projectRestrictedViewWatermark: Iri = Rdf.iri(ka, "projectRestrictedViewWatermark")
val projectDescription: Iri = Rdf.iri(ka, "projectDescription")
val projectKeyword: Iri = Rdf.iri(ka, "projectKeyword")
val projectLogo: Iri = Rdf.iri(ka, "projectLogo")
val projectLongname: Iri = Rdf.iri(ka, "projectLongname")
val projectShortcode: Iri = Rdf.iri(ka, "projectShortcode")
val projectShortname: Iri = Rdf.iri(ka, "projectShortname")

// permission properties
val AdministrativePermission: Iri = Rdf.iri(ka, "AdministrativePermission")
val DefaultObjectAccessPermission: Iri = Rdf.iri(ka, "DefaultObjectAccessPermission")
val forProject: Iri = Rdf.iri(ka, "forProject")
val forGroup: Iri = Rdf.iri(ka, "forGroup")
val forProperty: Iri = Rdf.iri(ka, "forProperty")
val forResourceClass: Iri = Rdf.iri(ka, "forResourceClass")
}

object KnoraBase {
private val kb = "http://www.knora.org/ontology/knora-base#"
private val kb = KnoraBasePrefixExpansion

val NS: Namespace = new SimpleNamespace("knora-base", kb)

val linkValue = iri(kb + "LinkValue")

val isDeleted = iri(kb + "isDeleted")
val attachedToUser = iri(kb + "attachedToUser")
val attachedToProject = iri(kb + "attachedToProject")
val hasPermissions = iri(kb + "hasPermissions")
val creationDate = iri(kb + "creationDate")

val valueHasString = iri(kb + "valueHasString")
val valueHasUUID = iri(kb + "valueHasUUID")
val valueHasComment = iri(kb + "valueHasComment")
val valueHasOrder = iri(kb + "valueHasOrder")
val valueCreationDate = iri(kb + "valueCreationDate")

val valueHasInteger = iri(kb + "valueHasInteger")
val valueHasBoolean = iri(kb + "valueHasBoolean")
val valueHasDecimal = iri(kb + "valueHasDecimal")
val valueHasUri = iri(kb + "valueHasUri")
val valueHasStartJDN = iri(kb + "valueHasStartJDN")
val valueHasEndJDN = iri(kb + "valueHasEndJDN")
val valueHasStartPrecision = iri(kb + "valueHasStartPrecision")
val valueHasEndPrecision = iri(kb + "valueHasEndPrecision")
val valueHasCalendar = iri(kb + "valueHasCalendar")
val valueHasColor = iri(kb + "valueHasColor")
val valueHasGeometry = iri(kb + "valueHasGeometry")
val valueHasListNode = iri(kb + "valueHasListNode")
val valueHasIntervalStart = iri(kb + "valueHasIntervalStart")
val valueHasIntervalEnd = iri(kb + "valueHasIntervalEnd")
val valueHasTimeStamp = iri(kb + "valueHasTimeStamp")
val valueHasGeonameCode = iri(kb + "valueHasGeonameCode")
val valueHasRefCount = iri(kb + "valueHasRefCount")
val valueHasLanguage = iri(kb + "valueHasLanguage")
val valueHasMapping = iri(kb + "valueHasMapping")
val valueHasMaxStandoffStartIndex = iri(kb + "valueHasMaxStandoffStartIndex")
val valueHasStandoff = iri(kb + "valueHasStandoff")

val internalFilename = iri(kb + "internalFilename")
val internalMimeType = iri(kb + "internalMimeType")
val originalFilename = iri(kb + "originalFilename")
val originalMimeType = iri(kb + "originalMimeType")
val dimX = iri(kb + "dimX")
val dimY = iri(kb + "dimY")
val externalUrl = iri(kb + "externalUrl")
val pageCount = iri(kb + "pageCount")

val standoffTagHasStartIndex = iri(kb + "standoffTagHasStartIndex")
val standoffTagHasEndIndex = iri(kb + "standoffTagHasEndIndex")
val standoffTagHasStartParent = iri(kb + "standoffTagHasStartParent")
val standoffTagHasEndParent = iri(kb + "standoffTagHasEndParent")
val standoffTagHasOriginalXMLID = iri(kb + "standoffTagHasOriginalXMLID")
val standoffTagHasUUID = iri(kb + "standoffTagHasUUID")
val standoffTagHasStart = iri(kb + "standoffTagHasStart")
val standoffTagHasEnd = iri(kb + "standoffTagHasEnd")
val linkValue: Iri = iri(kb + "LinkValue")

val isDeleted: Iri = iri(kb + "isDeleted")
val attachedToUser: Iri = iri(kb + "attachedToUser")
val attachedToProject: Iri = iri(kb + "attachedToProject")
val hasPermissions: Iri = iri(kb + "hasPermissions")
val creationDate: Iri = iri(kb + "creationDate")

val valueHasString: Iri = iri(kb + "valueHasString")
val valueHasUUID: Iri = iri(kb + "valueHasUUID")
val valueHasComment: Iri = iri(kb + "valueHasComment")
val valueHasOrder: Iri = iri(kb + "valueHasOrder")
val valueCreationDate: Iri = iri(kb + "valueCreationDate")

val valueHasInteger: Iri = iri(kb + "valueHasInteger")
val valueHasBoolean: Iri = iri(kb + "valueHasBoolean")
val valueHasDecimal: Iri = iri(kb + "valueHasDecimal")
val valueHasUri: Iri = iri(kb + "valueHasUri")
val valueHasStartJDN: Iri = iri(kb + "valueHasStartJDN")
val valueHasEndJDN: Iri = iri(kb + "valueHasEndJDN")
val valueHasStartPrecision: Iri = iri(kb + "valueHasStartPrecision")
val valueHasEndPrecision: Iri = iri(kb + "valueHasEndPrecision")
val valueHasCalendar: Iri = iri(kb + "valueHasCalendar")
val valueHasColor: Iri = iri(kb + "valueHasColor")
val valueHasGeometry: Iri = iri(kb + "valueHasGeometry")
val valueHasListNode: Iri = iri(kb + "valueHasListNode")
val valueHasIntervalStart: Iri = iri(kb + "valueHasIntervalStart")
val valueHasIntervalEnd: Iri = iri(kb + "valueHasIntervalEnd")
val valueHasTimeStamp: Iri = iri(kb + "valueHasTimeStamp")
val valueHasGeonameCode: Iri = iri(kb + "valueHasGeonameCode")
val valueHasRefCount: Iri = iri(kb + "valueHasRefCount")
val valueHasLanguage: Iri = iri(kb + "valueHasLanguage")
val valueHasMapping: Iri = iri(kb + "valueHasMapping")
val valueHasMaxStandoffStartIndex: Iri = iri(kb + "valueHasMaxStandoffStartIndex")
val valueHasStandoff: Iri = iri(kb + "valueHasStandoff")

val internalFilename: Iri = iri(kb + "internalFilename")
val internalMimeType: Iri = iri(kb + "internalMimeType")
val originalFilename: Iri = iri(kb + "originalFilename")
val originalMimeType: Iri = iri(kb + "originalMimeType")
val dimX: Iri = iri(kb + "dimX")
val dimY: Iri = iri(kb + "dimY")
val externalUrl: Iri = iri(kb + "externalUrl")
val pageCount: Iri = iri(kb + "pageCount")

val standoffTagHasStartIndex: Iri = iri(kb + "standoffTagHasStartIndex")
val standoffTagHasEndIndex: Iri = iri(kb + "standoffTagHasEndIndex")
val standoffTagHasStartParent: Iri = iri(kb + "standoffTagHasStartParent")
val standoffTagHasEndParent: Iri = iri(kb + "standoffTagHasEndParent")
val standoffTagHasOriginalXMLID: Iri = iri(kb + "standoffTagHasOriginalXMLID")
val standoffTagHasUUID: Iri = iri(kb + "standoffTagHasUUID")
val standoffTagHasStart: Iri = iri(kb + "standoffTagHasStart")
val standoffTagHasEnd: Iri = iri(kb + "standoffTagHasEnd")
}

object NamedGraphs {
val dataAdmin: Iri = Rdf.iri(adminDataNamedGraph.value)
val dataPermissions: Iri = Rdf.iri(permissionsDataNamedGraph.value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf

import org.knora.webapi.messages.OntologyConstants.KnoraAdmin.KnoraAdminPrefixExpansion
import org.knora.webapi.slice.admin.AdminConstants
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.store.triplestore.upgrade.GraphsForMigration
import org.knora.webapi.store.triplestore.upgrade.MigrateSpecificGraphs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.eclipse.rdf4j.sparqlbuilder.core.query.ModifyQuery
import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf

import org.knora.webapi.slice.admin.AdminConstants
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.store.triplestore.upgrade.GraphsForMigration
import org.knora.webapi.store.triplestore.upgrade.MigrateSpecificGraphs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf

import org.knora.webapi.slice.admin.AdminConstants
import org.knora.webapi.slice.admin.domain.model.RestrictedView.Size
import org.knora.webapi.slice.admin.repo.rdf.Vocabulary
import org.knora.webapi.slice.common.repo.rdf.Vocabulary
import org.knora.webapi.store.triplestore.upgrade.GraphsForMigration
import org.knora.webapi.store.triplestore.upgrade.MigrateSpecificGraphs

Expand Down
Loading

0 comments on commit 7030ca1

Please sign in to comment.