From 58c751ff3be76887f7107f51a9a4764633a24016 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 5 Apr 2024 13:25:01 +0200 Subject: [PATCH] Use Jena and Topbraid versions (#4837) * Use Jena and Topbraid versions --------- Co-authored-by: Simon Dumas --- build.sbt | 8 +- .../nexus/delta/wiring/ResourcesModule.scala | 6 +- .../nexus/delta/wiring/SchemasModule.scala | 7 +- .../schemas/errors/invalid-schema.json | 2 +- .../delta/routes/ResourcesRoutesSpec.scala | 4 +- .../delta/routes/SchemasRoutesSpec.scala | 11 +- .../resources/contexts/search-document.json | 30 - .../src/test/resources/organization.json | 74 --- .../search/src/test/resources/person.json | 79 --- .../search/src/test/resources/project.json | 86 --- .../resources/search-document-result.json | 41 -- .../search/src/test/resources/trace.json | 319 ----------- .../search/SearchSparqlQuerySpec.scala | 94 ---- .../nexus/delta/rdf/graph/Graph.scala | 3 +- .../delta/rdf/jsonld/api/JsonLdJavaApi.scala | 4 +- .../nexus/delta/rdf/shacl/ShaclEngine.scala | 88 +-- .../delta/rdf/shacl/ShaclFileLoader.scala | 28 + .../delta/rdf/shacl/ShaclShapesGraph.scala | 59 -- .../nexus/delta/rdf/shacl/ValidateShacl.scala | 104 ++++ .../delta/rdf/shacl/ShaclEngineSpec.scala | 70 --- .../delta/rdf/shacl/ValidateShaclSuite.scala | 65 +++ .../sdk/resources/ValidateResource.scala | 13 +- .../delta/sdk/schemas/ValidateSchema.scala | 7 +- .../delta/sdk/schemas/model/Schema.scala | 3 +- .../sdk/resources/ResourcesImplSpec.scala | 10 +- .../sdk/resources/ValidateResourceSuite.scala | 5 +- .../delta/sdk/schemas/SchemasImplSuite.scala | 10 +- .../nexus/delta/sdk/schemas/SchemasSpec.scala | 6 +- .../epfl/bluebrain/nexus/ship/RunShip.scala | 4 +- .../nexus/ship/resources/ResourceWiring.scala | 6 +- .../{search => }/context/bbp-neuroshapes.json | 0 .../kg/{search => }/context/neuroshapes.json | 0 .../bbp/common-annotation-selector.json | 378 +++++++++++++ .../kg/schemas/bbp/common-annotation.json | 427 +++++++++++++++ .../kg/schemas/bbp/common-brainlocation.json | 441 +++++++++++++++ .../kg/schemas/bbp/common-collection.json | 264 +++++++++ .../kg/schemas/bbp/common-contribution.json | 260 +++++++++ .../kg/schemas/bbp/common-derivation.json | 264 +++++++++ .../kg/schemas/bbp/common-distribution.json | 321 +++++++++++ .../kg/schemas/bbp/common-entity.json | 269 +++++++++ ...common-entitywithoutannotationsubject.json | 443 +++++++++++++++ .../kg/schemas/bbp/common-generation.json | 257 +++++++++ .../kg/schemas/bbp/common-identifier.json | 329 +++++++++++ .../kg/schemas/bbp/common-invalidation.json | 258 +++++++++ .../bbp/common-labeledontologyentity.json | 248 +++++++++ .../kg/schemas/bbp/common-language.json | 253 +++++++++ .../kg/schemas/bbp/common-license.json | 243 +++++++++ .../kg/schemas/bbp/common-minds.json | 295 ++++++++++ .../kg/schemas/bbp/common-propertyvalue.json | 253 +++++++++ .../bbp/common-quantitative-value.json | 383 +++++++++++++ .../kg/schemas/bbp/common-subject.json | 370 +++++++++++++ .../bbp/common-typedlabeledontologyterm.json | 459 ++++++++++++++++ .../resources/kg/schemas/bbp/common-unit.json | 272 ++++++++++ .../kg/schemas/bbp/common-vector3d.json | 265 +++++++++ .../schemas/bbp/neuromorphology-common.json | 100 ++++ .../kg/schemas/bbp/neuromorphology-dash.json | 16 + .../kg/schemas/bbp/provshapes-collection.json | 251 +++++++++ .../schemas/bbp/sample-neuromorphology.json | 511 ++++++++++++++++++ .../kg/schemas/bbp/schema-context.json | 230 ++++++++ .../nexus/tests/kg/SearchAccessSpec.scala | 4 +- .../tests/kg/SearchConfigIndexingSpec.scala | 23 +- .../resources/NeuroMorphologySampleSpec.scala | 101 ++++ 62 files changed, 8429 insertions(+), 1005 deletions(-) delete mode 100644 delta/plugins/search/src/test/resources/contexts/search-document.json delete mode 100644 delta/plugins/search/src/test/resources/organization.json delete mode 100644 delta/plugins/search/src/test/resources/person.json delete mode 100644 delta/plugins/search/src/test/resources/project.json delete mode 100644 delta/plugins/search/src/test/resources/search-document-result.json delete mode 100644 delta/plugins/search/src/test/resources/trace.json delete mode 100644 delta/plugins/search/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchSparqlQuerySpec.scala create mode 100644 delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclFileLoader.scala delete mode 100644 delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala create mode 100644 delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShacl.scala delete mode 100644 delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngineSpec.scala create mode 100644 delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShaclSuite.scala rename tests/src/test/resources/kg/{search => }/context/bbp-neuroshapes.json (100%) rename tests/src/test/resources/kg/{search => }/context/neuroshapes.json (100%) create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-annotation-selector.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-annotation.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-brainlocation.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-collection.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-contribution.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-derivation.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-distribution.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-entity.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-entitywithoutannotationsubject.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-generation.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-identifier.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-invalidation.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-labeledontologyentity.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-language.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-license.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-minds.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-propertyvalue.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-quantitative-value.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-subject.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-typedlabeledontologyterm.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-unit.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/common-vector3d.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/neuromorphology-common.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/neuromorphology-dash.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/provshapes-collection.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/sample-neuromorphology.json create mode 100644 tests/src/test/resources/kg/schemas/bbp/schema-context.json create mode 100644 tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/resources/NeuroMorphologySampleSpec.scala diff --git a/build.sbt b/build.sbt index c646960f18..75ed3f7bc8 100755 --- a/build.sbt +++ b/build.sbt @@ -41,7 +41,7 @@ val fs2AwsVersion = "6.1.1" val googleAuthClientVersion = "1.35.0" val handleBarsVersion = "4.4.0" val hikariVersion = "5.1.0" -val jenaVersion = "4.2.0" +val jenaVersion = "4.10.0" val jsonldjavaVersion = "0.13.6" val kamonVersion = "2.7.1" val kanelaAgentVersion = "1.0.18" @@ -57,7 +57,7 @@ val postgresJdbcVersion = "42.7.3" val pureconfigVersion = "0.17.6" val scalaTestVersion = "3.2.18" val scalaXmlVersion = "2.2.0" -val topBraidVersion = "1.3.2" // 1.4.1 fails to validate some test schemas +val topBraidVersion = "1.4.3" val testContainersVersion = "1.19.7" val testContainersScalaVersion = "0.41.3" @@ -109,7 +109,7 @@ lazy val fs2Aws = "io.laserdisc" %% "fs2- lazy val fs2AwsS3 = "io.laserdisc" %% "fs2-aws-s3" % fs2AwsVersion lazy val googleAuthClient = "com.google.oauth-client" % "google-oauth-client" % googleAuthClientVersion lazy val handleBars = "com.github.jknack" % "handlebars" % handleBarsVersion -lazy val jenaArq = "org.apache.jena" % "jena-arq" % jenaVersion +lazy val jenaArq = "org.apache.jena" % "jena-arq" % jenaVersion exclude ("com.apicatalog", "titanium-json-ld") lazy val jsonldjava = "com.github.jsonld-java" % "jsonld-java" % jsonldjavaVersion lazy val kamonAkkaHttp = "io.kamon" %% "kamon-akka-http" % kamonVersion lazy val kamonCore = "io.kamon" %% "kamon-core" % kamonVersion @@ -127,7 +127,7 @@ lazy val pureconfigCats = "com.github.pureconfig" %% "pure lazy val scalaReflect = "org.scala-lang" % "scala-reflect" % scalaCompilerVersion lazy val scalaTest = "org.scalatest" %% "scalatest" % scalaTestVersion lazy val scalaXml = "org.scala-lang.modules" %% "scala-xml" % scalaXmlVersion -lazy val topBraidShacl = "org.topbraid" % "shacl" % topBraidVersion +lazy val topBraidShacl = "org.topbraid" % "shacl" % topBraidVersion exclude ("com.apicatalog", "titanium-json-ld") lazy val testContainers = "org.testcontainers" % "testcontainers" % testContainersVersion lazy val testContainersScala = "com.dimafeng" %% "testcontainers-scala-munit" % testContainersScalaVersion lazy val testContainersScalaLocalStack = "com.dimafeng" %% "testcontainers-scala-localstack-v2" % testContainersScalaVersion diff --git a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/ResourcesModule.scala b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/ResourcesModule.scala index ff9084e782..521a352d71 100644 --- a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/ResourcesModule.scala +++ b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/ResourcesModule.scala @@ -6,6 +6,7 @@ import ch.epfl.bluebrain.nexus.delta.config.AppConfig import ch.epfl.bluebrain.nexus.delta.kernel.utils.UUIDF import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.JsonLdApi import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering import ch.epfl.bluebrain.nexus.delta.routes.ResourcesRoutes import ch.epfl.bluebrain.nexus.delta.sdk.IndexingAction.AggregateIndexingAction @@ -36,9 +37,8 @@ object ResourcesModule extends ModuleDef { ResourceResolution.schemaResource(aclCheck, resolvers, fetchSchema, excludeDeprecated = false) } - make[ValidateResource].from { - (resourceResolution: ResourceResolution[Schema], rcr: RemoteContextResolution @Id("aggregate")) => - ValidateResource(resourceResolution)(rcr) + make[ValidateResource].from { (resourceResolution: ResourceResolution[Schema], validateShacl: ValidateShacl) => + ValidateResource(resourceResolution, validateShacl) } make[ResourcesConfig].from { (config: AppConfig) => config.resources } diff --git a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/SchemasModule.scala b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/SchemasModule.scala index e6ebc102e4..016021523f 100644 --- a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/SchemasModule.scala +++ b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/SchemasModule.scala @@ -7,7 +7,7 @@ import ch.epfl.bluebrain.nexus.delta.kernel.utils.{ClasspathResourceLoader, UUID import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.contexts import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.JsonLdApi import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution} -import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ShaclShapesGraph +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering import ch.epfl.bluebrain.nexus.delta.routes.SchemasRoutes import ch.epfl.bluebrain.nexus.delta.sdk.IndexingAction.AggregateIndexingAction @@ -36,10 +36,9 @@ object SchemasModule extends ModuleDef { implicit private val loader: ClasspathResourceLoader = ClasspathResourceLoader.withContext(getClass) - make[ValidateSchema].fromEffect { (api: JsonLdApi, rcr: RemoteContextResolution @Id("aggregate")) => - ShaclShapesGraph.shaclShaclShapes.map(ValidateSchema(api, _, rcr)) + make[ValidateShacl].fromEffect { (rcr: RemoteContextResolution @Id("aggregate")) => ValidateShacl(rcr) } - } + make[ValidateSchema].from { (validateShacl: ValidateShacl, api: JsonLdApi) => ValidateSchema(validateShacl)(api) } make[SchemaDefinition].from { (validateSchema: ValidateSchema, clock: Clock[IO]) => Schemas.definition(validateSchema, clock) diff --git a/delta/app/src/test/resources/schemas/errors/invalid-schema.json b/delta/app/src/test/resources/schemas/errors/invalid-schema.json index 96c23e6fbe..916ae4e5c8 100644 --- a/delta/app/src/test/resources/schemas/errors/invalid-schema.json +++ b/delta/app/src/test/resources/schemas/errors/invalid-schema.json @@ -21,6 +21,6 @@ }, "value": "nxv:42" }, - "targetedNodes": 417 + "targetedNodes": 412 } } \ No newline at end of file diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala index a0cf8286f1..bfba5880c9 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala @@ -10,6 +10,7 @@ import ch.epfl.bluebrain.nexus.delta.kernel.utils.{UUIDF, UrlUtils} import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv, schema, schemas} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.IndexingAction import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclSimpleCheck import ch.epfl.bluebrain.nexus.delta.sdk.acls.model.AclAddress @@ -96,7 +97,8 @@ class ResourcesRoutesSpec extends BaseRouteSpec with CatsIOValues { } private val validator: ValidateResource = ValidateResource( - ResourceResolutionGen.singleInProject(projectRef, fetchSchema) + ResourceResolutionGen.singleInProject(projectRef, fetchSchema), + ValidateShacl(rcr).accepted ) private val fetchContext = FetchContextDummy(List(project.value)) private val resolverContextResolution: ResolverContextResolution = ResolverContextResolution(rcr) diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala index 1d803ba63b..aa38194c69 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala @@ -9,7 +9,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords -import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ShaclShapesGraph +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.IndexingAction import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclSimpleCheck import ch.epfl.bluebrain.nexus.delta.sdk.acls.model.AclAddress @@ -23,7 +23,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.schemas import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContextDummy import ch.epfl.bluebrain.nexus.delta.sdk.projects.model.ApiMappings import ch.epfl.bluebrain.nexus.delta.sdk.resolvers.ResolverContextResolution -import ch.epfl.bluebrain.nexus.delta.sdk.schemas.{SchemaImports, Schemas, SchemasConfig, SchemasImpl, ValidateSchema} +import ch.epfl.bluebrain.nexus.delta.sdk.schemas._ import ch.epfl.bluebrain.nexus.delta.sdk.utils.BaseRouteSpec import ch.epfl.bluebrain.nexus.delta.sourcing.ScopedEventLog import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.{Anonymous, Authenticated, Group, Subject, User} @@ -37,9 +37,8 @@ import java.util.UUID class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { - private val uuid = UUID.randomUUID() - implicit private val uuidF: UUIDF = UUIDF.fixed(uuid) - implicit private val shaclShaclShapes: ShaclShapesGraph = ShaclShapesGraph.shaclShaclShapes.accepted + private val uuid = UUID.randomUUID() + implicit private val uuidF: UUIDF = UUIDF.fixed(uuid) private val reader = User("reader", realm) private val writer = User("writer", realm) @@ -79,7 +78,7 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { private val config = SchemasConfig(eventLogConfig) - private val schemaDef = Schemas.definition(ValidateSchema.apply, clock) + private val schemaDef = Schemas.definition(ValidateSchema(ValidateShacl(rcr).accepted), clock) private lazy val schemaLog = ScopedEventLog(schemaDef, config.eventLog, xas) private lazy val routes = diff --git a/delta/plugins/search/src/test/resources/contexts/search-document.json b/delta/plugins/search/src/test/resources/contexts/search-document.json deleted file mode 100644 index 7f3a168939..0000000000 --- a/delta/plugins/search/src/test/resources/contexts/search-document.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "@context": { - "@vocab": "https://bluebrain.github.io/nexus/field/", - "identifier": { - "@type": "@id" - }, - "label": "http://www.w3.org/2000/01/rdf-schema#label", - "name": "http://schema.org/name", - "createdAt": { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime" - }, - "contributors": { - "@container": "@set" - }, - "organizations": { - "@container": "@set" - }, - "project": { - "@type": "@id" - }, - "createdBy": { - "@type": "@id" - }, - "_self": { - "@type": "@id", - "@id": "https://bluebrain.github.io/nexus/vocabulary/self" - } - }, - "@id": "https://bluebrain.github.io/nexus/contexts/search-document.json" -} \ No newline at end of file diff --git a/delta/plugins/search/src/test/resources/organization.json b/delta/plugins/search/src/test/resources/organization.json deleted file mode 100644 index 0f4da3902d..0000000000 --- a/delta/plugins/search/src/test/resources/organization.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "@id": "https://www.grid.ac/institutes/grid.5333.6", - "@type": [ - "http://schema.org/Organization", - "http://www.w3.org/ns/prov#Agent" - ], - "http://schema.org/name": [ - { - "@value": "École Polytechnique Fédérale de Lausanne" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/constrainedBy": [ - { - "@id": "https://bluebrain.github.io/nexus/schemas/unconstrained.json" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-14T05:00:16.995Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdBy": [ - { - "@id": "http://localhost/v1/realms/bbp/users/broman" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/deprecated": [ - { - "@value": false - } - ], - "https://bluebrain.github.io/nexus/vocabulary/incoming": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fwww.grid.ac%2Finstitutes%2Fgrid.5333.6/incoming" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/outgoing": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fwww.grid.ac%2Finstitutes%2Fgrid.5333.6/outgoing" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/project": [ - { - "@id": "http://localhost/v1/projects/copies/sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/rev": [ - { - "@value": 2 - } - ], - "https://bluebrain.github.io/nexus/vocabulary/schemaProject": [ - { - "@id": "http://localhost/v1/projects/copies/sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/self": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fwww.grid.ac%2Finstitutes%2Fgrid.5333.6" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-22T14:04:41.458Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedBy": [ - { - "@id": "http://localhost/v1/realms/local/users/localuser" - } - ] -} \ No newline at end of file diff --git a/delta/plugins/search/src/test/resources/person.json b/delta/plugins/search/src/test/resources/person.json deleted file mode 100644 index 31aa489d64..0000000000 --- a/delta/plugins/search/src/test/resources/person.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "@id": "http://localhost/nexus/v1/realms/bbp/users/tuncel", - "@type": [ - "http://schema.org/Person", - "http://www.w3.org/ns/prov#Agent" - ], - "http://schema.org/familyName": [ - { - "@value": "Tuncel" - } - ], - "http://schema.org/givenName": [ - { - "@value": "Anil" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/constrainedBy": [ - { - "@id": "https://bluebrain.github.io/nexus/schemas/unconstrained.json" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-14T05:56:56.185Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdBy": [ - { - "@id": "http://localhost/v1/realms/bbp/users/broman" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/deprecated": [ - { - "@value": false - } - ], - "https://bluebrain.github.io/nexus/vocabulary/incoming": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fbbp.epfl.ch%2Fnexus%2Fv1%2Frealms%2Fbbp%2Fusers%2Ftuncel/incoming" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/outgoing": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fbbp.epfl.ch%2Fnexus%2Fv1%2Frealms%2Fbbp%2Fusers%2Ftuncel/outgoing" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/project": [ - { - "@id": "http://localhost/v1/projects/copies/sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/rev": [ - { - "@value": 2 - } - ], - "https://bluebrain.github.io/nexus/vocabulary/schemaProject": [ - { - "@id": "http://localhost/v1/projects/copies/sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/self": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fbbp.epfl.ch%2Fnexus%2Fv1%2Frealms%2Fbbp%2Fusers%2Ftuncel" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-22T14:01:37.490Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedBy": [ - { - "@id": "http://localhost/v1/realms/local/users/localuser" - } - ] -} \ No newline at end of file diff --git a/delta/plugins/search/src/test/resources/project.json b/delta/plugins/search/src/test/resources/project.json deleted file mode 100644 index 4e2ddcd178..0000000000 --- a/delta/plugins/search/src/test/resources/project.json +++ /dev/null @@ -1,86 +0,0 @@ -[ - { - "@id": "http://localhost/v1/projects/copies/sscx", - "@type": [ - "https://bluebrain.github.io/nexus/vocabulary/Project" - ], - "https://bluebrain.github.io/nexus/vocabulary/apiMappings": [], - "https://bluebrain.github.io/nexus/vocabulary/base": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/constrainedBy": [ - { - "@id": "https://bluebrain.github.io/nexus/schemas/projects.json" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-14T04:44:51.128Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdBy": [ - { - "@id": "http://localhost/v1/realms/bbp/users/broman" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/deprecated": [ - { - "@value": false - } - ], - "https://bluebrain.github.io/nexus/vocabulary/description": [ - { - "@value": "" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/label": [ - { - "@value": "sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/organizationLabel": [ - { - "@value": "copies" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/organizationUuid": [ - { - "@value": "b11742dc-ddc5-450c-9532-405d47bff7b6" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/rev": [ - { - "@value": 1 - } - ], - "https://bluebrain.github.io/nexus/vocabulary/self": [ - { - "@id": "http://localhost/v1/projects/copies/sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-14T04:44:51.128Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedBy": [ - { - "@id": "http://localhost/v1/realms/bbp/users/broman" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/uuid": [ - { - "@value": "534af0b6-4351-4f47-b100-1822bb66ee1f" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/vocab": [ - { - "@id": "http://localhost/v1/vocabs/copies/sscx/" - } - ] - } -] diff --git a/delta/plugins/search/src/test/resources/search-document-result.json b/delta/plugins/search/src/test/resources/search-document-result.json deleted file mode 100644 index e3826b7d57..0000000000 --- a/delta/plugins/search/src/test/resources/search-document-result.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "@context" : "https://bluebrain.github.io/nexus/contexts/search-document.json", - "@id" : "http://localhost/neurosciencegraph/data/traces/28c68330-1649-4702-b608-5cde6349a2d8", - "@type" : [ - "http://schema.org/Dataset", - "http://www.w3.org/ns/prov#Entity", - "https://neuroshapes.org/Trace", - "https://neuroshapes.org/SingleCellSimulationTrace" - ], - "name" : "S1HL_L6_LBC_cNAC_5", - "brainRegion" : { - "label" : "S1HL", - "identifier" : "http://uri.interlex.org/paxinos/uris/rat/labels/798" - }, - "contributors" : [ - { - "label" : "Anil Tuncel", - "identifier" : "http://localhost/nexus/v1/realms/bbp/users/tuncel" - } - ], - "createdBy" : "http://localhost/v1/realms/bbp/users/broman", - "description" : "This dataset is about simulated electrophysiology traces for cell instance S1HL_L6_LBC_cNAC_5. The dataset contains one distribution of the traces in RAB file format.", - "license" : { - "identifier" : "https://creativecommons.org/licenses/by/4.0/" - }, - "organizations" : [ - { - "label" : "École Polytechnique Fédérale de Lausanne", - "identifier" : "https://www.grid.ac/institutes/grid.5333.6" - } - ], - "project" : { - "label" : "copies/sscx", - "identifier" : "http://localhost/v1/projects/copies/sscx" - }, - "subjectSpecies" : { - "label" : "Rattus norvegicus", - "identifier" : "http://purl.obolibrary.org/obo/NCBITaxon_10116" - }, - "_self" : "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fbbp.epfl.ch%2Fneurosciencegraph%2Fdata%2Ftraces%2F28c68330-1649-4702-b608-5cde6349a2d8" -} diff --git a/delta/plugins/search/src/test/resources/trace.json b/delta/plugins/search/src/test/resources/trace.json deleted file mode 100644 index 8686a521ab..0000000000 --- a/delta/plugins/search/src/test/resources/trace.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "@id": "http://localhost/neurosciencegraph/data/traces/28c68330-1649-4702-b608-5cde6349a2d8", - "@type": [ - "http://schema.org/Dataset", - "https://neuroshapes.org/Trace", - "http://www.w3.org/ns/prov#Entity", - "https://neuroshapes.org/SingleCellSimulationTrace" - ], - "http://schema.org/dateCreated": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-05-18T18:31:14.687696+02:00" - } - ], - "http://schema.org/description": [ - { - "@value": "This dataset is about simulated electrophysiology traces for cell instance S1HL_L6_LBC_cNAC_5. The dataset contains one distribution of the traces in RAB file format." - } - ], - "http://schema.org/distribution": [ - { - "@type": [ - "http://schema.org/DataDownload" - ], - "http://schema.org/contentSize": [ - { - "http://schema.org/unitCode": [ - { - "@value": "bytes" - } - ], - "http://schema.org/value": [ - { - "@value": 595176 - } - ] - } - ], - "http://schema.org/contentUrl": [ - { - "@id": "http://localhost/nexus/v1/files/public/sscx/476b625e-7146-4090-8fec-2cb028fcb5af" - } - ], - "http://schema.org/encodingFormat": [ - { - "@value": "application/rab" - } - ], - "http://schema.org/name": [ - { - "@value": "S1HL_L6_LBC_cNAC_5.rab" - } - ], - "http://www.w3.org/ns/prov#atLocation": [ - { - "@type": [ - "http://www.w3.org/ns/prov#Location" - ], - "https://neuroshapes.org/location": [ - { - "@value": "file:///gpfs/bbp.cscs.ch/data/project/proj109/nexus/public/sscx/b/e/5/e/8/8/f/2/S1HL_L6_LBC_cNAC_5.rab" - } - ], - "https://neuroshapes.org/store": [ - { - "@id": "http://localhost/neurosciencegraph/data/4820323e-bee0-48d2-824f-9d9d404dbbee" - } - ] - } - ], - "https://neuroshapes.org/digest": [ - { - "http://schema.org/algorithm": [ - { - "@value": "SHA-256" - } - ], - "http://schema.org/value": [ - { - "@value": "d9a1b8ec1f2afccfe80e26bcae30c81f1c6e2d93d7720c9071368d93b14599db" - } - ] - } - ] - } - ], - "http://schema.org/isPartOf": [ - { - "@id": "http://localhost/neurosciencegraph/data/traces/ceb6e006-1ae3-4d3e-8be6-010af894f99d", - "@type": [ - "https://neuroshapes.org/Trace" - ] - } - ], - "http://schema.org/name": [ - { - "@value": "S1HL_L6_LBC_cNAC_5" - } - ], - "http://www.w3.org/2004/02/skos/core#note": [ - { - "@value": "SSCX Simulation Data" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/constrainedBy": [ - { - "@id": "https://bluebrain.github.io/nexus/schemas/unconstrained.json" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-14T06:51:55.600Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/createdBy": [ - { - "@id": "http://localhost/v1/realms/bbp/users/broman" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/deprecated": [ - { - "@value": false - } - ], - "https://bluebrain.github.io/nexus/vocabulary/incoming": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fbbp.epfl.ch%2Fneurosciencegraph%2Fdata%2Ftraces%2F28c68330-1649-4702-b608-5cde6349a2d8/incoming" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/outgoing": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fbbp.epfl.ch%2Fneurosciencegraph%2Fdata%2Ftraces%2F28c68330-1649-4702-b608-5cde6349a2d8/outgoing" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/project": [ - { - "@id": "http://localhost/v1/projects/copies/sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/rev": [ - { - "@value": 2 - } - ], - "https://bluebrain.github.io/nexus/vocabulary/schemaProject": [ - { - "@id": "http://localhost/v1/projects/copies/sscx" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/self": [ - { - "@id": "http://localhost/v1/resources/copies/sscx/_/https:%2F%2Fbbp.epfl.ch%2Fneurosciencegraph%2Fdata%2Ftraces%2F28c68330-1649-4702-b608-5cde6349a2d8" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedAt": [ - { - "@type": "http://www.w3.org/2001/XMLSchema#dateTime", - "@value": "2021-07-14T12:06:58.661Z" - } - ], - "https://bluebrain.github.io/nexus/vocabulary/updatedBy": [ - { - "@id": "http://localhost/v1/realms/bbp/users/broman" - } - ], - "https://neuroshapes.org/annotation": [ - { - "@type": [ - "http://localhost/nexus/v1/resources/public/sscx/_/ETypeAnnotation", - "https://neuroshapes.org/Annotation" - ], - "http://schema.org/name": [ - { - "@value": "E-type annotation" - } - ], - "https://neuroshapes.org/hasBody": [ - { - "@id": "http://uri.interlex.org/base/ilx_0738201", - "@type": [ - "https://neuroshapes.org/EType", - "https://neuroshapes.org/AnnotationBody" - ], - "http://www.w3.org/2000/01/rdf-schema#label": [ - { - "@value": "cNAC" - } - ] - } - ] - }, - { - "@type": [ - "https://neuroshapes.org/Annotation", - "http://localhost/nexus/v1/resources/public/sscx/_/MTypeAnnotation" - ], - "http://schema.org/name": [ - { - "@value": "M-type annotation" - } - ], - "https://neuroshapes.org/hasBody": [ - { - "@id": "http://uri.interlex.org/base/ilx_0383233", - "@type": [ - "https://neuroshapes.org/AnnotationBody", - "https://neuroshapes.org/MType" - ], - "http://www.w3.org/2000/01/rdf-schema#label": [ - { - "@value": "L6_LBC" - } - ] - } - ] - } - ], - "https://neuroshapes.org/brainLocation": [ - { - "@type": [ - "https://neuroshapes.org/BrainLocation" - ], - "https://neuroshapes.org/brainRegion": [ - { - "@id": "http://uri.interlex.org/paxinos/uris/rat/labels/798", - "http://www.w3.org/2000/01/rdf-schema#label": [ - { - "@value": "S1HL" - } - ], - "http://www.w3.org/2004/02/skos/core#prefLabel": [ - { - "@value": "primary somatosensory cortex, hindlimb region" - } - ] - } - ], - "https://neuroshapes.org/layer": [ - { - "@id": "http://purl.obolibrary.org/obo/UBERON_0005395", - "http://www.w3.org/2000/01/rdf-schema#label": [ - { - "@value": "layer 6" - } - ] - } - ] - } - ], - "https://neuroshapes.org/contribution": [ - { - "@type": [ - "https://neuroshapes.org/Contribution" - ], - "http://www.w3.org/ns/prov#agent": [ - { - "@id": "https://www.grid.ac/institutes/grid.5333.6", - "@type": [ - "http://www.w3.org/ns/prov#Agent", - "http://schema.org/Organization" - ] - } - ] - }, - { - "@type": [ - "https://neuroshapes.org/Contribution" - ], - "http://www.w3.org/ns/prov#agent": [ - { - "@id": "http://localhost/nexus/v1/realms/bbp/users/tuncel", - "@type": [ - "http://www.w3.org/ns/prov#Agent", - "http://schema.org/Person" - ] - } - ] - } - ], - "https://neuroshapes.org/objectOfStudy": [ - { - "@id": "http://bbp.epfl.ch/neurosciencegraph/taxonomies/objectsofstudy/singlecells", - "@type": [ - "https://neuroshapes.org/ObjectOfStudy" - ], - "http://www.w3.org/2000/01/rdf-schema#label": [ - { - "@value": "Single Cell" - } - ] - } - ], - "https://neuroshapes.org/subject": [ - { - "@type": [ - "https://neuroshapes.org/Subject" - ], - "https://neuroshapes.org/species": [ - { - "@id": "http://purl.obolibrary.org/obo/NCBITaxon_10116", - "http://www.w3.org/2000/01/rdf-schema#label": [ - { - "@value": "Rattus norvegicus" - } - ] - } - ] - } - ], - "http://schema.org/license": [ - { - "@id": "https://creativecommons.org/licenses/by/4.0/", - "@type": [ - "https://neuroshapes.org/License" - ] - } - ] -} \ No newline at end of file diff --git a/delta/plugins/search/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchSparqlQuerySpec.scala b/delta/plugins/search/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchSparqlQuerySpec.scala deleted file mode 100644 index 53840eeb35..0000000000 --- a/delta/plugins/search/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchSparqlQuerySpec.scala +++ /dev/null @@ -1,94 +0,0 @@ -package ch.epfl.bluebrain.nexus.delta.plugins.search - -import akka.actor.ActorSystem -import akka.testkit.TestKit -import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.Fixtures.defaultProperties -import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.BlazegraphClient -import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.SparqlQueryResponseType.SparqlNTriples -import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode -import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.contexts -import ch.epfl.bluebrain.nexus.delta.rdf.graph.{Graph, NTriples} -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.ExpandedJsonLd -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution} -import ch.epfl.bluebrain.nexus.delta.rdf.query.SparqlQuery.SparqlConstructQuery -import ch.epfl.bluebrain.nexus.delta.sdk.ConfigFixtures -import ch.epfl.bluebrain.nexus.delta.sdk.http.{HttpClient, HttpClientConfig} -import ch.epfl.bluebrain.nexus.delta.sdk.syntax._ -import ch.epfl.bluebrain.nexus.testkit.blazegraph.BlazegraphDocker -import ch.epfl.bluebrain.nexus.testkit.scalatest.EitherValues -import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.{CatsEffectSpec, CatsIOValues} -import io.circe.Json -import org.scalatest.CancelAfterFailure -import org.scalatest.concurrent.Eventually - -import java.util.regex.Pattern.quote -import scala.concurrent.duration._ - -class SearchSparqlQuerySpec - extends TestKit(ActorSystem("SearchSparqlQuerySpec")) - with CatsEffectSpec - with ConfigFixtures - with EitherValues - with CancelAfterFailure - with Eventually - with CatsIOValues - with BlazegraphDocker { - - implicit override def patienceConfig: PatienceConfig = PatienceConfig(6.seconds, 10.milliseconds) - - private val searchDocument = contexts + "search-document.json" - - implicit private val httpCfg: HttpClientConfig = httpClientConfig - implicit private val api: JsonLdApi = JsonLdJavaApi.strict - implicit private val rcr: RemoteContextResolution = RemoteContextResolution.fixed( - searchDocument -> jsonContentOf("contexts/search-document.json").topContextValueOrEmpty - ) - - private lazy val endpoint = hostConfig.endpoint - private lazy val client = BlazegraphClient(HttpClient(), endpoint, None, 10.seconds, defaultProperties.accepted) - - private def toNTriples(json: Json): NTriples = { - for { - expanded <- ExpandedJsonLd(json) - graph <- IO.fromEither(expanded.toGraph) - ntriples <- IO.fromEither(graph.toNTriples) - } yield ntriples - }.accepted - - "A search SPARQL query" should { - val index = "myindex" - val ctx = ContextValue(searchDocument) - - val traceId = iri"http://localhost/neurosciencegraph/data/traces/28c68330-1649-4702-b608-5cde6349a2d8" - val trace = jsonContentOf("trace.json") - val personId = iri"http://localhost/nexus/v1/realms/bbp/users/tuncel" - val person = jsonContentOf("person.json") - val organizationId = iri"https://www.grid.ac/institutes/grid.5333.6" - val organization = jsonContentOf("organization.json") - val projectId = iri"http://localhost/v1/projects/copies/sscx" - val project = jsonContentOf("project.json") - - "index resources" in { - client.createNamespace(index).accepted - val toInsert: Seq[(IriOrBNode.Iri, Json)] = - List(traceId -> trace, personId -> person, organizationId -> organization, projectId -> project) - forAll(toInsert) { case (id, json) => - client.replace(index, id.toUri.rightValue, toNTriples(json)).accepted - } - } - - "return the expected results" in eventually { - val q = contentOf("construct-query.sparql").replaceAll(quote("{resource_id}"), traceId.rdfFormat) - val query = SparqlConstructQuery(q).rightValue - val compacted = for { - ntriples <- client.query(Set(index), query, SparqlNTriples) - graph <- IO.fromEither(Graph(ntriples.value.copy(rootNode = traceId))) - compacted <- graph.toCompactedJsonLd(ctx) - } yield compacted - compacted.accepted.json shouldEqual jsonContentOf("search-document-result.json") - } - } - -} diff --git a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/Graph.scala b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/Graph.scala index 526a6b5d02..422a74b713 100644 --- a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/Graph.scala +++ b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/Graph.scala @@ -27,7 +27,7 @@ import org.apache.jena.sparql.graph.GraphFactory import org.apache.jena.sparql.util.IsoMatcher import java.util.UUID -import scala.annotation.tailrec +import scala.annotation.{nowarn, tailrec} import scala.jdk.CollectionConverters._ import scala.util.Try @@ -39,6 +39,7 @@ import scala.util.Try * @param value * the Jena dataset graph */ +@nowarn("cat=deprecation") final case class Graph private (rootNode: IriOrBNode, value: DatasetGraph) { self => val rootResource: Node = subject(rootNode) diff --git a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/api/JsonLdJavaApi.scala b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/api/JsonLdJavaApi.scala index 926e8670b6..8832af60b3 100644 --- a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/api/JsonLdJavaApi.scala +++ b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/api/JsonLdJavaApi.scala @@ -20,12 +20,14 @@ import org.apache.jena.riot.system.ErrorHandlerFactory import org.apache.jena.riot._ import org.apache.jena.sparql.core.DatasetGraph +import scala.annotation.nowarn import scala.jdk.CollectionConverters._ import scala.util.Try /** * Json-LD high level API implementation by Json-LD Java library */ +@nowarn("cat=deprecation") final class JsonLdJavaApi(config: JsonLdApiConfig) extends JsonLdApi { System.setProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING, "true") @@ -76,7 +78,7 @@ final class JsonLdJavaApi(config: JsonLdApiConfig) extends JsonLdApi { val ds = DatasetFactory.create val initBuilder = RDFParser.create .fromString(input.noSpaces) - .lang(Lang.JSONLD) + .lang(Lang.JSONLD10) .context(c) .strict(config.strict) .checking(config.extraChecks) diff --git a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngine.scala b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngine.scala index b77641c088..3f57df1ec8 100644 --- a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngine.scala +++ b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngine.scala @@ -1,15 +1,12 @@ package ch.epfl.bluebrain.nexus.delta.rdf.shacl -import cats.effect.IO import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.nxsh -import ch.epfl.bluebrain.nexus.delta.rdf.graph.Graph -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution -import org.apache.jena.query.{Dataset, DatasetFactory} +import org.apache.jena.query.Dataset import org.apache.jena.rdf.model._ import org.topbraid.jenax.util.JenaDatatypes import org.topbraid.shacl.engine.{Constraint, ShapesGraph} -import org.topbraid.shacl.validation.{ValidationEngine, ValidationEngineConfiguration} +import org.topbraid.shacl.validation.ValidationEngine import java.net.URI import java.util @@ -26,7 +23,7 @@ import java.util * the ShapesGraph with the shapes to validate against */ @SuppressWarnings(Array("NullParameter")) -final class ShaclEngine private (dataset: Dataset, shapesGraphURI: URI, shapesGraph: ShapesGraph) +final class ShaclEngine(dataset: Dataset, shapesGraphURI: URI, shapesGraph: ShapesGraph) extends ValidationEngine(dataset, shapesGraphURI, shapesGraph, null) { private var targetedNodes = 0 @@ -43,82 +40,3 @@ final class ShaclEngine private (dataset: Dataset, shapesGraphURI: URI, shapesGr private def toProperty(iri: Iri): Property = ResourceFactory.createProperty(iri.toString) } - -object ShaclEngine { - - /** - * Validates a given graph against the SHACL shapes spec. - * - * @param shapesGraph - * the shapes Graph to test against the SHACL shapes spec - * @param reportDetails - * true to also include the sh:detail (more verbose) and false to omit them - * @return - * an option of [[ValidationReport]] with the validation results - */ - def apply( - shapesGraph: Graph, - reportDetails: Boolean - )(implicit shaclShapesGraph: ShaclShapesGraph, rcr: RemoteContextResolution): IO[ValidationReport] = - apply(shapesGraph, shaclShapesGraph, validateShapes = true, reportDetails = reportDetails) - - /** - * Validates a given data Graph against all shapes from a given shapes Model. - * - * @param dataGraph - * the data Graph - * @param shapesGraph - * the shapes Graph - * @param reportDetails - * true to also include the sh:detail (more verbose) and false to omit them - * @return - * an option of [[ValidationReport]] with the validation results - */ - def apply( - dataGraph: Graph, - shapesGraph: Graph, - reportDetails: Boolean - )(implicit rcr: RemoteContextResolution): IO[ValidationReport] = - apply(dataGraph, ShaclShapesGraph(shapesGraph), validateShapes = false, reportDetails) - - /** - * Validates a given data Graph against all shapes from a given shapes graph. - * - * @param graph - * the data Graph - * @param shapesGraph - * the shapes graph - * @param validateShapes - * true to also validate the shapes graph - * @param reportDetails - * true to also include the sh:detail (more verbose) and false to omit them - * @return - * an option of [[ValidationReport]] with the validation results - */ - def apply( - graph: Graph, - shapesGraph: ShaclShapesGraph, - validateShapes: Boolean, - reportDetails: Boolean - )(implicit rcr: RemoteContextResolution): IO[ValidationReport] = - apply(DatasetFactory.wrap(graph.value), shapesGraph, validateShapes, reportDetails) - - private def apply( - dataset: Dataset, - shapesGraph: ShaclShapesGraph, - validateShapes: Boolean, - reportDetails: Boolean - )(implicit rcr: RemoteContextResolution): IO[ValidationReport] = { - // Create Dataset that contains both the data model and the shapes model - // (here, using a temporary URI for the shapes graph) - dataset.addNamedModel(shapesGraph.uri.toString, shapesGraph.model) - val engine = new ShaclEngine(dataset, shapesGraph.uri, shapesGraph.value) - engine.setConfiguration( - new ValidationEngineConfiguration().setReportDetails(reportDetails).setValidateShapes(validateShapes) - ) - IO.delay { - engine.applyEntailments() - engine.validateAll() - }.flatMap(ValidationReport(_)) - } -} diff --git a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclFileLoader.scala b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclFileLoader.scala new file mode 100644 index 0000000000..997612ff37 --- /dev/null +++ b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclFileLoader.scala @@ -0,0 +1,28 @@ +package ch.epfl.bluebrain.nexus.delta.rdf.shacl + +import cats.effect.IO +import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceLoader +import org.apache.jena.graph.GraphMemFactory.createDefaultGraph +import org.apache.jena.rdf.model.{Model, ModelFactory} +import org.apache.jena.util.FileUtils +import org.topbraid.shacl.vocabulary.SH + +object ShaclFileLoader { + + private val loader = ClasspathResourceLoader() + + private def readFromTurtleFile(base: String, resourcePath: String) = + loader + .streamOf(resourcePath) + .use { is => + IO.blocking { + ModelFactory + .createModelForGraph(createDefaultGraph()) + .read(is, base, FileUtils.langTurtle) + } + } + + def readShaclShapes: IO[Model] = readFromTurtleFile("http://www.w3.org/ns/shacl-shacl#", "shacl-shacl.ttl") + + def readShaclVocabulary: IO[Model] = readFromTurtleFile(SH.BASE_URI, "rdf/shacl.ttl") +} diff --git a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala deleted file mode 100644 index 106d96ec0c..0000000000 --- a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala +++ /dev/null @@ -1,59 +0,0 @@ -package ch.epfl.bluebrain.nexus.delta.rdf.shacl - -import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceLoader -import ch.epfl.bluebrain.nexus.delta.rdf.graph.Graph -import org.apache.jena.graph.Factory.createDefaultGraph -import org.apache.jena.query.DatasetFactory -import org.apache.jena.rdf.model.{Model, ModelFactory} -import org.apache.jena.util.FileUtils -import org.topbraid.shacl.arq.SHACLFunctions -import org.topbraid.shacl.engine.ShapesGraph -import org.topbraid.shacl.util.SHACLUtil -import org.topbraid.shacl.validation.ValidationUtil - -import java.io.InputStream -import java.net.URI - -/** - * Holds information about the ''ShapesGraph'' - */ -final case class ShaclShapesGraph(uri: URI, value: ShapesGraph) { - val model: Model = value.getShapesModel -} - -object ShaclShapesGraph { - - private val loader = ClasspathResourceLoader() - - /** - * Loads the SHACL shapes graph to validate SHACL shapes graphs - */ - def shaclShaclShapes: IO[ShaclShapesGraph] = - loader - .streamOf("shacl-shacl.ttl") - .use(readModel) - .map(model => validateAndRegister(model)) - - private def readModel(is: InputStream) = { - IO.blocking { - ModelFactory - .createModelForGraph(createDefaultGraph()) - .read(is, "http://www.w3.org/ns/shacl-shacl#", FileUtils.langTurtle) - } - } - - /** - * Creates a [[ShaclShapesGraph]] initializing and registering the required validation components from the passed - * model. - */ - def apply(graph: Graph): ShaclShapesGraph = - validateAndRegister(DatasetFactory.wrap(graph.value).getDefaultModel) - - private def validateAndRegister(model: Model) = { - val finalShapesModel = ValidationUtil.ensureToshTriplesExist(model) - // Make sure all sh:Functions are registered - SHACLFunctions.registerFunctions(finalShapesModel) - ShaclShapesGraph(SHACLUtil.createRandomShapesGraphURI(), new ShapesGraph(finalShapesModel)) - } -} diff --git a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShacl.scala b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShacl.scala new file mode 100644 index 0000000000..e712af9ddb --- /dev/null +++ b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShacl.scala @@ -0,0 +1,104 @@ +package ch.epfl.bluebrain.nexus.delta.rdf.shacl + +import cats.effect.IO +import ch.epfl.bluebrain.nexus.delta.rdf.graph.Graph +import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution +import org.apache.jena.query.DatasetFactory +import org.apache.jena.rdf.model.Model +import org.topbraid.jenax.util.SystemTriples +import org.topbraid.shacl.arq.SHACLFunctions +import org.topbraid.shacl.engine.ShapesGraph +import org.topbraid.shacl.util.SHACLUtil +import org.topbraid.shacl.validation.ValidationEngineConfiguration +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl.ShaclShapesGraph + +import java.net.URI + +final class ValidateShacl(shaclShapes: Model, shaclVocabulary: Model)(implicit rcr: RemoteContextResolution) { + + private val shaclShapesGraph = prepareShapesGraph(shaclShapes) + + /** + * Validates a given graph against the SHACL shapes spec. + * + * @param shapesGraph + * the shapes Graph to test against the SHACL shapes spec + * @param reportDetails + * true to also include the sh:detail (more verbose) and false to omit them + * @return + * an option of [[ValidationReport]] with the validation results + */ + def apply(shapesGraph: Graph, reportDetails: Boolean): IO[ValidationReport] = + validate( + shapesGraph, + shaclShapesGraph, + validateShapes = true, + reportDetails = reportDetails + ) + + /** + * Validates a given data Graph against all shapes from a given shapes graph. + * + * @param graph + * the data Graph + * @param shapesGraph + * the shapes graph + * @param reportDetails + * true to also include the sh:detail (more verbose) and false to omit them + * @return + * an option of [[ValidationReport]] with the validation results + */ + def apply(graph: Graph, shapesGraph: Graph, reportDetails: Boolean): IO[ValidationReport] = { + val s = prepareShapesGraph(DatasetFactory.wrap(shapesGraph.value).getDefaultModel) + validate(graph, s, validateShapes = false, reportDetails = reportDetails) + } + + private def validate( + graph: Graph, + shapesGraph: ShaclShapesGraph, + validateShapes: Boolean, + reportDetails: Boolean + ): IO[ValidationReport] = { + val dataset = DatasetFactory.wrap(graph.value) + for { + engine <- IO.delay { + // Create Dataset that contains both the data model and the shapes model + // (here, using a temporary URI for the shapes graph) + dataset.addNamedModel(shapesGraph.uri.toString, shapesGraph.model) + val engine = new ShaclEngine(dataset, shapesGraph.uri, shapesGraph.value) + engine.setConfiguration( + new ValidationEngineConfiguration() + .setReportDetails(reportDetails) + .setValidateShapes(validateShapes) + ) + engine.applyEntailments() + engine + } + resource <- IO.delay(engine.validateAll()) + report <- ValidationReport(resource) + } yield report + } + + private def prepareShapesGraph(model: Model) = { + val finalShapesModel = model.add(SystemTriples.getVocabularyModel) + model.add(shaclVocabulary) + + // Make sure all sh:Functions are registered + SHACLFunctions.registerFunctions(finalShapesModel) + ShaclShapesGraph(SHACLUtil.createRandomShapesGraphURI(), new ShapesGraph(finalShapesModel)) + } +} + +object ValidateShacl { + + private case class ShaclShapesGraph(uri: URI, value: ShapesGraph) { + val model: Model = value.getShapesModel + } + + def apply(rcr: RemoteContextResolution): IO[ValidateShacl] = + for { + shaclShaclShapes <- ShaclFileLoader.readShaclShapes + shaclVocabulary <- ShaclFileLoader.readShaclVocabulary + } yield new ValidateShacl(shaclShaclShapes, shaclVocabulary)(rcr) + +} diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngineSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngineSpec.scala deleted file mode 100644 index 48d677f40a..0000000000 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclEngineSpec.scala +++ /dev/null @@ -1,70 +0,0 @@ -package ch.epfl.bluebrain.nexus.delta.rdf.shacl - -import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.contexts -import ch.epfl.bluebrain.nexus.delta.rdf.graph.Graph -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.ExpandedJsonLd -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution -import ch.epfl.bluebrain.nexus.delta.rdf.syntax._ -import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec - -class ShaclEngineSpec extends CatsEffectSpec { - - implicit val api: JsonLdApi = JsonLdJavaApi.lenient - - "A ShaclEngine" should { - - implicit val shaclShaclShapes: ShaclShapesGraph = ShaclShapesGraph.shaclShaclShapes.accepted - - val schema = jsonContentOf("shacl/schema.json") - val resource = jsonContentOf("shacl/resource.json") - val shaclResolvedCtx = jsonContentOf("contexts/shacl.json").topContextValueOrEmpty - - implicit val rcr: RemoteContextResolution = RemoteContextResolution.fixed(contexts.shacl -> shaclResolvedCtx) - - val schemaGraph = Graph(ExpandedJsonLd(schema).accepted).rightValue - val schemaShapes = ShaclShapesGraph(schemaGraph) - val resourceGraph = Graph(ExpandedJsonLd(resource).accepted).rightValue - - "validate data form schema mModel" in { - val report = ShaclEngine(resourceGraph, schemaGraph, reportDetails = true).accepted - report.isValid() shouldEqual true - } - - "validate data from schema shapes" in { - val report = ShaclEngine(resourceGraph, schemaShapes, reportDetails = true, validateShapes = false).accepted - report.isValid() shouldEqual true - } - - "validate shapes" in { - ShaclEngine(schemaGraph, reportDetails = true).accepted.isValid() shouldEqual true - } - - "fail validating shapes if unexpected field value" in { - val wrongSchema = schema.replace("minCount" -> 1, "wrong") - val graph = Graph(ExpandedJsonLd(wrongSchema).accepted).rightValue - ShaclEngine(graph, reportDetails = true).accepted.isValid() shouldEqual false - } - - "fail validating data if not matching nodes" in { - val resourceChangedType = resource.replace(keywords.tpe -> "Custom", "Other") - val resourceGraph = Graph(ExpandedJsonLd(resourceChangedType).accepted).rightValue - val r1 = ShaclEngine(resourceGraph, schemaGraph, reportDetails = true).accepted - val r2 = ShaclEngine(resourceGraph, schemaShapes, reportDetails = true, validateShapes = false).accepted - forAll(List(r1, r2)) { report => - report.isValid() shouldEqual false - report.targetedNodes shouldEqual 0 - } - - } - - "fail validating data if wrong field type" in { - val resourceChangedNumber = resource.replace("number" -> 24, "Other") - val resourceGraph = Graph(ExpandedJsonLd(resourceChangedNumber).accepted).rightValue - ShaclEngine(resourceGraph, schemaGraph, reportDetails = true).accepted shouldEqual - ValidationReport(false, 10, jsonContentOf("shacl/failed_number.json")) - } - } - -} diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShaclSuite.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShaclSuite.scala new file mode 100644 index 0000000000..71cb34d73b --- /dev/null +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidateShaclSuite.scala @@ -0,0 +1,65 @@ +package ch.epfl.bluebrain.nexus.delta.rdf.shacl + +import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.contexts +import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.ExpandedJsonLd +import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} +import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords +import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution +import ch.epfl.bluebrain.nexus.delta.rdf.syntax._ +import ch.epfl.bluebrain.nexus.testkit.mu.NexusSuite +import io.circe.Json + +class ValidateShaclSuite extends NexusSuite { + + implicit val api: JsonLdApi = JsonLdJavaApi.lenient + + private val schema = jsonContentOf("shacl/schema.json") + private val data = jsonContentOf("shacl/resource.json") + private val shaclResolvedCtx = jsonContentOf("contexts/shacl.json").topContextValueOrEmpty + + implicit private val rcr: RemoteContextResolution = RemoteContextResolution.fixed(contexts.shacl -> shaclResolvedCtx) + + private val shaclValidation = ValidateShacl(rcr).accepted + + private val schemaGraph = toGraph(schema).accepted + private val dataGraph = toGraph(data).accepted + + private def toGraph(json: Json) = ExpandedJsonLd(json).map(_.toGraph).rethrow + + test("Validate data from schema model") { + shaclValidation(dataGraph, schemaGraph, reportDetails = true).assert(_.isValid()) + } + + test("Fail validating data if not matching nodes") { + val dataChangedType = data.replace(keywords.tpe -> "Custom", "Other") + for { + resourceGraph <- toGraph(dataChangedType) + _ <- shaclValidation(resourceGraph, schemaGraph, reportDetails = true).assert { report => + !report.isValid() && report.targetedNodes == 0 + } + } yield () + } + + test("Fail validating data if wrong field type") { + val dataInvalidNumber = data.replace("number" -> 24, "Other") + val detailedOutput = jsonContentOf("shacl/failed_number.json") + val expectedReport = ValidationReport(conforms = false, 10, detailedOutput) + for { + wrongGraph <- toGraph(dataInvalidNumber) + _ <- shaclValidation(wrongGraph, schemaGraph, reportDetails = true).assertEquals(expectedReport) + } yield () + } + + test("Validate shapes") { + shaclValidation(schemaGraph, reportDetails = true).assert(_.isValid()) + } + + test("Fail validating shapes if unexpected field value") { + val wrongSchema = schema.replace("minCount" -> 1, "wrong") + for { + wrongGraph <- toGraph(wrongSchema) + _ <- shaclValidation(wrongGraph, reportDetails = true).assert(_.isValid() == false) + } yield () + } + +} diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResource.scala b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResource.scala index 9f3aaecba9..d2a9833f79 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResource.scala +++ b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResource.scala @@ -4,8 +4,7 @@ import cats.effect.IO import cats.syntax.all._ import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.contexts -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution -import ch.epfl.bluebrain.nexus.delta.rdf.shacl.{ShaclEngine, ValidationReport} +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.{ValidateShacl, ValidationReport} import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdAssembly import ch.epfl.bluebrain.nexus.delta.sdk.model.ResourceF @@ -52,8 +51,9 @@ trait ValidateResource { object ValidateResource { def apply( - resourceResolution: ResourceResolution[Schema] - )(implicit rcr: RemoteContextResolution): ValidateResource = + resourceResolution: ResourceResolution[Schema], + validateShacl: ValidateShacl + ): ValidateResource = new ValidateResource { override def apply( jsonld: JsonLdAssembly, @@ -77,11 +77,10 @@ object ValidateResource { schemaRef: ResourceRef, schema: ResourceF[Schema] ): IO[ValidationReport] = - ShaclEngine( + validateShacl( jsonld.graph ++ schema.value.ontologies, schema.value.shapes, - reportDetails = true, - validateShapes = false + reportDetails = true ).adaptError { e => ResourceShaclEngineRejection(jsonld.id, schemaRef, e.getMessage) } diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/ValidateSchema.scala b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/ValidateSchema.scala index 5dc0b88a77..39645bf375 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/ValidateSchema.scala +++ b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/ValidateSchema.scala @@ -7,9 +7,8 @@ import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.graph.Graph import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.ExpandedJsonLd import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.JsonLdApi +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.{ValidateShacl, ValidationReport} import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdRejection.InvalidJsonLdFormat -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution -import ch.epfl.bluebrain.nexus.delta.rdf.shacl.{ShaclEngine, ShaclShapesGraph, ValidationReport} trait ValidateSchema { @@ -19,12 +18,12 @@ trait ValidateSchema { object ValidateSchema { - def apply(implicit api: JsonLdApi, shaclShapesGraph: ShaclShapesGraph, rcr: RemoteContextResolution): ValidateSchema = + def apply(validateShacl: ValidateShacl)(implicit api: JsonLdApi): ValidateSchema = new ValidateSchema { override def apply(id: Iri, expanded: NonEmptyList[ExpandedJsonLd]): IO[ValidationReport] = { for { graph <- toGraph(id, expanded) - report <- ShaclEngine(graph, reportDetails = true) + report <- validateShacl(graph, reportDetails = true) } yield report } diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/Schema.scala b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/Schema.scala index 46412b4455..91d2b0ff90 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/Schema.scala +++ b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/Schema.scala @@ -10,7 +10,6 @@ import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi, J import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.{CompactedJsonLd, ExpandedJsonLd} -import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ShaclShapesGraph import ch.epfl.bluebrain.nexus.delta.sdk.ResourceShift import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdContent import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, IdSegmentRef, Tags} @@ -53,7 +52,7 @@ final case class Schema( */ // It is fine to do it unsafely since we have already computed the graph on evaluation previously in order to validate the schema. @transient - lazy val shapes: ShaclShapesGraph = ShaclShapesGraph(graph(_.contains(nxv.Schema))) + lazy val shapes: Graph = graph(_.contains(nxv.Schema)) /** * the Graph representation of the imports that are ontologies diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ResourcesImplSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ResourcesImplSpec.scala index ed93effc4f..531fb928d2 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ResourcesImplSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ResourcesImplSpec.scala @@ -6,10 +6,11 @@ import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv, schema, sche import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution} +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.generators.{ProjectGen, ResourceGen, ResourceResolutionGen, SchemaGen} import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller -import ch.epfl.bluebrain.nexus.delta.sdk.model.Fetch.FetchF import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdRejection._ +import ch.epfl.bluebrain.nexus.delta.sdk.model.Fetch.FetchF import ch.epfl.bluebrain.nexus.delta.sdk.model.{IdSegment, IdSegmentRef, Tags} import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContextDummy import ch.epfl.bluebrain.nexus.delta.sdk.projects.model.ApiMappings @@ -51,7 +52,7 @@ class ResourcesImplSpec implicit private val api: JsonLdApi = JsonLdJavaApi.strict - implicit private def res: RemoteContextResolution = + implicit private val rcr: RemoteContextResolution = RemoteContextResolution.fixedIO( contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), contexts.shacl -> ContextValue.fromFile("contexts/shacl.json"), @@ -91,11 +92,12 @@ class ResourcesImplSpec private val detectChanges = DetectChange(enabled = config.skipUpdateNoChange) private val resolverContextResolution: ResolverContextResolution = new ResolverContextResolution( - res, + rcr, (r, p, _) => resources.fetch(r, p).attempt.map(_.left.map(_ => ResourceResolutionReport())) ) - private val resourceDef = Resources.definition(ValidateResource(resourceResolution), detectChanges, clock) + private val validateResource = ValidateResource(resourceResolution, ValidateShacl(rcr).accepted) + private val resourceDef = Resources.definition(validateResource, detectChanges, clock) private lazy val resourceLog = ScopedEventLog(resourceDef, eventLogConfig, xas) private lazy val resources: Resources = ResourcesImpl( diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResourceSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResourceSuite.scala index 6e33db8e10..9911a48663 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResourceSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/ValidateResourceSuite.scala @@ -6,6 +6,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv, schemas} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.{CompactedJsonLd, ExpandedJsonLd} +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.generators.{ResourceResolutionGen, SchemaGen} import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdAssembly @@ -26,7 +27,7 @@ import munit.Location class ValidateResourceSuite extends NexusSuite { implicit val api: JsonLdApi = JsonLdJavaApi.lenient - implicit private def res: RemoteContextResolution = + implicit private val rcr: RemoteContextResolution = RemoteContextResolution.fixedIO( contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), contexts.shacl -> ContextValue.fromFile("contexts/shacl.json"), @@ -78,7 +79,7 @@ class ValidateResourceSuite extends NexusSuite { jsonLdWithId(id, source) } - private val validateResource = ValidateResource(schemaResolution) + private val validateResource = ValidateResource(schemaResolution, ValidateShacl(rcr).accepted) private def assertResult(result: ValidationResult, expectedProject: ProjectRef, expectedSchema: ResourceRef.Revision)( implicit loc: Location diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasImplSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasImplSuite.scala index bd06c3827a..0dd7ae6475 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasImplSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasImplSuite.scala @@ -7,7 +7,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution} -import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ShaclShapesGraph +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.ConfigFixtures import ch.epfl.bluebrain.nexus.delta.sdk.generators.{ProjectGen, SchemaGen} import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller @@ -36,8 +36,6 @@ class SchemasImplSuite extends NexusSuite with Doobie.Fixture with ConfigFixture private lazy val xas = doobie() - implicit private lazy val shaclShaclShapes: ShaclShapesGraph = ShaclShapesGraph.shaclShaclShapes.accepted - implicit private val subject: Subject = Identity.User("user", Label.unsafe("realm")) implicit private val caller: Caller = Caller(subject, Set(subject)) @@ -46,7 +44,7 @@ class SchemasImplSuite extends NexusSuite with Doobie.Fixture with ConfigFixture implicit private val api: JsonLdApi = JsonLdJavaApi.lenient - implicit def res: RemoteContextResolution = + implicit val rcr: RemoteContextResolution = RemoteContextResolution.fixedIO( contexts.shacl -> ContextValue.fromFile("contexts/shacl.json"), contexts.schemasMetadata -> ContextValue.fromFile("contexts/schemas-metadata.json") @@ -54,7 +52,7 @@ class SchemasImplSuite extends NexusSuite with Doobie.Fixture with ConfigFixture private val schemaImports: SchemaImports = SchemaImports.alwaysFail - private val resolverContextResolution: ResolverContextResolution = ResolverContextResolution(res) + private val resolverContextResolution: ResolverContextResolution = ResolverContextResolution(rcr) private val org = Label.unsafe("myorg") private val am = ApiMappings("nxv" -> nxv.base) @@ -76,7 +74,7 @@ class SchemasImplSuite extends NexusSuite with Doobie.Fixture with ConfigFixture private val fetchContext = FetchContextDummy(Map(project.ref -> project.context), Set(projectDeprecated.ref)) private val config = SchemasConfig(eventLogConfig) - private val schemaDef = Schemas.definition(ValidateSchema.apply, clock) + private val schemaDef = Schemas.definition(ValidateSchema(ValidateShacl(rcr).accepted), clock) private lazy val schemaLog = ScopedEventLog(schemaDef, config.eventLog, xas) private lazy val schemas: Schemas = diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasSpec.scala index 78f24e122c..dcebd7b13b 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/SchemasSpec.scala @@ -3,7 +3,7 @@ package ch.epfl.bluebrain.nexus.delta.sdk.schemas import cats.effect.IO import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv, schemas} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} -import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ShaclShapesGraph +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.generators.{ProjectGen, SchemaGen} import ch.epfl.bluebrain.nexus.delta.sdk.model.Tags import ch.epfl.bluebrain.nexus.delta.sdk.schemas.Schemas._ @@ -26,8 +26,6 @@ class SchemasSpec extends CatsEffectSpec with Fixtures { "The Schemas state machine" when { - implicit val shaclShaclShapes: ShaclShapesGraph = ShaclShapesGraph.shaclShaclShapes.accepted - val epoch = Instant.EPOCH val time2 = Instant.ofEpochMilli(10L) val subject = User("myuser", Label.unsafe("myrealm")) @@ -44,7 +42,7 @@ class SchemasSpec extends CatsEffectSpec with Fixtures { val schemaUpdated = SchemaGen.schema(myId, project.value.ref, sourceUpdated) val eval: (Option[SchemaState], SchemaCommand) => IO[SchemaEvent] = - evaluate(ValidateSchema.apply, clock) + evaluate(ValidateSchema(ValidateShacl(rcr).accepted), clock) "evaluating an incoming command" should { diff --git a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/RunShip.scala b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/RunShip.scala index 70f1e1385f..db996a9813 100644 --- a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/RunShip.scala +++ b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/RunShip.scala @@ -4,6 +4,7 @@ import cats.effect.{Clock, IO} import ch.epfl.bluebrain.nexus.delta.kernel.Logger import ch.epfl.bluebrain.nexus.delta.kernel.utils.UUIDF import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.organizations.FetchActiveOrganization import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContext import ch.epfl.bluebrain.nexus.delta.sdk.projects.model.ApiMappings @@ -50,8 +51,9 @@ class RunShip { // Wiring eventClock <- EventClock.init() remoteContextResolution <- ContextWiring.remoteContextResolution + validateShacl <- ValidateShacl(remoteContextResolution) (schemaLog, fetchSchema) = SchemaWiring(config.eventLog, eventClock, xas) - (resourceLog, fetchResource) = ResourceWiring(fetchContext, fetchSchema, remoteContextResolution, eventLogConfig, eventClock, xas) + (resourceLog, fetchResource) = ResourceWiring(fetchContext, fetchSchema, validateShacl, eventLogConfig, eventClock, xas) rcr = ContextWiring.resolverContextResolution(fetchResource, fetchContext, remoteContextResolution, eventLogConfig, eventClock, xas) schemaImports = SchemaWiring.schemaImports(fetchResource, fetchSchema, fetchContext, eventLogConfig, eventClock, xas) // Processors diff --git a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/resources/ResourceWiring.scala b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/resources/ResourceWiring.scala index 6d7e22126c..fbf112cd07 100644 --- a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/resources/ResourceWiring.scala +++ b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/resources/ResourceWiring.scala @@ -1,7 +1,7 @@ package ch.epfl.bluebrain.nexus.ship.resources import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.JsonLdApi -import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution +import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ValidateShacl import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContext import ch.epfl.bluebrain.nexus.delta.sdk.resolvers.ResourceResolution import ch.epfl.bluebrain.nexus.delta.sdk.resources.Resources.ResourceLog @@ -18,7 +18,7 @@ object ResourceWiring { def apply( fetchContext: FetchContext, fetchSchema: FetchSchema, - remoteContext: RemoteContextResolution, + validateShacl: ValidateShacl, config: EventLogConfig, clock: EventClock, xas: Transactors @@ -29,7 +29,7 @@ object ResourceWiring { val resolvers = ResolverWiring.resolvers(fetchContext, config, clock, xas) val resourceResolution = ResourceResolution.schemaResource(alwaysAuthorize, resolvers, fetchSchema, excludeDeprecated = false) - val validate = ValidateResource(resourceResolution)(remoteContext) + val validate = ValidateResource(resourceResolution, validateShacl) val resourceDef = Resources.definition(validate, detectChange, clock) val log = ScopedEventLog(resourceDef, config, xas) diff --git a/tests/src/test/resources/kg/search/context/bbp-neuroshapes.json b/tests/src/test/resources/kg/context/bbp-neuroshapes.json similarity index 100% rename from tests/src/test/resources/kg/search/context/bbp-neuroshapes.json rename to tests/src/test/resources/kg/context/bbp-neuroshapes.json diff --git a/tests/src/test/resources/kg/search/context/neuroshapes.json b/tests/src/test/resources/kg/context/neuroshapes.json similarity index 100% rename from tests/src/test/resources/kg/search/context/neuroshapes.json rename to tests/src/test/resources/kg/context/neuroshapes.json diff --git a/tests/src/test/resources/kg/schemas/bbp/common-annotation-selector.json b/tests/src/test/resources/kg/schemas/bbp/common-annotation-selector.json new file mode 100644 index 0000000000..8c4d4c946e --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-annotation-selector.json @@ -0,0 +1,378 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/annotationselector/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/annotationselector", + "@type": "Schema", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/annotationselector/shapes/SelectorShape", + "@type": "NodeShape", + "nodeKind": "sh:BlankNodeOrIRI", + "seeAlso": "https://www.w3.org/TR/annotation-model/#selectors" + }, + { + "@id": "https://neuroshapes.org/commons/annotationselector/shapes/TextPositionSelectorShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorShape" + }, + { + "property": [ + { + "datatype": "xsd:integer", + "description": "The starting position of the segment of text. The first character in the full text is character position 0, and the character is included within the segment.", + "lessThan": "oa:end", + "maxCount": 1, + "minCount": 1, + "minInclusive": 0, + "name": "Start offset", + "path": "oa:start" + }, + { + "datatype": "xsd:integer", + "description": "The end position of the segment of text. The character is not included within the segment.", + "maxCount": 1, + "minCount": 1, + "minInclusive": 0, + "name": "End offset", + "path": "oa:end" + }, + { + "datatype": "xsd:string", + "description": "The selected segment of text.", + "maxCount": 1, + "name": "Value", + "path": "schema:value" + } + ] + } + ], + "class": "oa:TextPositionSelector" + }, + { + "@id": "https://neuroshapes.org/commons/annotationselector/shapes/DocumentIndexSelectorShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorShape" + }, + { + "property": [ + { + "datatype": "xsd:string", + "description": "The index of a document media (figure) or item (equation, table,...) (e.g. '1', '2.a', 'III').", + "maxCount": 1, + "minCount": 1, + "name": "Index", + "path": "nsg:index" + } + ] + } + ], + "class": "nsg:DocumentIndexSelector" + }, + { + "@id": "https://neuroshapes.org/commons/annotationselector/shapes/TableSelectorShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:DocumentIndexSelectorShape" + }, + { + "property": [ + { + "description": "The number of the row of a table (e.g. '1', '1, 3').", + "name": "Row number", + "path": "nsg:row" + }, + { + "description": "The index(es) in the table of the columns(s) (e.g. '1', '1, 3').", + "name": "Column index", + "path": "nsg:column" + } + ] + } + ], + "class": "nsg:TableSelector", + "seeAlso": "https://www.w3.org/TR/csv2rdf/" + }, + { + "@id": "https://neuroshapes.org/commons/annotationselector/shapes/FragmentSelectorShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorShape" + }, + { + "property": [ + { + "description": "The contents of the fragment component of an IRI that describes the Segment.", + "maxCount": 1, + "minCount": 1, + "name": "Fragment value", + "path": "schema:value" + }, + { + "description": "Specification of the fragment syntax.", + "maxCount": 1, + "name": "Fragment specification", + "nodeKind": "sh:IRI", + "path": "nsg:conformsTo", + "seeAlso": "https://www.w3.org/TR/annotation-model/#fragment-selector" + } + ] + } + ], + "class": "oa:FragmentSelector", + "nodeKind": "sh:BlankNodeOrIRI" + }, + { + "@id": "https://neuroshapes.org/commons/annotationselector/shapes/DocumentAreaSelectorShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:FragmentSelectorShape" + }, + { + "property": [ + { + "comment": "Used format is page=&viewrect=,,,. , and are measured from the top left corner of the page.", + "hasValue": "http://tools.ietf.org/rfc/rfc3778", + "name": "Specification", + "path": "nsg:conformsTo" + } + ] + } + ], + "class": "nsg:PDFAreaSelector", + "nodeKind": "sh:BlankNodeOrIRI" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-annotation.json b/tests/src/test/resources/kg/schemas/bbp/common-annotation.json new file mode 100644 index 0000000000..42b80b66ff --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-annotation.json @@ -0,0 +1,427 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/annotation/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/annotation", + "@type": "Schema", + "imports": [ + "nsg:commons/entitywithoutannotationsubject", + "nsg:commons/annotationselector" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/AnnotationShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/entitywithoutannotationsubject/shapes/EntityShape" + }, + { + "property": [ + { + "class": "nsg:AnnotationTarget", + "description": "The target of an Annotation: the entity being annotated.", + "name": "Target", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "nsg:hasTarget" + }, + { + "class": "nsg:AnnotationBody", + "description": "The entity or value that the target entity is being annotated with.", + "name": "Body", + "node": "this:HasBodyShape", + "path": "nsg:hasBody" + }, + { + "datatype": "xsd:string", + "description": "A general note, for any purpose. This could include reasons on which an annotation - such as an mType classification - was based.", + "name": "Note", + "path": "skos:note" + }, + { + "class": "nsg:Motivation", + "description": "The relationship between an Annotation and a Motivation that describes the reason for the Annotation's creation.", + "name": "Motivation", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "nsg:motivatedBy", + "seeAlso": "http://www.w3.org/ns/oa#motivatedBy" + } + ] + } + ], + "editorialNote": "The higher level vocabulary (hasTarget, hasBody, hasSource,hasSelector, Annotation) are mapped to the nsg namespace (instead of using oa namespace) for consistency and ease of use purpose. The selector", + "nodeKind": "sh:BlankNodeOrIRI", + "seeAlso": "https://www.w3.org/TR/annotation-model/#introduction" + }, + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/SelectorTargetShape", + "@type": "NodeShape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "description": "The relationship between a Specific Resource and the resource that it is a more specific representation of.", + "maxCount": 1, + "minCount": 1, + "name": "Source", + "path": "nsg:hasSource" + }, + { + "description": "The relationship between a Specific Resource and a Selector.", + "name": "Selector", + "node": "nsg:commons/annotationselector/shapes/SelectorShape", + "path": "nsg:hasSelector" + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/TextPositionTargetShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorTargetShape" + }, + { + "property": [ + { + "maxCount": 1, + "minCount": 1, + "node": "nsg:commons/annotationselector/shapes/TextPositionSelectorShape", + "path": "nsg:hasSelector" + } + ] + } + ], + "class": "nsg:TextPositionTarget" + }, + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/FigureTargetShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorTargetShape" + }, + { + "property": [ + { + "class": "nsg:FigureSelector", + "maxCount": 1, + "minCount": 1, + "node": "nsg:commons/annotationselector/shapes/DocumentIndexSelectorShape", + "path": "nsg:hasSelector" + } + ] + } + ], + "nodeKind": "sh:BlankNodeOrIRI" + }, + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/EquationTargetShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorTargetShape" + }, + { + "property": [ + { + "class": "nsg:EquationSelector", + "maxCount": 1, + "minCount": 1, + "node": "nsg:commons/annotationselector/shapes/DocumentIndexSelectorShape", + "path": "nsg:hasSelector" + } + ] + } + ], + "nodeKind": "sh:BlankNodeOrIRI" + }, + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/TableTargetShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorTargetShape" + }, + { + "property": [ + { + "class": "nsg:TableSelector", + "maxCount": 1, + "minCount": 1, + "node": "nsg:commons/annotationselector/shapes/TableSelectorShape", + "path": "nsg:hasSelector" + } + ] + } + ], + "nodeKind": "sh:BlankNodeOrIRI" + }, + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/HasBodyShape", + "@type": "NodeShape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "datatype": "xsd:string", + "description": "A general note, for any purpose. This could include reasons on which an annotation - such as an mType classification - was based.", + "name": "Note", + "path": "skos:note" + }, + { + "datatype": "xsd:string", + "name": "label", + "path": "rdfs:label" + }, + { + "nodeKind": "sh:IRI", + "path": "rdf:type" + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/annotation/shapes/AreaTargetShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:SelectorTargetShape" + }, + { + "property": [ + { + "maxCount": 1, + "minCount": 1, + "node": "nsg:commons/annotationselector/shapes/DocumentAreaSelectorShape", + "path": "nsg:hasSelector" + } + ] + } + ], + "nodeKind": "sh:BlankNodeOrIRI" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-brainlocation.json b/tests/src/test/resources/kg/schemas/bbp/common-brainlocation.json new file mode 100644 index 0000000000..fc9455f3b8 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-brainlocation.json @@ -0,0 +1,441 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/brainlocation/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/brainlocation", + "@type": "Schema", + "imports": [ + "nsg:commons/quantitativevalue", + "nsg:commons/typedlabeledontologyterm", + "nsg:commons/vector3d" + ], + "label": "Brain Location Schema", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/brainlocation/shapes/BrainLocationShape", + "@type": "NodeShape", + "label": "Brain location shape definition", + "property": [ + { + "description": "Coordinates in slice", + "name": "Coordinates in slice", + "node": { + "@id": "https://neuroshapes.org/commons/brainlocation/shapes/CoordinatesInSliceShape", + "@type": "NodeShape", + "label": "Coordinates in slice shape definition", + "property": [ + { + "class": "nsg:SpatialReferenceSystem", + "name": "Spatial Reference System", + "path": "nsg:spatialReferenceSystem", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "datatype": "xsd:float", + "description": "Vector value of X", + "name": "X value", + "path": "nsg:valueX", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "datatype": "xsd:float", + "description": "Vector value of Y", + "name": "Y value", + "path": "nsg:valueY", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "datatype": "xsd:float", + "description": "Vector value of Z", + "name": "Z value", + "path": "nsg:valueZ", + "sh:maxCount": 1 + } + ] + }, + "path": "nsg:coordinatesInSlice", + "sh:maxCount": 1 + }, + { + "description": "Coordinates in brain atlas", + "name": "Coordinates in brain atlas", + "node": { + "@id": "https://neuroshapes.org/commons/brainlocation/shapes/CoordinatesInBrainAtlasShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/vector3d/shapes/Vector3DShape" + } + ], + "label": "Coordinates in brain atlas shape definition" + }, + "path": "nsg:coordinatesInBrainAtlas", + "sh:maxCount": 1 + }, + { + "class": "nsg:AtlasSpatialReferenceSystem", + "name": "Atlas Spatial Reference System", + "path": "nsg:atlasSpatialReferenceSystem", + "sh:maxCount": 1 + }, + { + "description": "Distance to boundary", + "name": "Distance to boundary", + "node": { + "@id": "https://neuroshapes.org/commons/brainlocation/shapes/DistanceToBoundaryShape", + "@type": "NodeShape", + "label": "Distance to boundary shape definition", + "property": [ + { + "description": "Distance", + "name": "Distance", + "node": "nsg:commons/quantitativevalue/shapes/QuantitativeValueShape", + "path": "schema:distance", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "name": "Boundary", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:boundary", + "sh:maxCount": 1, + "sh:minCount": 1 + } + ] + }, + "path": "nsg:distanceToBoundary", + "sh:maxCount": 1 + }, + { + "description": "Brain region region (e.g. layer of the neocortex)", + "name": "Brain region layer", + "node": "nsg:commons/typedlabeledontologyterm/shapes/BrainRegionOntologyTermShape", + "path": "nsg:layer" + }, + { + "in": [ + "Dorsal", + "Ventral" + ], + "name": "Longitudinal axis (dorsal / ventral)", + "path": "nsg:longitudinalAxis", + "sh:maxCount": 1 + }, + { + "description": "Brain region", + "name": "Brain region", + "node": "nsg:commons/typedlabeledontologyterm/shapes/BrainRegionOntologyTermShape", + "path": "nsg:brainRegion", + "sh:minCount": 1 + }, + { + "description": "Position in layer (deep / superficial)", + "in": [ + "Deep", + "Superficial" + ], + "name": "Position in layer", + "path": "nsg:positionInLayer", + "sh:maxCount": 1 + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/brainlocation/shapes/CoordinatesInBrainAtlasShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/vector3d/shapes/Vector3DShape" + } + ], + "label": "Coordinates in brain atlas shape definition" + }, + { + "@id": "https://neuroshapes.org/commons/brainlocation/shapes/CoordinatesInSliceShape", + "@type": "NodeShape", + "label": "Coordinates in slice shape definition", + "property": [ + { + "class": "nsg:SpatialReferenceSystem", + "name": "Spatial Reference System", + "path": "nsg:spatialReferenceSystem", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "datatype": "xsd:float", + "description": "Vector value of X", + "name": "X value", + "path": "nsg:valueX", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "datatype": "xsd:float", + "description": "Vector value of Y", + "name": "Y value", + "path": "nsg:valueY", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "datatype": "xsd:float", + "description": "Vector value of Z", + "name": "Z value", + "path": "nsg:valueZ", + "sh:maxCount": 1 + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/brainlocation/shapes/DistanceToBoundaryShape", + "@type": "NodeShape", + "label": "Distance to boundary shape definition", + "property": [ + { + "description": "Distance", + "name": "Distance", + "node": "nsg:commons/quantitativevalue/shapes/QuantitativeValueShape", + "path": "schema:distance", + "sh:maxCount": 1, + "sh:minCount": 1 + }, + { + "name": "Boundary", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:boundary", + "sh:maxCount": 1, + "sh:minCount": 1 + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-collection.json b/tests/src/test/resources/kg/schemas/bbp/common-collection.json new file mode 100644 index 0000000000..311508a53b --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-collection.json @@ -0,0 +1,264 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/collection/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/collection", + "@type": "Schema", + "imports": [ + "nsg:commons/entity", + "https://provshapes.org/commons/collection" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/collection/shapes/CollectionShape", + "@type": "NodeShape", + "and": [ + { + "node": "https://provshapes.org/commons/collection/shapes/CollectionShape" + }, + { + "node": "nsg:commons/entity/shapes/EntityShape" + }, + { + "property": [ + { + "datatype": "xsd:integer", + "description": "Collection size. The collection can be empty with size 0.", + "maxCount": 1, + "minInclusive": 0, + "name": "Size", + "path": "schema:size" + } + ] + } + ], + "label": "A collection shape.", + "nodeKind": "sh:BlankNodeOrIRI" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-contribution.json b/tests/src/test/resources/kg/schemas/bbp/common-contribution.json new file mode 100644 index 0000000000..630661f305 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-contribution.json @@ -0,0 +1,260 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/contribution/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/contribution", + "@type": "Schema", + "imports": [ + "nsg:commons/typedlabeledontologyterm" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/contribution/shapes/ContributionShape", + "@type": "NodeShape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "class": "prov:Plan", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "prov:hadPlan" + }, + { + "node": "nsg:commons/typedlabeledontologyterm/shapes/RoleOntologyTermShape", + "path": "prov:hadRole" + }, + { + "class": "prov:Agent", + "maxCount": 1, + "minCount": 1, + "nodeKind": "sh:IRI", + "path": "prov:agent" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-derivation.json b/tests/src/test/resources/kg/schemas/bbp/common-derivation.json new file mode 100644 index 0000000000..18bf1cbdf5 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-derivation.json @@ -0,0 +1,264 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://provshapes.org/commons/derivation/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://provshapes.org/commons/derivation", + "@type": "Schema", + "shapes": [ + { + "@id": "https://provshapes.org/commons/derivation/shapes/DerivationShape", + "@type": "NodeShape", + "comment": "A derivation is a transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a pre-existing entity.", + "label": "Entity derivation shape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "description": "An entity from which the current one derived from.", + "maxCount": 1, + "minCount": 1, + "name": "Entity", + "path": "prov:entity" + }, + { + "class": "prov:Activity", + "description": "The optional activity that used the entity from which the current one derived from.", + "maxCount": 1, + "name": "Activity", + "path": "prov:hadActivity" + }, + { + "class": "prov:Usage", + "description": "Usage is the beginning of utilizing an entity by an activity. Before usage, the activity had not begun to utilize this entity and could not have been affected by the entity..", + "maxCount": 1, + "name": "Usage", + "path": "prov:hadUsage" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-distribution.json b/tests/src/test/resources/kg/schemas/bbp/common-distribution.json new file mode 100644 index 0000000000..bcf87a98ca --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-distribution.json @@ -0,0 +1,321 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/distribution/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/distribution", + "@type": "Schema", + "imports": [ + "nsg:commons/quantitativevalue" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/distribution/shapes/DistributionShape", + "@type": "NodeShape", + "and": [ + { + "or": [ + { + "property": [ + { + "description": "When followed this link leads to the actual data.", + "maxCount": 1, + "minCount": 1, + "nodeKind": "sh:IRI", + "path": "schema:contentUrl" + } + ] + }, + { + "property": [ + { + "description": "When followed this link leads to a resource providing further description on how to download the attached data.", + "maxCount": 1, + "minCount": 1, + "nodeKind": "sh:IRI", + "path": "schema:url" + } + ] + } + ] + }, + { + "property": [ + { + "maxCount": 1, + "node": "nsg:commons/quantitativevalue/shapes/PositiveQuantitativeValueShape", + "path": "schema:contentSize" + }, + { + "node": "this:DigestShape", + "path": "nsg:digest" + }, + { + "description": "A Link towards the distribution license.", + "path": "schema:license" + }, + { + "datatype": "xsd:string", + "description": "The distribution name.", + "path": "schema:name" + }, + { + "comment": "The pattern used here is temporary and not complete. The media type values need to be taken from a controlled vocabulary: to be handled in a next iteration.", + "datatype": "xsd:string", + "description": "The media value should start with one of the following application|audio|font|image|message|model|multipart|text|video followed by / and then any Alphanumeric characters.", + "maxCount": 1, + "path": "schema:encodingFormat", + "pattern": "^(application|audio|font|image|message|model|multipart|text|video)/[A-Za-z0-9]+" + } + ] + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/distribution/shapes/DigestShape", + "@type": "NodeShape", + "property": [ + { + "datatype": "xsd:string", + "description": "The digest value.", + "maxCount": 1, + "minCount": 1, + "name": "Digest", + "path": "schema:value" + }, + { + "datatype": "xsd:string", + "description": "The digest algorithm.", + "maxCount": 1, + "minCount": 1, + "name": "Algorithm", + "path": "schema:algorithm" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-entity.json b/tests/src/test/resources/kg/schemas/bbp/common-entity.json new file mode 100644 index 0000000000..e924be5b52 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-entity.json @@ -0,0 +1,269 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/entity/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/entity", + "@type": "nxv:Schema", + "imports": [ + "https://neuroshapes.org/commons/subject", + "https://neuroshapes.org/commons/annotation", + "https://neuroshapes.org/commons/entitywithoutannotationsubject" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/entity/shapes/EntityShape", + "@type": "sh:NodeShape", + "and": [ + { + "node": "https://neuroshapes.org/commons/entitywithoutannotationsubject/shapes/EntityShape" + }, + { + "property": [ + { + "class": "nsg:Annotation", + "description": "Annotations of the dataset.", + "name": "Annotation", + "node": "nsg:commons/annotation/shapes/AnnotationShape", + "path": "nsg:annotation" + }, + { + "class": "nsg:Subject", + "description": "The subject of the study. This data represent an observation of this subject.", + "editorialNote": "Asserted subject entity. It may differ from the subject from the provenance.", + "name": "Subject", + "node": "nsg:commons/subject/shapes/SubjectShape", + "path": "nsg:subject" + } + ] + } + ], + "comment": "An entity is a physical, digital, conceptual, or other kind of thing with some fixed aspects; entities may be real or imaginary.", + "label": "Entity shape" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-entitywithoutannotationsubject.json b/tests/src/test/resources/kg/schemas/bbp/common-entitywithoutannotationsubject.json new file mode 100644 index 0000000000..092120f0f1 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-entitywithoutannotationsubject.json @@ -0,0 +1,443 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/entitywithoutannotationsubject/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/entitywithoutannotationsubject", + "@type": "nxv:Schema", + "editorialNote": "This is a helper schema to avoid recursive imports of annoation and entity: an annotation is an entity while an entity can have an annotation.", + "imports": [ + "https://neuroshapes.org/commons/identifier", + "https://neuroshapes.org/commons/license", + "https://neuroshapes.org/commons/language", + "https://neuroshapes.org/commons/contribution", + "https://provshapes.org/commons/generation", + "https://neuroshapes.org/commons/distribution", + "https://provshapes.org/commons/invalidation", + "https://provshapes.org/commons/derivation", + "https://neuroshapes.org/commons/brainlocation", + "https://neuroshapes.org/commons/labeledontologyentity" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/entitywithoutannotationsubject/shapes/EntityShape", + "@type": "sh:NodeShape", + "comment": "An entity is a physical, digital, conceptual, or other kind of thing with some fixed aspects; entities may be real or imaginary.", + "label": "Entity shape", + "property": [ + { + "datatype": "xsd:string", + "description": "The entity name.", + "maxCount": 1, + "minCount": 1, + "name": "Name", + "path": "schema:name" + }, + { + "datatype": "xsd:string", + "description": "The entity description", + "maxCount": 1, + "name": "Description", + "path": "schema:description" + }, + { + "description": "URI of an entity sharing the same identity.", + "name": "Same as", + "nodeKind": "sh:IRI", + "path": "schema:sameAs" + }, + { + "description": "The dataset language.", + "maxCount": 1, + "name": "Language", + "node": "https://neuroshapes.org/commons/language/shapes/LanguageShape", + "path": "schema:language" + }, + { + "description": "Identifier", + "name": "Identifier", + "node": "https://neuroshapes.org/commons/identifier/shapes/IdentifierShape", + "path": "schema:identifier" + }, + { + "description": "A citation or reference to another creative work, such as another publication, web page, scholarly article, etc.", + "name": "Citation", + "or": [ + { + "datatype": "xsd:string" + }, + { + "nodeKind": "sh:IRI" + } + ], + "path": "schema:citation" + }, + { + "class": "nsg:License", + "description": "A Link towards the dataset license.", + "name": "License", + "node": "https://neuroshapes.org/commons/license/shapes/LicenseShape", + "path": "schema:license", + "seeAlso": "https://github.com/creativecommons/cc.licenserdf" + }, + { + "datatype": "xsd:dateTime", + "description": "Date at which this entity was created.", + "maxCount": 1, + "name": "Creation date", + "path": "schema:dateCreated" + }, + { + "description": "The entity for which this entity is a revision of. An entity revision is a specific type of derivation.", + "maxCount": 1, + "name": "Revision of", + "nodeKind": "sh:IRI", + "path": "prov:wasRevisionOf" + }, + { + "description": "The entity from which this entity was derived from.", + "name": "Derived from", + "nodeKind": "sh:IRI", + "path": "prov:wasDerivedFrom" + }, + { + "description": "A landing page describing the entity.", + "name": "URL", + "nodeKind": "sh:IRI", + "path": "schema:url" + }, + { + "datetype": "xsd:dateTime", + "description": "The date of the last update of this entity.", + "maxCount": 1, + "name": "Update date", + "path": "schema:dateModified" + }, + { + "datatype": "xsd:string", + "description": "Keywords describing the entity.", + "name": "Keywords", + "path": "schema:keywords" + }, + { + "description": "The agent to which this entity was attributed to.", + "name": "Attributed to", + "nodeKind": "sh:IRI", + "path": "prov:wasAttributedTo" + }, + { + "class": "prov:Derivation", + "description": "A derivation is a transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a pre-existing entity.", + "name": "Qualified Derivation", + "node": "https://provshapes.org/commons/derivation/shapes/DerivationShape", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "nsg:derivation" + }, + { + "class": "nsg:Contribution", + "description": "Information about the contribution of an agent during the generation of this dataset.", + "name": "Qualified Contribution", + "node": "https://neuroshapes.org/commons/contribution/shapes/ContributionShape", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "nsg:contribution" + }, + { + "class": "prov:Generation", + "description": "Generation.", + "name": "Qualified Generation", + "node": "https://provshapes.org/commons/generation/shapes/GenerationShape", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "nsg:generation" + }, + { + "class": "prov:Invalidation", + "description": "Invalidation.", + "name": "Qualified Invalidation", + "node": "https://provshapes.org/commons/invalidation/shapes/InvalidationShape", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "nsg:invalidation" + }, + { + "description": "A reference to an entity representing an image that can be used as preview.", + "name": "Preview", + "nodeKind": "sh:IRI", + "path": "schema:image" + }, + { + "class": "schema:DataDownload", + "description": "A dataset in downloadable form. The downloadable form has a specific format and is located at a specific location.", + "name": "Distribution", + "node": "https://neuroshapes.org/commons/distribution/shapes/DistributionShape", + "path": "schema:distribution" + }, + { + "description": "Sub-parts of the entity.", + "name": "Has Part", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "schema:hasPart" + }, + { + "description": "What the entity is a part of.", + "name": "Is Part Of", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "schema:isPartOf" + }, + { + "class": "nsg:ObjectOfStudy", + "description": "Object of Study", + "editorialNote": "The object of study ", + "name": "Object of Study", + "node": "https://neuroshapes.org/commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:objectOfStudy" + }, + { + "class": "nsg:AtlasRelease", + "name": "Atlas Release", + "nodeKind": "sh:IRI", + "path": "nsg:atlasRelease" + }, + { + "class": "nsg:BrainAtlasSpatialReferenceSystem", + "nodeKind": "sh:IRI", + "path": "nsg:isRegisteredIn" + }, + { + "description": "The Brain location object.", + "name": "Brain Location", + "node": "nsg:commons/brainlocation/shapes/BrainLocationShape", + "path": "nsg:brainLocation" + }, + { + "description": "The subject matter of the content.", + "name": "About", + "nodeKind": "sh:IRI", + "path": "schema:about" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-generation.json b/tests/src/test/resources/kg/schemas/bbp/common-generation.json new file mode 100644 index 0000000000..0478cc1030 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-generation.json @@ -0,0 +1,257 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://provshapes.org/commons/generation/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://provshapes.org/commons/generation", + "@type": "Schema", + "shapes": [ + { + "@id": "https://provshapes.org/commons/generation/shapes/GenerationShape", + "@type": "NodeShape", + "comment": "An instance of prov:Generation provides additional descriptions about the binary prov:wasGeneratedBy relation from a generated prov:Entity to the prov:Activity that generated it. For example, :cake prov:wasGeneratedBy :baking; prov:qualifiedGeneration [ a prov:Generation; prov:activity :baking; :foo :bar ]. Generation is the completion of production of a new entity by an activity. This entity did not exist before generation and becomes available for usage after this generation.", + "label": "Entity generation shape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "datatype": "xsd:dateTime", + "description": "The time at which the entity was generated.", + "maxCount": 1, + "name": "At time", + "path": "prov:atTime" + }, + { + "description": "The activity that generates the entity.", + "maxCount": 1, + "name": "Activity", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "prov:activity" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-identifier.json b/tests/src/test/resources/kg/schemas/bbp/common-identifier.json new file mode 100644 index 0000000000..e786098bad --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-identifier.json @@ -0,0 +1,329 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/identifier/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/identifier", + "@type": "Schema", + "imports": [ + "nsg:commons/propertyvalue" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/identifier/shapes/IdentifierShape", + "@type": "NodeShape", + "property": [ + { + "@id": "https://neuroshapes.org/commons/identifier/shapes/WithIdentifierPropertyShape", + "description": "The identifier property represents any kind of identifier for any kind of Thing, such as ISBNs, GTIN codes, UUIDs.", + "name": "Identifier", + "path": "schema:identifier", + "xone": [ + { + "nodeKind": "sh:IRI" + }, + { + "datatype": "xsd:string" + }, + { + "node": "nsg:commons/propertyvalue/shapes/PropertyValueShape" + } + ] + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/identifier/shapes/WithStructuredIdentifierShape", + "@type": "PropertyShape", + "label": "Key value type of identifier.", + "node": "nsg:commons/propertyvalue/shapes/PropertyValueShape", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "schema:identifier" + }, + { + "@id": "https://neuroshapes.org/commons/identifier/shapes/WithOrcidIdentifierPropertyShape", + "@type": "PropertyShape", + "and": [ + { + "node": "nsg:commons/propertyvalue/shapes/PropertyValueShape" + }, + { + "or": [ + { + "property": [ + { + "datatype": "xsd:string", + "description": "The property name.", + "hasValue": "http//orcid.org", + "maxCount": 1, + "name": "Orcid ID", + "path": "schema:propertyID" + } + ] + }, + { + "property": [ + { + "datatype": "xsd:string", + "description": "The property name.", + "hasValue": "orcid", + "maxCount": 1, + "name": "Orcid ID", + "path": "schema:name" + } + ] + } + ] + }, + { + "property": [ + { + "description": "The orcid identifier", + "maxCount": 1, + "minCount": 1, + "name": "Orcid", + "nodeKind": "sh:IRI", + "path": "schema:value" + } + ] + } + ], + "label": "A shape for an ORCID based researcher identifier.", + "nodeKind": "sh:BlankNodeOrIRI", + "path": "schema:identifier", + "seeAlso": "https://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier" + }, + { + "@id": "https://neuroshapes.org/commons/identifier/shapes/WithGridIdentifierPropertyShape", + "@type": "PropertyShape", + "label": "A shape for GRID (https://www.grid.ac) based organization identifier.", + "path": "schema:identifier", + "pattern": "^(https://www.grid.ac)", + "seeAlso": "https://www.grid.ac" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-invalidation.json b/tests/src/test/resources/kg/schemas/bbp/common-invalidation.json new file mode 100644 index 0000000000..5fdac855d3 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-invalidation.json @@ -0,0 +1,258 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://provshapes.org/commons/invalidation/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://provshapes.org/commons/invalidation", + "@type": "Schema", + "shapes": [ + { + "@id": "https://provshapes.org/commons/invalidation/shapes/InvalidationShape", + "@type": "NodeShape", + "comment": "Invalidation is the start of the destruction, cessation, or expiry of an existing entity by an activity. The entity is no longer available for use (or further invalidation) after invalidation. Any generation or usage of an entity precedes its invalidation.", + "label": "Entity Invalidation shape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "datatype": "xsd:dateTime", + "description": "The time at which the entity was invalidated.", + "maxCount": 1, + "name": "At time", + "path": "prov:atTime" + }, + { + "class": "prov:Activity", + "description": "The activity that invalidates the entity.", + "maxCount": 1, + "name": "Activity", + "nodeKind": "sh:IRI", + "path": "prov:activity" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-labeledontologyentity.json b/tests/src/test/resources/kg/schemas/bbp/common-labeledontologyentity.json new file mode 100644 index 0000000000..ab70ff164a --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-labeledontologyentity.json @@ -0,0 +1,248 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/labeledontologyentity/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/labeledontologyentity", + "@type": "Schema", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "@type": "NodeShape", + "nodeKind": "sh:IRI", + "property": [ + { + "datatype": "xsd:string", + "description": "Human readable label.", + "minCount": 1, + "name": "Label", + "path": "rdfs:label" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-language.json b/tests/src/test/resources/kg/schemas/bbp/common-language.json new file mode 100644 index 0000000000..0a446de3fb --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-language.json @@ -0,0 +1,253 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/language/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/language", + "@type": "Schema", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/language/shapes/LanguageShape", + "@type": "NodeShape", + "comment": "A shape to represent natural languages.", + "property": [ + { + "datatype": "xsd:string", + "description": "The Language name (e.g English).", + "name": "Name", + "path": "schema:name" + }, + { + "datatype": "xsd:string", + "description": "An alias for the language name (e.g English => en).", + "name": "Alias", + "path": "schema:alternateName" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-license.json b/tests/src/test/resources/kg/schemas/bbp/common-license.json new file mode 100644 index 0000000000..d59f3a5131 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-license.json @@ -0,0 +1,243 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/license/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/license", + "@type": "Schema", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/license/shapes/LicenseShape", + "@type": "NodeShape", + "nodeKind": "sh:BlankNodeOrIRI", + "seeAlso": [ + "https://www.w3.org/TR/vocab-dcat", + "https://github.com/creativecommons/cc.licenserdf" + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-minds.json b/tests/src/test/resources/kg/schemas/bbp/common-minds.json new file mode 100644 index 0000000000..1e1d6e87ef --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-minds.json @@ -0,0 +1,295 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/minds/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/minds", + "@type": "Schema", + "imports": [ + "nsg:commons/entity" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/minds/shapes/MINDSShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/entity/shapes/EntityShape" + }, + { + "property": [ + { + "description": "The dataset release date.", + "maxCount": 1, + "name": "Release date", + "path": "schema:releaseDate" + }, + { + "description": "The dataset type.", + "minCount": 1, + "name": "Type", + "nodeKind": "sh:IRI", + "path": "rdf:type" + }, + { + "maxCount": 1, + "path": "nsg:isRegisteredIn" + }, + { + "maxCount": 1, + "path": "nsg:atlasRelease" + }, + { + "minCount": 1, + "path": "nsg:subject" + }, + { + "minCount": 1, + "path": "nsg:brainLocation" + }, + { + "class": "nsg:Contribution", + "minCount": 1, + "path": "nsg:contribution" + }, + { + "minCount": 1, + "path": "schema:distribution" + } + ] + } + ], + "label": "Minimum Information about a Neuroscience DataSet", + "nodeKind": "sh:BlankNodeOrIRI", + "seeAlso": [ + "https://www.w3.org/TR/vocab-dcat", + "https://schema.org", + "https://www.w3.org/TR/prov-o" + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-propertyvalue.json b/tests/src/test/resources/kg/schemas/bbp/common-propertyvalue.json new file mode 100644 index 0000000000..1b8ef7ab84 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-propertyvalue.json @@ -0,0 +1,253 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/propertyvalue/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/propertyvalue", + "@type": "Schema", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/propertyvalue/shapes/PropertyValueShape", + "@type": "NodeShape", + "property": [ + { + "datatype": "xsd:string", + "description": "The property name.", + "maxCount": 1, + "name": "Property ID", + "path": "schema:propertyID" + }, + { + "description": "The property value.", + "maxCount": 1, + "name": "Value", + "path": "schema:value" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-quantitative-value.json b/tests/src/test/resources/kg/schemas/bbp/common-quantitative-value.json new file mode 100644 index 0000000000..b0b65968c0 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-quantitative-value.json @@ -0,0 +1,383 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/quantitativevalue/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/quantitativevalue", + "@type": "Schema", + "imports": [ + "nsg:commons/unit" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/quantitativevalue/shapes/QuantitativeValueShape", + "@type": "NodeShape", + "property": [ + { + "description": "The value of the quantitative value or property value node.", + "maxCount": 1, + "minCount": 1, + "name": "Value", + "or": [ + { + "datatype": "xsd:float" + }, + { + "datatype": "xsd:decimal" + }, + { + "datatype": "xsd:double" + }, + { + "datatype": "xsd:int" + }, + { + "datatype": "xsd:long" + }, + { + "datatype": "xsd:unsignedInt" + }, + { + "datatype": "xsd:unsignedLong" + }, + { + "datatype": "xsd:integer" + } + ], + "path": "schema:value" + }, + "nsg:commons/unit/shapes/WithUnitCodeShape" + ] + }, + { + "@id": "https://neuroshapes.org/commons/quantitativevalue/shapes/RepeatedQuantitativeValueShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:QuantitativeValueShape" + }, + { + "property": [ + { + "description": "Number of repetitions of an activity (a measurement for example).", + "maxCount": 1, + "minCount": 1, + "name": "Repetitions", + "path": "schema:repetitions", + "xone": [ + { + "datatype": "xsd:integer" + }, + { + "node": "this:QuantitativeValueShape" + } + ] + } + ] + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/quantitativevalue/shapes/PositiveQuantitativeValueShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:QuantitativeValueShape" + }, + { + "property": [ + { + "minInclusive": 0, + "path": "schema:value" + } + ] + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/quantitativevalue/shapes/NegativeQuantitativeValueShape", + "@type": "NodeShape", + "and": [ + { + "node": "this:QuantitativeValueShape" + }, + { + "property": [ + { + "maxExclusive": 0, + "path": "schema:value" + } + ] + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/quantitativevalue/shapes/RangeQuantitativeValueShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/unit/shapes/UnitShape" + }, + { + "or": [ + { + "property": [ + { + "description": "The minimum value of the quantitative value.", + "lessThan": "schema:maxValue", + "maxCount": 1, + "minCount": 1, + "name": "Minimum value", + "path": "schema:minValue" + } + ] + }, + { + "property": [ + { + "description": "The maximum value of the quantitative value.", + "maxCount": 1, + "minCount": 1, + "name": "Maximum value", + "path": "schema:maxValue" + } + ] + } + ] + }, + { + "property": [ + { + "minCount": 0, + "path": "schema:value" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-subject.json b/tests/src/test/resources/kg/schemas/bbp/common-subject.json new file mode 100644 index 0000000000..33cd4cc90a --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-subject.json @@ -0,0 +1,370 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/subject/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/subject", + "@type": "Schema", + "imports": [ + "nsg:commons/labeledontologyentity", + "nsg:commons/quantitativevalue" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/subject/shapes/SubjectShape", + "@type": "NodeShape", + "comment": "Subject used in experiment", + "label": "Subject shape definition", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "description": "The species of the subject", + "maxCount": 1, + "minCount": 1, + "name": "Species", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:species" + }, + { + "description": "Subject strain", + "maxCount": 1, + "name": "Strain", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:strain" + }, + { + "description": "Transgenic modification of subject", + "maxCount": 1, + "name": "Transgenic", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:transgenic" + }, + { + "description": "The sex of the subject", + "maxCount": 1, + "name": "Sex", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:sex" + }, + { + "description": "The age of the subject.", + "maxCount": 1, + "name": "Age", + "node": "this:AgeShape", + "path": "nsg:age" + }, + { + "datatype": "xsd:dateTime", + "description": "Date of birth of subject.", + "lessThan": "schema:deathDate", + "maxCount": 1, + "name": "Date of birth", + "path": "schema:birthDate" + }, + { + "datatype": "xsd:dateTime", + "description": "Date of sacrifice of subject.", + "maxCount": 1, + "name": "Date of sacrifice", + "path": "schema:deathDate" + }, + { + "datatype": "xsd:dateTime", + "description": "Date of surgery of subject.", + "maxCount": 1, + "name": "Date of surgery", + "path": "nsg:dateOfSurgery" + }, + { + "description": "Disease modeled in subject.", + "maxCount": 1, + "name": "Disease", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:diseaseModel" + }, + { + "description": "Disease of subject.", + "maxCount": 1, + "name": "Disease", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:disease" + }, + { + "description": "Treatment of the subject.", + "maxCount": 1, + "name": "Treatment", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "path": "nsg:treatment" + }, + { + "description": "Weight of the subject.", + "maxCount": 1, + "name": "Weight", + "or": [ + { + "node": "nsg:commons/quantitativevalue/shapes/QuantitativeValueShape" + }, + { + "node": "nsg:commons/quantitativevalue/shapes/RangeQuantitativeValueShape" + } + ], + "path": "schema:weight" + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/subject/shapes/AgeShape", + "@type": "NodeShape", + "and": [ + { + "or": [ + { + "node": "nsg:commons/quantitativevalue/shapes/QuantitativeValueShape" + }, + { + "node": "nsg:commons/quantitativevalue/shapes/RangeQuantitativeValueShape" + } + ] + }, + { + "property": [ + { + "in": [ + "Pre-natal", + "Post-natal" + ], + "maxCount": 1, + "minCount": 1, + "name": "Period", + "path": "nsg:period" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-typedlabeledontologyterm.json b/tests/src/test/resources/kg/schemas/bbp/common-typedlabeledontologyterm.json new file mode 100644 index 0000000000..fe18d72b10 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-typedlabeledontologyterm.json @@ -0,0 +1,459 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm", + "@type": "Schema", + "imports": [ + "nsg:commons/labeledontologyentity" + ], + "rdfs:label": "Typed labeled Ontology term", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/StimulusTypeOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a stimulus type." + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/ActivityTypeOntologyTermShape", + "@type": "NodeShape", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "nsg:expectedRootClass": { + "@id": "http://www.w3.org/ns/prov#Activity", + "nsg:definingOntology": { + "@id": "https://neuroshapes.org/" + }, + "rdfs:label": "Activity type ontology" + }, + "rdfs:label": "The shape of an ontology term representing an activity type" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/CellTypeOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "nsg:expectedRootClass": { + "@id": "https://neuroshapes.org/CellType", + "rdfs:label": "Cell Type Ontology." + }, + "rdfs:label": "The shape of an ontology term representing a cell type" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/BrainRegionOntologyTermShape", + "@type": "NodeShape", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "nsg:expectedRootClass": { + "@id": "https://neuroshapes.org/BrainRegion", + "nsg:definingOntology": { + "@id": "http://bbp.epfl.ch/neurosciencegraph/ontologies/brainregion" + }, + "rdfs:label": "Brain Region ontology" + }, + "rdfs:label": "The shape of an ontology term representing a brain region" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/LabelingCompoundOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a labeling compound" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/SpeciesOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "nsg:expectedRootClass": { + "@id": "https://neuroshapes.org/Species", + "isDefinedBy": "http://bbp.epfl.ch/neurosciencegraph/ontologies/speciestaxonomy", + "rdfs:label": "NCBI species taxonomy ontology" + }, + "rdfs:label": "The shape of an ontology term representing a species" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/UnitOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a unit code" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/GeneOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a gene" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/LicenseOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a license" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/MorphologicalCellTypeOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a morphological cell type" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/StrainOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "nsg:expectedRootClass": { + "@id": "https://neuroshapes.org/Strain", + "isDefinedBy": "http://bbp.epfl.ch/neurosciencegraph/ontologies/strain", + "rdfs:label": "Animal strain" + }, + "rdfs:label": "The shape of an ontology term representing an animal strain" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/LayerOntologyTermShape", + "@type": "NodeShape", + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape", + "rdfs:label": "The shape of an ontology term representing brain parcellation layers" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/RoleOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a role" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/SomaTypeTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing the types of somas of the reconstructed cell" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/CellLineOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a cell line" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/ObjectiveTypeOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a microscope objective type" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/ElectricalCellTypeOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing an electrical cell type" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/EcodeOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing an eCode" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/SexOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "nsg:expectedRootClass": { + "@id": "https://neuroshapes.org/BiologicalSex", + "isDefinedBy": "http://bbp.epfl.ch/neurosciencegraph/ontologies/sex", + "rdfs:label": "Biological Sex" + }, + "rdfs:label": "The shape of an ontology term representing a sex" + }, + { + "@id": "https://neuroshapes.org/commons/typedlabeledontologyterm/shapes/ModelSimulationStatusOntologyTermShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + } + ], + "rdfs:label": "The shape of an ontology term representing a model simulation status" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-unit.json b/tests/src/test/resources/kg/schemas/bbp/common-unit.json new file mode 100644 index 0000000000..59e5d4d66d --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-unit.json @@ -0,0 +1,272 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/unit/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/unit", + "@type": "Schema", + "imports": [ + "nsg:commons/labeledontologyentity" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/unit/shapes/UnitShape", + "@type": "NodeShape", + "property": [ + { + "@id": "https://neuroshapes.org/commons/unit/shapes/UnitCodePropertyShape", + "maxCount": 1, + "name": "Unit", + "or": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + }, + { + "datatype": "xsd:string" + } + ], + "path": "schema:unitCode" + } + ] + }, + { + "@id": "https://neuroshapes.org/commons/unit/shapes/WithUnitCodeShape", + "@type": "PropertyShape", + "minCount": 1, + "name": "Unit", + "or": [ + { + "node": "nsg:commons/labeledontologyentity/shapes/LabeledOntologyEntityShape" + }, + { + "datatype": "xsd:string" + } + ], + "path": "schema:unitCode" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/common-vector3d.json b/tests/src/test/resources/kg/schemas/bbp/common-vector3d.json new file mode 100644 index 0000000000..82cd44ff29 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/common-vector3d.json @@ -0,0 +1,265 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://neuroshapes.org/commons/vector3d/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://neuroshapes.org/commons/vector3d", + "@type": "Schema", + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/vector3d/shapes/Vector3DShape", + "@type": "NodeShape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "datatype": "xsd:float", + "description": "Vector value of X", + "maxCount": 1, + "minCount": 1, + "name": "X value", + "path": "nsg:valueX" + }, + { + "datatype": "xsd:float", + "description": "Vector value of Y", + "maxCount": 1, + "minCount": 1, + "name": "Y value", + "path": "nsg:valueY" + }, + { + "datatype": "xsd:float", + "description": "Vector value of Z", + "maxCount": 1, + "minCount": 1, + "name": "Z value", + "path": "nsg:valueZ" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/neuromorphology-common.json b/tests/src/test/resources/kg/schemas/bbp/neuromorphology-common.json new file mode 100644 index 0000000000..3897c59728 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/neuromorphology-common.json @@ -0,0 +1,100 @@ +{ + "@context": "https://incf.github.io/neuroshapes/contexts/schema.json", + "@id": "https://neuroshapes.org/commons/neuronmorphology", + "@type": "Schema", + "imports": [ + "nsg:commons/minds", + "nsg:commons/quantitativevalue", + "nsg:commons/collection" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/commons/neuronmorphology/shapes/NeuronMorphologyShape", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/minds/shapes/MINDSShape" + }, + { + "property": [ + { + "datatype": "xsd:int", + "description": "Number of points involved in the modelisation of the soma", + "maxCount": 1, + "name": "Soma number of points", + "path": "nsg:somaNumberOfPoints" + }, + { + "description": "Unopinionated metrics relative to the neurites of this morphology", + "name": "Neurite features", + "node": "https://neuroshapes.org/commons/neuronmorphology/shapes/NeuriteFeature", + "path": "nsg:neuriteFeature", + "xone": [ + { + "class": "nsg:Axon" + }, + { + "class": "nsg:Dendrite" + }, + { + "class": "nsg:BasalDendrite" + }, + { + "class": "nsg:ApicalDendrite" + } + ] + } + ] + } + ], + "label": "Definition of a neuron morphology, whether it comes from a stack, a slice, was synthetized in-silico, is whole brain or local to a single brain region.", + "nodeKind": "sh:BlankNodeOrIRI" + }, + { + "@id": "https://neuroshapes.org/commons/neuronmorphology/shapes/NeuriteFeature", + "@type": "NodeShape", + "and": [ + { + "node": "nsg:commons/collection/shapes/CollectionShape" + }, + { + "property": [ + { + "description": "Total length of a neurite category", + "maxCount": 1, + "name": "Cumulated length", + "node": "nsg:commons/quantitativevalue/shapes/QuantitativeValueShape", + "path": "nsg:cumulatedLength" + }, + { + "description": "Brain regions being traversed by neurites of this category", + "name": "Traversed brain regions", + "path": "nsg:traversedBrainRegion" + }, + { + "description": "Brain regions where neurites of this category have their projection (i.e. where they terminate)", + "name": "Projection brain regions", + "path": "nsg:projectionBrainRegion" + }, + { + "description": "Longest branch length of a neurite category", + "name": "Longest branch length", + "node": "nsg:commons/quantitativevalue/shapes/QuantitativeValueShape", + "path": "nsg:longestBranchLength" + }, + { + "description": "Longest branch number of nodes of a neurite category", + "name": "Longest branch number of nodes", + "path": "nsg:longestBranchNumberOfNodes" + }, + { + "description": "Number of projections of a neurite category", + "name": "Number of projections", + "path": "nsg:numberOfProjections" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/neuromorphology-dash.json b/tests/src/test/resources/kg/schemas/bbp/neuromorphology-dash.json new file mode 100644 index 0000000000..7b9005744f --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/neuromorphology-dash.json @@ -0,0 +1,16 @@ +{ + "@context": "https://incf.github.io/neuroshapes/contexts/schema.json", + "@id": "https://neuroshapes.org/dash/neuronmorphology", + "@type": "Schema", + "imports": [ + "https://neuroshapes.org/commons/neuronmorphology" + ], + "shapes": [ + { + "@id": "https://neuroshapes.org/dash/neuronmorphology/shapes/NeuronMorphologyShape", + "@type": "NodeShape", + "node": "https://neuroshapes.org/commons/neuronmorphology/shapes/NeuronMorphologyShape", + "targetClass": "nsg:NeuronMorphology" + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/provshapes-collection.json b/tests/src/test/resources/kg/schemas/bbp/provshapes-collection.json new file mode 100644 index 0000000000..47ea2129b4 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/provshapes-collection.json @@ -0,0 +1,251 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "this": "https://provshapes.org/commons/collection/shapes/", + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://provshapes.org/commons/collection", + "@type": "nxv:Schema", + "prov:wasDerivedFrom": "https://github.com/BlueBrain/nexus-prov/blob/v1.2.0/modules/prov/src/main/resources/schemas/nexus/provsh/collection/v1.1.0.json", + "shapes": [ + { + "@id": "https://provshapes.org/commons/collection/shapes/CollectionShape", + "@type": "sh:NodeShape", + "comment": "A collection is an entity that provides a structure to some constituents, which are themselves entities. These constituents are said to be member of the collection.", + "label": "Entity collection shape", + "nodeKind": "sh:BlankNodeOrIRI", + "property": [ + { + "class": "prov:Entity", + "description": "The (prov) entities that are member of the collection.", + "name": "Members", + "nodeKind": "sh:IRI", + "path": "prov:hadMember" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/sample-neuromorphology.json b/tests/src/test/resources/kg/schemas/bbp/sample-neuromorphology.json new file mode 100644 index 0000000000..1855b843b2 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/sample-neuromorphology.json @@ -0,0 +1,511 @@ +{ + "@context": "https://bbp.neuroshapes.org", + "@type": [ + "ReconstructedCell", + "NeuronMorphology", + "Entity", + "ReconstructedWholeBrainCell", + "ReconstructedNeuronMorphology" + ], + "annotation": { + "@type": [ + "QualityAnnotation", + "Annotation" + ], + "hasBody": { + "@id": "https://neuroshapes.org/Curated", + "@type": [ + "AnnotationBody", + "DataMaturity" + ], + "label": "Curated" + }, + "motivatedBy": { + "@id": "quality:Assessment", + "@type": "Motivation" + }, + "name": "Data maturity annotation", + "note": "NeuronMorphology dataset contains complete minimal metadata." + }, + "atlasRelease": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/4906ab85-694f-469d-962f-c0174e901885", + "@type": [ + "BrainAtlasRelease", + "AtlasRelease" + ] + }, + "brainLocation": { + "@type": "BrainLocation", + "atlasSpatialReferenceSystem": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/allen_ccfv3_spatial_reference_system", + "@type": [ + "AtlasSpatialReferenceSystem", + "BrainAtlasSpatialReferenceSystem" + ] + }, + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/170", + "label": "Dorsal part of the lateral geniculate complex" + }, + "coordinatesInBrainAtlas": { + "valueX": { + "@type": "xsd:float", + "@value": "8076.0" + }, + "valueY": { + "@type": "xsd:float", + "@value": "3308.0" + }, + "valueZ": { + "@type": "xsd:float", + "@value": "3484.0" + } + } + }, + "contribution": { + "@type": "Contribution", + "agent": { + "@id": "https://www.grid.ac/institutes/grid.263826.b", + "@type": "Agent" + } + }, + "distribution": [ + { + "@type": "DataDownload", + "atLocation": { + "@type": "Location", + "location": "file:///gpfs/bbp.cscs.ch/data/project/proj94/nexus/bbp-external/seu/6/e/b/0/7/8/2/2/18455_00017.swc", + "store": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/86b26915-1c4a-41ab-8865-0d6f4dfbdf72", + "@type": "RemoteDiskStorage", + "_rev": 1 + } + }, + "contentSize": { + "unitCode": "bytes", + "value": 773860 + }, + "contentUrl": "https://bbp.epfl.ch/nexus/v1/files/bbp-external/seu/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fbbp-external%2Fseu%2Fcb3320e5-3663-46ce-91ea-db2ecbfb2db3", + "digest": { + "algorithm": "SHA-256", + "value": "40e16e051d12e231ff811711f0f262afa2f009106bfea2b6305b658953274e17" + }, + "encodingFormat": "application/swc", + "name": "18455_00017.swc" + }, + { + "@type": "DataDownload", + "atLocation": { + "@type": "Location", + "location": "file:///gpfs/bbp.cscs.ch/data/project/proj94/nexus/bbp-external/seu/9/e/6/c/c/b/0/2/18455_00017.asc", + "store": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/86b26915-1c4a-41ab-8865-0d6f4dfbdf72", + "@type": "RemoteDiskStorage", + "_rev": 1 + } + }, + "contentSize": { + "unitCode": "bytes", + "value": 1209612 + }, + "contentUrl": "https://bbp.epfl.ch/nexus/v1/files/bbp-external/seu/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fbbp-external%2Fseu%2F183f9a5b-8d4d-46e2-b4dd-29876c1d513f", + "digest": { + "algorithm": "SHA-256", + "value": "af04438e074819f79ea6e28628ca7ded6a4bb1c99bcd4d431f5b8b1290827375" + }, + "encodingFormat": "application/asc", + "name": "18455_00017.asc" + }, + { + "@type": "DataDownload", + "atLocation": { + "@type": "Location", + "location": "file:///gpfs/bbp.cscs.ch/data/project/proj94/nexus/bbp-external/seu/e/e/8/0/7/6/2/7/18455_00017.h5", + "store": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/86b26915-1c4a-41ab-8865-0d6f4dfbdf72", + "@type": "RemoteDiskStorage", + "_rev": 1 + } + }, + "contentSize": { + "unitCode": "bytes", + "value": 254008 + }, + "contentUrl": "https://bbp.epfl.ch/nexus/v1/files/bbp-external/seu/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fbbp-external%2Fseu%2F24bf9b83-c2dc-43ed-847a-9883490002db", + "digest": { + "algorithm": "SHA-256", + "value": "a5ced1d0fc61a22360870295e43a2bfab06c97594bcc107f61e601f660396dec" + }, + "encodingFormat": "application/h5", + "name": "18455_00017.h5" + }, + { + "@type": "DataDownload", + "atLocation": { + "@type": "Location", + "location": "file:///gpfs/bbp.cscs.ch/data/project/proj94/nexus/bbp-external/seu/2/4/a/0/e/c/c/4/18455_00017.obj", + "store": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/86b26915-1c4a-41ab-8865-0d6f4dfbdf72", + "@type": "RemoteDiskStorage", + "_rev": 1 + } + }, + "contentSize": { + "unitCode": "bytes", + "value": 1580558 + }, + "contentUrl": "https://bbp.epfl.ch/nexus/v1/files/bbp-external/seu/https%3A%2F%2Fbbp.epfl.ch%2Fneurosciencegraph%2Fdata%2Fe173289f-6b96-4be8-b69b-0d357f74cb38", + "digest": { + "algorithm": "SHA-256", + "value": "fd9c9d4c916cf5236be6f462bc7977dd12d25c10dd576a02a379f55af20ff837" + }, + "encodingFormat": "application/obj", + "name": "18455_00017.obj" + } + ], + "generation": { + "@type": "Generation", + "activity": { + "@type": [ + "ExperimentalActivity", + "Activity", + "NeuronMorphologyCorrection" + ], + "endedAtTime": "2021-08-20T00:00:00", + "hadProtocol": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/781094e0-8fcb-4058-b3b9-9c67467e47d5", + "@type": [ + "ExperimentalProtocol", + "Protocol" + ] + }, + "note": "includes 3-point soma, corrected z-jumps, dendrites reconstructed according to their thickness", + "startedAtTime": "2021-06-01T00:00:00" + } + }, + "isRegisteredIn": { + "@id": "https://bbp.epfl.ch/neurosciencegraph/data/allen_ccfv3_spatial_reference_system", + "@type": [ + "AtlasSpatialReferenceSystem", + "BrainAtlasSpatialReferenceSystem" + ] + }, + "name": "18455_00017", + "neuriteFeature": [ + { + "@type": "Axon", + "cumulatedLength": { + "unitCode": "μm", + "value": 25072.177217234617 + }, + "longestBranchLength": { + "unitCode": "μm", + "value": 8320.508112737092 + }, + "longestBranchNumberOfNodes": 3936, + "name": "axon features", + "numberOfProjections": 133, + "projectionBrainRegion": [ + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/262" + }, + "count": 10 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/971" + }, + "count": 1 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/778" + }, + "count": 1 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/721" + }, + "count": 19 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782558" + }, + "count": 5 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782608" + }, + "count": 37 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782612" + }, + "count": 7 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/821" + }, + "count": 38 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782554" + }, + "count": 12 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/593" + }, + "count": 3 + } + ], + "traversedBrainRegion": [ + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/496345668" + }, + "count": 76 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/549" + }, + "count": 308 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/484682524" + }, + "count": 742 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/262" + }, + "count": 661 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/672" + }, + "count": 333 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/579" + }, + "count": 40 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/986" + }, + "count": 45 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/971" + }, + "count": 853 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/598" + }, + "count": 14 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/484682512" + }, + "count": 1 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/1005" + }, + "count": 13 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/484682520" + }, + "count": 303 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/466" + }, + "count": 170 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/382" + }, + "count": 16 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/305" + }, + "count": 24 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/33" + }, + "count": 90 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/778" + }, + "count": 346 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/721" + }, + "count": 1670 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782612" + }, + "count": 1420 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782554" + }, + "count": 736 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782558" + }, + "count": 111 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/312782608" + }, + "count": 2158 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/821" + }, + "count": 2290 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/593" + }, + "count": 223 + } + ] + }, + { + "@type": "BasalDendrite", + "cumulatedLength": { + "unitCode": "μm", + "value": 4052.272980097076 + }, + "longestBranchLength": { + "unitCode": "μm", + "value": 203.35441293618146 + }, + "longestBranchNumberOfNodes": 104, + "name": "basal dendrite features", + "numberOfProjections": 47, + "projectionBrainRegion": [ + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/496345668" + }, + "count": 9 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/549" + }, + "count": 4 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/496345664" + }, + "count": 31 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/1072" + }, + "count": 3 + } + ], + "traversedBrainRegion": [ + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/496345668" + }, + "count": 600 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/496345664" + }, + "count": 1322 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/549" + }, + "count": 123 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/1072" + }, + "count": 43 + }, + { + "brainRegion": { + "@id": "http://api.brain-map.org/api/v2/data/Structure/218" + }, + "count": 1 + } + ] + } + ], + "objectOfStudy": { + "@id": "http://bbp.epfl.ch/neurosciencegraph/taxonomies/objectsofstudy/singlecells", + "@type": "ObjectOfStudy", + "label": "Single Cell" + }, + "somaNumberOfPoints": { + "@type": "xsd:int", + "@value": 3 + }, + "subject": { + "@type": "Subject", + "name": "Tnnt1-IRES2-CreERT2;Ai82;Ai140_373368-18455", + "species": { + "@id": "http://purl.obolibrary.org/obo/NCBITaxon_10090", + "label": "Mus musculus" + }, + "strain": { + "@id": "http://bbp.epfl.ch/neurosciencegraph/ontologies/speciestaxonomy/R7VSXBJ6dYm8vikkDPJqne8", + "label": "Tnnt1-IRES2-CreERT2" + } + } +} \ No newline at end of file diff --git a/tests/src/test/resources/kg/schemas/bbp/schema-context.json b/tests/src/test/resources/kg/schemas/bbp/schema-context.json new file mode 100644 index 0000000000..ded5e415e2 --- /dev/null +++ b/tests/src/test/resources/kg/schemas/bbp/schema-context.json @@ -0,0 +1,230 @@ +{ + "@context": { + "BlankNode": { + "@id": "sh:BlankNode" + }, + "BlankNodeOrIRI": { + "@id": "sh:BlankNodeOrIRI" + }, + "BlankNodeOrLiteral": { + "@id": "sh:BlankNodeOrLiteral" + }, + "IRI": { + "@id": "sh:IRI" + }, + "IRIOrLiteral": { + "@id": "sh:IRIOrLiteral" + }, + "Literal": { + "@id": "sh:Literal" + }, + "NodeShape": { + "@id": "sh:NodeShape" + }, + "PropertyShape": { + "@id": "sh:PropertyShape" + }, + "Schema": "nxv:Schema", + "Shape": { + "@id": "sh:Shape" + }, + "Violation": { + "@id": "sh:Violation" + }, + "and": { + "@id": "sh:and", + "@type": "@id", + "@container": "@list" + }, + "bmo": "https://bbp.epfl.ch/ontologies/core/bmo/", + "bmoutils": "https://bbp.epfl.ch/ontologies/core/bmoutils/", + "class": { + "@id": "sh:class", + "@type": "@id" + }, + "comment": { + "@id": "rdfs:comment", + "@type": "xsd:string" + }, + "datatype": { + "@id": "sh:datatype", + "@type": "@id" + }, + "dcat": "http://www.w3.org/ns/dcat#", + "dcterms": "http://purl.org/dc/terms/", + "deactivated": { + "@id": "sh:deactivated" + }, + "declare": { + "@id": "sh:declare" + }, + "description": { + "@id": "sh:description" + }, + "editorialNote": { + "@id": "skos:editorialNote", + "@type": "xsd:string" + }, + "hasValue": { + "@id": "sh:hasValue" + }, + "imports": { + "@id": "owl:imports", + "@type": "@id", + "@container": "@set" + }, + "in": { + "@id": "sh:in", + "@container": "@list" + }, + "isDefinedBy": { + "@id": "http://www.w3.org/2000/01/rdf-schema#isDefinedBy", + "@type": "@id" + }, + "label": { + "@id": "rdfs:label", + "@type": "xsd:string" + }, + "lessThan": { + "@id": "sh:lessThan", + "@type": "@id" + }, + "maxCount": { + "@id": "sh:maxCount", + "@type": "xsd:integer" + }, + "maxExclusive": { + "@id": "sh:maxExclusive" + }, + "maxInclusive": { + "@id": "sh:maxInclusive" + }, + "minCount": { + "@id": "sh:minCount", + "@type": "xsd:integer" + }, + "minExclusive": { + "@id": "sh:minExclusive" + }, + "minInclusive": { + "@id": "sh:minInclusive" + }, + "name": { + "@id": "sh:name" + }, + "namespace": { + "@id": "sh:namespace", + "@type": "xsd:anyURI" + }, + "node": { + "@id": "sh:node", + "@type": "@id" + }, + "nodeKind": { + "@id": "sh:nodeKind", + "@type": "@id" + }, + "not": { + "@id": "sh:not", + "@type": "@id", + "@container": "@list" + }, + "nsg": "https://neuroshapes.org/", + "nxv": "https://bluebrain.github.io/nexus/vocabulary/", + "or": { + "@id": "sh:or", + "@type": "@id", + "@container": "@list" + }, + "owl": "http://www.w3.org/2002/07/owl#", + "path": { + "@id": "sh:path", + "@type": "@id" + }, + "pattern": { + "@id": "sh:pattern" + }, + "prefix": { + "@id": "sh:prefix", + "@type": "xsd:string" + }, + "property": { + "@id": "sh:property", + "@type": "@id", + "@container": "@set" + }, + "prov": "http://www.w3.org/ns/prov#", + "qualifiedMaxCount": { + "@id": "sh:qualifiedMaxCount", + "@type": "xsd:integer" + }, + "qualifiedMinCount": { + "@id": "sh:qualifiedMinCount", + "@type": "xsd:integer" + }, + "qualifiedValueShape": { + "@id": "sh:qualifiedValueShape", + "@type": "@id" + }, + "qualifiedValueShapesDisjoint": { + "@id": "sh:qualifiedValueShapesDisjoint", + "@type": "xsd:boolean" + }, + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "resultMessage": { + "@id": "sh:message" + }, + "schema": "http://schema.org/", + "seeAlso": { + "@id": "rdfs:seeAlso", + "@type": "@id" + }, + "severity": { + "@id": "sh:severity" + }, + "sh": "http://www.w3.org/ns/shacl#", + "shapes": { + "@id": "nxv:shapes", + "@type": "@id", + "@container": "@set" + }, + "shapesGraph": { + "@id": "sh:shapesGraph", + "@type": "@id" + }, + "shsh": "http://www.w3.org/ns/shacl-shacl#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "suggestedShapesGraph": { + "@id": "sh:suggestedShapesGraph", + "@type": "@id" + }, + "target": { + "@id": "sh:target", + "@type": "@id" + }, + "targetClass": { + "@id": "sh:targetClass", + "@type": "@id" + }, + "targetNode": { + "@id": "sh:targetNode", + "@type": "@id" + }, + "targetObjectsOf": { + "@id": "sh:targetObjectsOf", + "@type": "@id" + }, + "targetSubjectsOf": { + "@id": "sh:targetSubjectsOf", + "@type": "@id" + }, + "xone": { + "@id": "sh:xone", + "@type": "@id", + "@container": "@list" + }, + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://incf.github.io/neuroshapes/contexts/schema.json" +} \ No newline at end of file diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala index b6b7e12c4a..97c4460883 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala @@ -33,8 +33,8 @@ class SearchAccessSpec extends BaseIntegrationSpec { _ <- aclDsl.addPermission(s"/$orgId/$projId1", Rick, Resources.Read) _ <- aclDsl.addPermission(s"/$orgId/$projId2", Rick, Resources.Read) - _ <- postResource("kg/search/context/neuroshapes.json") - _ <- postResource("kg/search/context/bbp-neuroshapes.json") + _ <- postResource("kg/context/neuroshapes.json") + _ <- postResource("kg/context/bbp-neuroshapes.json") _ <- postResource("kg/search/data/trace.json") } yield () diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala index 586bd2c868..143e2fdc88 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala @@ -2,17 +2,17 @@ package ch.epfl.bluebrain.nexus.tests.kg import akka.http.scaladsl.model.StatusCodes import cats.effect.IO -import ch.epfl.bluebrain.nexus.tests.{BaseIntegrationSpec, Optics} +import cats.implicits._ import ch.epfl.bluebrain.nexus.tests.Identity.resources.Rick +import ch.epfl.bluebrain.nexus.tests.admin.ProjectPayload import ch.epfl.bluebrain.nexus.tests.iam.types.Permission.{Organizations, Resources} +import ch.epfl.bluebrain.nexus.tests.{BaseIntegrationSpec, Optics} import io.circe.Json import org.scalactic.source.Position import org.scalatest.Assertion import java.time.Instant -import concurrent.duration._ -import cats.implicits._ -import ch.epfl.bluebrain.nexus.tests.admin.ProjectPayload +import scala.concurrent.duration._ class SearchConfigIndexingSpec extends BaseIntegrationSpec { @@ -83,9 +83,8 @@ class SearchConfigIndexingSpec extends BaseIntegrationSpec { _ <- adminDsl.createProject(orgId, projId1, ProjectPayload.generateBbp(id1), authenticated = Rick) _ <- aclDsl.addPermission(s"/$orgId", Rick, Resources.Read) _ <- aclDsl.addPermission(s"/$orgId/$projId1", Rick, Resources.Read) - - _ <- postResource("kg/search/context/neuroshapes.json") - _ <- postResource("kg/search/context/bbp-neuroshapes.json") + _ <- postResource("kg/context/neuroshapes.json") + _ <- postResource("kg/context/bbp-neuroshapes.json") _ <- allResources.traverseTap { resource => postResource(s"kg/search/data/$resource") } } yield () @@ -803,16 +802,16 @@ class SearchConfigIndexingSpec extends BaseIntegrationSpec { field( "preSynapticPathway", json"""[ - { - "@id": "http://bbp.epfl.ch/neurosciencegraph/ontologies/mtypes/TNJ_NwHgTKe1iv_XLR_0Yg", - "about": "https://bbp.epfl.ch/neurosciencegraph/data/BrainCellType", - "label": "SO_BS" - }, { "@id": "http://api.brain-map.org/api/v2/data/Structure/453", "about": "https://bbp.epfl.ch/neurosciencegraph/data/BrainRegion", "label": "Somatosensory areas", "notation": "SS" + }, + { + "@id": "http://bbp.epfl.ch/neurosciencegraph/ontologies/mtypes/TNJ_NwHgTKe1iv_XLR_0Yg", + "about": "https://bbp.epfl.ch/neurosciencegraph/data/BrainCellType", + "label": "SO_BS" } ]""" ) diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/resources/NeuroMorphologySampleSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/resources/NeuroMorphologySampleSpec.scala new file mode 100644 index 0000000000..3b88d73212 --- /dev/null +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/resources/NeuroMorphologySampleSpec.scala @@ -0,0 +1,101 @@ +package ch.epfl.bluebrain.nexus.tests.kg.resources + +import cats.effect.IO +import cats.syntax.all._ +import ch.epfl.bluebrain.nexus.delta.kernel.utils.UrlUtils +import ch.epfl.bluebrain.nexus.tests.BaseIntegrationSpec +import ch.epfl.bluebrain.nexus.tests.Identity.listings.Bob +import io.circe.Json +import org.scalatest.Assertion + +class NeuroMorphologySampleSpec extends BaseIntegrationSpec { + + private val orgId = genId() + private val projId = genId() + private val project = s"$orgId/$projId" + + private val neuronMorphologySample = "kg/schemas/bbp/sample-neuromorphology.json" + + private val noSchema = "_" + private val neuronMorphologySchema = UrlUtils.encode("https://neuroshapes.org/dash/neuronmorphology") + + override def beforeAll(): Unit = { + super.beforeAll() + val setup = for { + _ <- createProjects(Bob, orgId, projId) + // Creating mandatory contexts + _ <- postResource("kg/context/neuroshapes.json") + _ <- postResource("kg/context/bbp-neuroshapes.json") + _ <- postResource("kg/schemas/bbp/schema-context.json") + } yield () + setup.accepted + } + + "Creating a morphology" should { + "succeed provisionning the mandatory schemas" in { + val schemas = List( + "common-labeledontologyentity.json", + "common-unit.json", + "common-quantitative-value.json", + "common-subject.json", + "common-language.json", + "common-derivation.json", + "common-propertyvalue.json", + "common-identifier.json", + "common-distribution.json", + "common-generation.json", + "common-typedlabeledontologyterm.json", + "common-vector3d.json", + "common-brainlocation.json", + "common-license.json", + "common-contribution.json", + "common-invalidation.json", + "common-entitywithoutannotationsubject.json", + "common-annotation-selector.json", + "common-annotation.json", + "common-entity.json", + "common-minds.json", + "provshapes-collection.json", + "common-collection.json", + "neuromorphology-common.json", + "neuromorphology-dash.json" + ) + schemas.traverse { f => postSchema(s"kg/schemas/bbp/$f") } + } + + "succeed creating the morphology without a schema" in { + putResource("no-schema", noSchema, neuronMorphologySample) + } + + "succeed creating the morphology with a schema" in { + putResource("with-schema", neuronMorphologySchema, neuronMorphologySample) + } + + "succeed updating the morphology with a schema" in { + putResource("with-schema", 1, neuronMorphologySchema, neuronMorphologySample) + } + } + + private def postResource(resourcePath: String): IO[Assertion] = + loader.jsonContentOf(resourcePath).flatMap { payload => + deltaClient.post[Json](s"/resources/$project/_/", payload, Bob) { expectCreated } + } + + private def putResource(id: String, schema: String, resourcePath: String): IO[Assertion] = + loader.jsonContentOf(resourcePath).flatMap { payload => + deltaClient.put[Json](s"/resources/$project/$schema/$id", payload, Bob) { + expectCreated + } + } + + private def putResource(id: String, rev: Int, schema: String, resourcePath: String): IO[Assertion] = + loader.jsonContentOf(resourcePath).flatMap { payload => + deltaClient.put[Json](s"/resources/$project/$schema/$id?rev=$rev", payload, Bob) { + expectOk + } + } + private def postSchema(schemaPath: String) = + loader.jsonContentOf(schemaPath).flatMap { payload => + deltaClient.post[Json](s"/schemas/$project", payload, Bob) { expectCreated } + } +}