Skip to content

Commit

Permalink
Add emodel fields to search (#4720)
Browse files Browse the repository at this point in the history
* Add emodel fields to search

---------

Co-authored-by: Simon Dumas <[email protected]>
  • Loading branch information
imsdu and Simon Dumas authored Feb 8, 2024
1 parent f940f65 commit d8b76a1
Show file tree
Hide file tree
Showing 31 changed files with 244 additions and 146 deletions.
65 changes: 47 additions & 18 deletions tests/docker/config/construct-query.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ CONSTRUCT {
:idLabel ?layerIdLabel .

## Contributors
?alias :contributors ?contributorId .
?alias :contributors ?contributorId .
?contributorId rdf:type ?contributorType ;
:label ?contributorName ;
:idLabel ?contributorIdName ;
Expand All @@ -78,10 +78,11 @@ CONSTRUCT {

## Generation
?alias :generation ?generation .
?generation :protocol ?protocol ;
:startedAt ?generationStartedAtTime ;
:endedAt ?generationEndedAtTime .
?protocol :label ?protocolName ;
?generation :protocol ?protocol ;
:startedAt ?generationStartedAtTime ;
:endedAt ?generationEndedAtTime ;
:followedWorkflow ?followedWorkflow .
?protocol :label ?protocolName ;
:propertyID ?protocolPropertyId ;
:value ?protocolValue .

Expand Down Expand Up @@ -118,8 +119,8 @@ CONSTRUCT {

## Start / end / status
?alias :startedAt ?startedAt ;
:endedAt ?endedAt ;
:status ?status .
:endedAt ?endedAt ;
:status ?status .

## Subject
?alias :subjectAge ?age .
Expand Down Expand Up @@ -198,13 +199,20 @@ CONSTRUCT {
## Morphology features
?alias :compartment ?featureCompartment .
?alias :neuronMorphology ?neuronMorphologyId .
?neuronMorphologyId :name ?neuronMorphologyName .

?alias :featureSeries ?featureSeries .
?featureSeries :value ?featureValue ;
:unit ?featureUnit ;
:label ?featureLabel ;
:statistic ?featureStat ;
:compartment ?featureCompartment .


## EModels
?alias :emodel ?emodel .
?emodel :score ?emodelScore ;
:neuronMorphology ?emodelMorphologyId .
?emodelMorphologyId :name ?emodelMorphologyName .
} WHERE {
VALUES ?id { {resource_id} } .
BIND( IRI(concat(str(?id), '/', 'alias')) AS ?alias ) .
Expand Down Expand Up @@ -391,8 +399,9 @@ CONSTRUCT {
?protocolId schema:value ?protocolValue .
} .
} .
OPTIONAL { ?generation prov:startedAtTime ?generationStartedAtTime . } .
OPTIONAL { ?generation prov:endedAtTime ?generationEndedAtTime . } .
OPTIONAL { ?generation prov:startedAtTime ?generationStartedAtTime . } .
OPTIONAL { ?generation prov:endedAtTime ?generationEndedAtTime . } .
OPTIONAL { ?generation nsg:followedWorkflow ?followedWorkflow . } .
}

# Image
Expand Down Expand Up @@ -673,16 +682,36 @@ CONSTRUCT {
?id a bmo:NeuronMorphologyFeatureAnnotation .

OPTIONAL {
?id nsg:hasTarget / nsg:hasSource ?neuronMorphologyId ;
bmo:compartment ?featureCompartment ;
nsg:hasBody ?featureBody .

?featureBody nsg:isMeasurementOf / rdfs:label ?featureLabel ;
schema:value / nsg:series ?featureSeries .
?featureSeries nsg:statistic ?featureStat ;
schema:value ?featureValue ;
?id nsg:hasTarget / nsg:hasSource ?neuronMorphologyId ;
bmo:compartment ?featureCompartment ;
nsg:hasBody ?featureBody .
?neuronMorphologyId schema:name ?neuronMorphologyName .

?featureBody nsg:isMeasurementOf / rdfs:label ?featureLabel ;
schema:value / nsg:series ?featureSeries .
?featureSeries nsg:statistic ?featureStat ;
schema:value ?featureValue ;
schema:unitCode ?featureUnit

}.
} .

# EModels
OPTIONAL {
?id a nsg:EModel .

BIND(BNODE() AS ?emodel ) .

OPTIONAL { ?id nsg:score ?emodelScore . } .

OPTIONAL {
?followedWorkflow schema:hasPart ?emodelConfig .

?emodelConfig a bmo:EModelConfiguration ;
bmo:uses ?emodelMorphologyId .
# info about the morphology
?emodelMorphologyId a nsg:NeuronMorphology ;
schema:name ?emodelMorphologyName .
} .
}
}
5 changes: 3 additions & 2 deletions tests/docker/config/search-context.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
"featureSeries": {
"@container": "@set"
},
"neuronMorphology": {
"@type": "@id"
"followedWorkflow": {
"@type": "@id",
"@id": "https://bluebrain.github.io/nexus/field/followedWorkflow"
},
"project": {
"@type": "@id"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"@context": "https://bbp.neuroshapes.org",
"@type": [
"Entity",
"EModelConfiguration"
],
"@id": "https://bbp.epfl.ch/data/emodel-configuration",
"uses": [
{
"@id": "https://bbp.epfl.ch/data/neuron-morphology",
"@type": "NeuronMorphology"
},
{
"@id": "https://bbp.epfl.ch/data/subcellular-model-script",
"@type": "SubCellularModelScript"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"@context": "https://bbp.neuroshapes.org",
"@type": [
"Entity",
"EModelWorkflow"
],
"@id": "https://bbp.epfl.ch/data/emodel-workflow",
"generates": [
{
"@id": "https://bbp.epfl.ch/data/emodel",
"@type": "EModel"
},
{
"@id": "https://bbp.epfl.ch/data/emodel-script",
"@type": "EModelScript"
},
{
"@id": "https://bbp.epfl.ch/data/fitness-calculator-config",
"@type": "FitnessCalculatorConfiguration"
}
],
"hasPart": [
{
"@id": "https://bbp.epfl.ch/data/extraction-targets-configuration",
"@type": "ExtractionTargetsConfiguration"
},
{
"@id": "https://bbp.epfl.ch/data/extraction-targets-configuration",
"@type": "EModelPipelineSettings"
},
{
"@id": "https://bbp.epfl.ch/data/emodel-configuration",
"@type": "EModelConfiguration"
}
]
}
21 changes: 21 additions & 0 deletions tests/src/test/resources/kg/search/data/emodel/emodel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"@context": "https://bbp.neuroshapes.org",
"@type": [
"Entity",
"EModel"
],
"@id": "https://bbp.epfl.ch/data/emodel",
"generation": {
"@type": "Generation",
"activity": {
"@type": "Activity",
"followedWorkflow": {
"@id": "https://bbp.epfl.ch/data/emodel-workflow",
"@type": "EModelWorkflow"
}
}
},
"name": "EM__fa285b7__dSTUT__15",
"score": 47.566230109706076,
"seed": 15
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class SearchAccessSpec extends BaseIntegrationSpec {
_ <- aclDsl.addPermission(s"/$orgId/$projId1", Rick, Resources.Read)
_ <- aclDsl.addPermission(s"/$orgId/$projId2", Rick, Resources.Read)

_ <- postResource("kg/search/neuroshapes.json")
_ <- postResource("kg/search/bbp-neuroshapes.json")
_ <- postResource("kg/search/trace.json")
_ <- postResource("kg/search/context/neuroshapes.json")
_ <- postResource("kg/search/context/bbp-neuroshapes.json")
_ <- postResource("kg/search/data/trace.json")
} yield ()

setup.accepted
Expand Down
Loading

0 comments on commit d8b76a1

Please sign in to comment.