{ "cells": [ { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2019-09-23T18:50:19.036357Z", "start_time": "2019-09-23T18:50:19.031896Z" } }, "source": [ "# JSON-LD Conversions\n", "\n", "This notebook demonstrates how to [convert](https://nexus-forge.readthedocs.io/en/latest/interaction.html#converting) Resources to [JSON-LD](https://json-ld.org) and vice-versa. JSON-LD is a semantic-preserving JSON format allowing to provide identifiers and meaning to JSON keys and values by mean of an added '@context' object. Read the excellent [JSON-LD documentation](https://json-ld.org/learn.html) to learn more about this format.\n", "\n", "A JSON-LD context can be assigned to a [Resource](https://nexus-forge.readthedocs.io/en/latest/interaction.html#resource) in three ways by order of priority:\n", "1. directly set in the resource using the property `context`: e.g.`jane_resource.context=\"https://schema.org/docs/jsonldcontext.json\"`\n", "2. set in the `Model` section of the forge configuration file: e.g.\n", "\n", "\n", "'''\n", "\n", "Model:\n", "\n", " name: RdfModel\n", " \n", " origin: ...\n", " \n", " source: ...\n", " \n", " context:\n", " \n", " iri: \"https://schema.org/docs/jsonldcontext.json\"\n", " \n", "''' \n", "\n", "\n", "3. set by the configured store. A store (such as BlueBrainNexus) can support JSON-LD and add a default JSON-LD context whenever one is not provided." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2019-09-23T18:50:20.068658Z", "start_time": "2019-09-23T18:50:19.054054Z" } }, "outputs": [], "source": [ "from kgforge.core import KnowledgeGraphForge" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A configuration file is needed in order to create a KnowledgeGraphForge session. A configuration can be generated using the notebook [00-Initialization.ipynb](00%20-%20Initialization.ipynb)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "forge = KnowledgeGraphForge(\"../../configurations/forge.yml\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Imports" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import json" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "from kgforge.core import Resource" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "def pp(x): \n", " print(json.dumps(x, indent=4))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Context" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "context = {\n", " \"ex\": \"http://example.org/\",\n", " \"Person\": \"ex:Person\",\n", " \"Organization\": \"ex:Organization\",\n", " \"employer\": \"ex:employer\",\n", " \"name\": \"ex:name\"\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Resource to JSON-LD" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### context from the user" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### locally defined context" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "jane = Resource(context=context, type=\"Person\", name=\"Jane Doe\")" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'type': 'Person', 'name': 'Jane Doe'}" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "forge.as_json(jane)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"@context\": {\n", " \"ex\": \"http://example.org/\",\n", " \"Person\": \"ex:Person\",\n", " \"Organization\": \"ex:Organization\",\n", " \"employer\": \"ex:employer\",\n", " \"name\": \"ex:name\"\n", " },\n", " \"@type\": \"Person\",\n", " \"name\": \"Jane Doe\"\n", "}\n" ] } ], "source": [ "pp(forge.as_jsonld(jane))" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"@type\": \"http://example.org/Person\",\n", " \"http://example.org/name\": \"Jane Doe\"\n", "}\n" ] } ], "source": [ "pp(forge.as_jsonld(jane, form=\"expanded\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### remote context from the web" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "jane = Resource(context=\"https://schema.org/docs/jsonldcontext.json\", type=\"Person\", name=\"Jane Doe\")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " context: https://schema.org/docs/jsonldcontext.json\n", " type: Person\n", " name: Jane Doe\n", "}\n" ] } ], "source": [ "print(jane)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"@context\": \"https://schema.org/docs/jsonldcontext.json\",\n", " \"type\": \"Person\",\n", " \"name\": \"Jane Doe\"\n", "}\n" ] } ], "source": [ "pp(forge.as_jsonld(jane))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### context from the model\n", "\n", "The configured model provides a default context that will be used to create resources that do not have context provided." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "jane = Resource(type=\"Person\", name=\"Jane Doe\")" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " type: Person\n", " name: Jane Doe\n", "}\n" ] } ], "source": [ "print(jane)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"@context\": {\n", " \"@vocab\": \"https://neuroshapes.org/\",\n", " \"AcquisitionAnnotation\": {\n", " \"@id\": \"nsg:AcquisitionAnnotation\"\n", " },\n", " \"Activity\": {\n", " \"@id\": \"prov:Activity\"\n", " },\n", " \"AffineLinearTransform\": {\n", " \"@id\": \"nsg:AffineLinearTransform\"\n", " },\n", " \"Agent\": {\n", " \"@id\": \"prov:Agent\"\n", " },\n", " \"Analysis\": {\n", " \"@id\": \"nsg:Analysis\"\n", " },\n", " \"AnalysisConfiguration\": {\n", " \"@id\": \"nsg:AnalysisConfiguration\",\n", " \"@type\": \"@id\"\n", " },\n", " \"AnalysisReport\": {\n", " \"@id\": \"nsg:AnalysisReport\",\n", " \"@type\": \"@id\"\n", " },\n", " \"AnalysisResult\": {\n", " \"@id\": \"nsg:AnalysisResult\"\n", " },\n", " \"AnnotatedSlice\": {\n", " \"@id\": \"nsg:AnnotatedSlice\"\n", " },\n", " \"Annotation\": {\n", " \"@id\": \"nsg:Annotation\"\n", " },\n", " \"AnnotationBody\": {\n", " \"@id\": \"nsg:AnnotationBody\"\n", " },\n", " \"ApicalAnnotation\": {\n", " \"@id\": \"nsg:ApicalAnnotation\"\n", " },\n", " \"AtlasConstruction\": {\n", " \"@id\": \"nsg:AtlasConstruction\"\n", " },\n", " \"AtlasRelease\": {\n", " \"@id\": \"nsg:AtlasRelease\"\n", " },\n", " \"AtlasSpatialReferenceSystem\": {\n", " \"@id\": \"nsg:AtlasSpatialReferenceSystem\"\n", " },\n", " \"BluePyEfeFeatures\": {\n", " \"@id\": \"nsg:BluePyEfeFeatures\"\n", " },\n", " \"BoundingBox\": {\n", " \"@id\": \"nsg:BoundingBox\"\n", " },\n", " \"BoutonDensity\": {\n", " \"@id\": \"nsg:BoutonDensity\"\n", " },\n", " \"BrainAtlasRelease\": {\n", " \"@id\": \"nsg:BrainAtlasRelease\"\n", " },\n", " \"BrainAtlasSpatialReferenceSystem\": {\n", " \"@id\": \"nsg:BrainAtlasSpatialReferenceSystem\"\n", " },\n", " \"BrainImaging\": {\n", " \"@id\": \"nsg:BrainImaging\"\n", " },\n", " \"BrainLocation\": {\n", " \"@id\": \"nsg:BrainLocation\"\n", " },\n", " \"BrainParcellationDataLayer\": {\n", " \"@id\": \"nsg:BrainParcellationDataLayer\"\n", " },\n", " \"BrainParcellationMesh\": {\n", " \"@id\": \"nsg:BrainParcellationMesh\"\n", " },\n", " \"BrainSlicing\": {\n", " \"@id\": \"nsg:BrainSlicing\"\n", " },\n", " \"BrainTemplateDataLayer\": {\n", " \"@id\": \"nsg:BrainTemplateDataLayer\"\n", " },\n", " \"CampaignAnalysis\": {\n", " \"@id\": \"nsg:CampaignAnalysis\",\n", " \"@type\": \"@id\"\n", " },\n", " \"Cell\": {\n", " \"@id\": \"nsg:Cell\"\n", " },\n", " \"CellCounting\": {\n", " \"@id\": \"nsg:CellCounting\"\n", " },\n", " \"CellDensity\": {\n", " \"@id\": \"nsg:CellDensity\"\n", " },\n", " \"CellDensityDataLayer\": {\n", " \"@id\": \"nsg:CellDensityDataLayer\"\n", " },\n", " \"CellPlacement\": {\n", " \"@id\": \"nsg:CellPlacement\"\n", " },\n", " \"CellRecordSeries\": {\n", " \"@id\": \"nsg:CellRecordSeries\"\n", " },\n", " \"CircuitCellProperties\": {\n", " \"@id\": \"nsg:CircuitCellProperties\"\n", " },\n", " \"Class\": {\n", " \"@id\": \"owl:Class\"\n", " },\n", " \"Collection\": {\n", " \"@id\": \"prov:Collection\"\n", " },\n", " \"ComponentDimension\": {\n", " \"@id\": \"nsg:ComponentDimension\"\n", " },\n", " \"Concept\": {\n", " \"@id\": \"skos:Concept\"\n", " },\n", " \"ConceptScheme\": {\n", " \"@id\": \"skos:ConceptScheme\"\n", " },\n", " \"Configuration\": {\n", " \"@id\": \"nsg:Configuration\"\n", " },\n", " \"Contribution\": {\n", " \"@id\": \"nsg:Contribution\"\n", " },\n", " \"DataDownload\": {\n", " \"@id\": \"schema:DataDownload\"\n", " },\n", " \"Dataset\": {\n", " \"@id\": \"schema:Dataset\"\n", " },\n", " \"DeformableTransform\": {\n", " \"@id\": \"nsg:DeformableTransform\"\n", " },\n", " \"Density\": {\n", " \"@id\": \"nsg:Density\"\n", " },\n", " \"Derivation\": {\n", " \"@id\": \"prov:Derivation\"\n", " },\n", " \"DetailedCircuit\": {\n", " \"@id\": \"nsg:DetailedCircuit\"\n", " },\n", " \"EModel\": {\n", " \"@id\": \"nsg:EModel\"\n", " },\n", " \"EModelBuilding\": {\n", " \"@id\": \"nsg:EModelBuilding\"\n", " },\n", " \"EModelRelease\": {\n", " \"@id\": \"nsg:EModelRelease\"\n", " },\n", " \"EModelScript\": {\n", " \"@id\": \"nsg:EModelScript\"\n", " },\n", " \"ETypeFeatureProtocol\": {\n", " \"@id\": \"nsg:ETypeFeatureProtocol\"\n", " },\n", " \"EdgeCollection\": {\n", " \"@id\": \"nsg:EdgeCollection\"\n", " },\n", " \"EmodelFeatureGeneration\": {\n", " \"@id\": \"nsg:EmodelFeatureGeneration\"\n", " },\n", " \"EmptyCollection\": {\n", " \"@id\": \"prov:EmptyCollection\"\n", " },\n", " \"Entity\": {\n", " \"@id\": \"prov:Entity\"\n", " },\n", " \"ExperimentalActivity\": {\n", " \"@id\": \"nsg:ExperimentalActivity\"\n", " },\n", " \"ExperimentalProtocol\": {\n", " \"@id\": \"nsg:ExperimentalProtocol\"\n", " },\n", " \"FixationStainingMounting\": {\n", " \"@id\": \"nsg:FixationStainingMounting\"\n", " },\n", " \"FixedStainedSlice\": {\n", " \"@id\": \"nsg:FixedStainedSlice\"\n", " },\n", " \"GeneExpressionVolumetricDataLayer\": {\n", " \"@id\": \"nsg:GeneExpressionVolumetricDataLayer\"\n", " },\n", " \"Generation\": {\n", " \"@id\": \"prov:Generation\"\n", " },\n", " \"GliaCellDensity\": {\n", " \"@id\": \"nsg:GliaCellDensity\"\n", " },\n", " \"HostCell\": {\n", " \"@id\": \"nsg:HostCell\"\n", " },\n", " \"ImageStack\": {\n", " \"@id\": \"nsg:ImageStack\"\n", " },\n", " \"ImageVolume\": {\n", " \"@id\": \"nsg:ImageVolume\"\n", " },\n", " \"InVitroSliceReconstructedPatchedNeuron\": {\n", " \"@id\": \"nsg:InVitroSliceReconstructedPatchedNeuron\"\n", " },\n", " \"InVitroSliceWholeCellPatchClampElectrophysiologyTrace\": {\n", " \"@id\": \"nsg:InVitroSliceWholeCellPatchClampElectrophysiologyTrace\"\n", " },\n", " \"InVitroWholeBrainReconstructedNeuronMorphology\": {\n", " \"@id\": \"nsg:InVitroWholeBrainReconstructedNeuronMorphology\"\n", " },\n", " \"IntraCellularSharpElectrode\": {\n", " \"@id\": \"nsg:IntraCellularSharpElectrode\"\n", " },\n", " \"IntraCellularSharpElectrodeRecordedCell\": {\n", " \"@id\": \"nsg:IntraCellularSharpElectrodeRecordedCell\"\n", " },\n", " \"IntraCellularSharpElectrodeRecordedCellCollection\": {\n", " \"@id\": \"nsg:IntraCellularSharpElectrodeRecordedCellCollection\"\n", " },\n", " \"IntraCellularSharpElectrodeRecordedSlice\": {\n", " \"@id\": \"nsg:IntraCellularSharpElectrodeRecordedSlice\"\n", " },\n", " \"Invalidation\": {\n", " \"@id\": \"prov:Invalidation\"\n", " },\n", " \"IonChannelGene\": {\n", " \"@id\": \"nsg:IonChannelGene\"\n", " },\n", " \"IonChannelMechanismRelease\": {\n", " \"@id\": \"nsg:IonChannelMechanismRelease\"\n", " },\n", " \"LabeledCell\": {\n", " \"@id\": \"nsg:LabeledCell\"\n", " },\n", " \"LabeledCellCollection\": {\n", " \"@id\": \"nsg:LabeledCellCollection\"\n", " },\n", " \"LayerThickness\": {\n", " \"@id\": \"nsg:LayerThickness\"\n", " },\n", " \"LinearTransform\": {\n", " \"@id\": \"nsg:LinearTransform\"\n", " },\n", " \"MEModel\": {\n", " \"@id\": \"nsg:MEModel\"\n", " },\n", " \"MEModelRelease\": {\n", " \"@id\": \"nsg:MEModelRelease\"\n", " },\n", " \"Mesh\": {\n", " \"@id\": \"nsg:Mesh\"\n", " },\n", " \"ModelInstance\": {\n", " \"@id\": \"nsg:ModelInstance\"\n", " },\n", " \"ModelRelease\": {\n", " \"@id\": \"nsg:ModelRelease\"\n", " },\n", " \"ModelReleaseIndex\": {\n", " \"@id\": \"nsg:ModelReleaseIndex\"\n", " },\n", " \"ModelValidation\": {\n", " \"@id\": \"nsg:ModelValidation\"\n", " },\n", " \"Morphology\": {\n", " \"@id\": \"nsg:Morphology\"\n", " },\n", " \"MorphologyDiversification\": {\n", " \"@id\": \"nsg:MorphologyDiversification\"\n", " },\n", " \"MorphologyMesh\": {\n", " \"@id\": \"nsg:MorphologyMesh\"\n", " },\n", " \"MorphologyMeshGeneration\": {\n", " \"@id\": \"nsg:MorphologyMeshGeneration\"\n", " },\n", " \"MorphologyOrientationDataLayer\": {\n", " \"@id\": \"nsg:MorphologyOrientationDataLayer\"\n", " },\n", " \"MorphologyRelease\": {\n", " \"@id\": \"nsg:MorphologyRelease\"\n", " },\n", " \"NISSLImageDataLayer\": {\n", " \"@id\": \"nsg:NISSLImageDataLayer\"\n", " },\n", " \"NdRaster\": {\n", " \"@id\": \"nsg:NdRaster\"\n", " },\n", " \"NeuronDensity\": {\n", " \"@id\": \"nsg:NeuronDensity\"\n", " },\n", " \"NeuronMorphology\": {\n", " \"@id\": \"nsg:NeuronMorphology\"\n", " },\n", " \"NeuronMorphologyReconstruction\": {\n", " \"@id\": \"nsg:NeuronMorphologyReconstruction\"\n", " },\n", " \"NodeCollection\": {\n", " \"@id\": \"nsg:NodeCollection\"\n", " },\n", " \"Ontology\": {\n", " \"@id\": \"owl:Ontology\"\n", " },\n", " \"OntologyConversion\": {\n", " \"@id\": \"nsg:OntologyConversion\"\n", " },\n", " \"Organization\": {\n", " \"@id\": \"schema:Organization\"\n", " },\n", " \"PHDataLayer\": {\n", " \"@id\": \"nsg:PHDataLayer\"\n", " },\n", " \"Parameter\": {\n", " \"@id\": \"nsg:Parameter\"\n", " },\n", " \"ParcellationImageData\": {\n", " \"@id\": \"nsg:ParcellationImageData\"\n", " },\n", " \"ParcellationLabel\": {\n", " \"@id\": \"nsg:ParcellationLabel\"\n", " },\n", " \"ParcellationMeshGeneration\": {\n", " \"@id\": \"nsg:ParcellationMeshGeneration\"\n", " },\n", " \"ParcellationOntology\": {\n", " \"@id\": \"nsg:ParcellationOntology\"\n", " },\n", " \"ParcellationReconstruction\": {\n", " \"@id\": \"nsg:ParcellationReconstruction\"\n", " },\n", " \"ParcellationVolume\": {\n", " \"@id\": \"nsg:ParcellationVolume\"\n", " },\n", " \"PatchClamp\": {\n", " \"@id\": \"nsg:PatchClamp\"\n", " },\n", " \"PatchedCell\": {\n", " \"@id\": \"nsg:PatchedCell\"\n", " },\n", " \"PatchedCellCollection\": {\n", " \"@id\": \"nsg:PatchedCellCollection\"\n", " },\n", " \"PatchedSlice\": {\n", " \"@id\": \"nsg:PatchedSlice\"\n", " },\n", " \"Person\": {\n", " \"@id\": \"schema:Person\"\n", " },\n", " \"Protocol\": {\n", " \"@id\": \"nsg:Protocol\"\n", " },\n", " \"QuantitativeValue\": {\n", " \"@id\": \"schema:QuantitativeValue\"\n", " },\n", " \"ReconstructedCell\": {\n", " \"@id\": \"nsg:ReconstructedCell\"\n", " },\n", " \"ReconstructedCellFormatConversion\": {\n", " \"@id\": \"nsg:ReconstructedCellFormatConversion\"\n", " },\n", " \"ReconstructedCellRelease\": {\n", " \"@id\": \"nsg:ReconstructedCellRelease\"\n", " },\n", " \"ReconstructedCellReleaseGeneration\": {\n", " \"@id\": \"nsg:ReconstructedCellReleaseGeneration\"\n", " },\n", " \"ReconstructedCellReleaseProcess\": {\n", " \"@id\": \"nsg:ReconstructedCellReleaseProcess\"\n", " },\n", " \"ReconstructedNeuronMorphology\": {\n", " \"@id\": \"nsg:ReconstructedNeuronMorphology\"\n", " },\n", " \"ReconstructedPatchedCell\": {\n", " \"@id\": \"nsg:ReconstructedPatchedCell\"\n", " },\n", " \"ReconstructedWholeBrainCell\": {\n", " \"@id\": \"nsg:ReconstructedWholeBrainCell\"\n", " },\n", " \"Reconstruction\": {\n", " \"@id\": \"nsg:Reconstruction\"\n", " },\n", " \"ReconstructionCorrection\": {\n", " \"@id\": \"nsg:ReconstructionCorrection\"\n", " },\n", " \"ReconstructionFromImage\": {\n", " \"@id\": \"nsg:ReconstructionFromImage\"\n", " },\n", " \"RecordMeasure\": {\n", " \"@id\": \"nsg:RecordMeasure\"\n", " },\n", " \"RecordSeries\": {\n", " \"@id\": \"nsg:RecordSeries\"\n", " },\n", " \"RegionOfInterest\": {\n", " \"@id\": \"nsg:RegionOfInterest\"\n", " },\n", " \"ResponseTrace\": {\n", " \"@id\": \"nsg:ResponseTrace\"\n", " },\n", " \"RigidLinearTransform\": {\n", " \"@id\": \"nsg:RigidLinearTransform\"\n", " },\n", " \"RotationalMatrix\": {\n", " \"@id\": \"nsg:RotationalMatrix\"\n", " },\n", " \"SimWriterConfiguration\": {\n", " \"@id\": \"nsg:SimWriterConfiguration\",\n", " \"@type\": \"@id\"\n", " },\n", " \"SimplifiedCircuit\": {\n", " \"@id\": \"nsg:SimplifiedCircuit\"\n", " },\n", " \"Simulation\": {\n", " \"@id\": \"nsg:Simulation\"\n", " },\n", " \"SimulationCampaign\": {\n", " \"@id\": \"nsg:SimulationCampaign\",\n", " \"@type\": \"@id\"\n", " },\n", " \"SimulationTrace\": {\n", " \"@id\": \"nsg:SimulationTrace\"\n", " },\n", " \"SingleCellSimulationTrace\": {\n", " \"@id\": \"nsg:SingleCellSimulationTrace\"\n", " },\n", " \"SingleCellTraceGeneration\": {\n", " \"@id\": \"nsg:SingleCellTraceGeneration\"\n", " },\n", " \"Slice\": {\n", " \"@id\": \"nsg:Slice\"\n", " },\n", " \"SliceCollection\": {\n", " \"@id\": \"nsg:SliceCollection\"\n", " },\n", " \"SoftwareAgent\": {\n", " \"@id\": \"prov:SoftwareAgent\"\n", " },\n", " \"SpaceDimension\": {\n", " \"@id\": \"nsg:SpaceDimension\"\n", " },\n", " \"SpatialIndex\": {\n", " \"@id\": \"nsg:SpatialIndex\"\n", " },\n", " \"SpatialIndexDerivation\": {\n", " \"@id\": \"nsg:SpatialIndexDerivation\"\n", " },\n", " \"StimulationTrace\": {\n", " \"@id\": \"nsg:StimulationTrace\"\n", " },\n", " \"StimulusExperiment\": {\n", " \"@id\": \"nsg:StimulusExperiment\"\n", " },\n", " \"SubCellularModel\": {\n", " \"@id\": \"nsg:SubCellularModel\"\n", " },\n", " \"SubCellularModelScript\": {\n", " \"@id\": \"nsg:SubCellularModelScript\"\n", " },\n", " \"Subject\": {\n", " \"@id\": \"nsg:Subject\"\n", " },\n", " \"SubjectCollection\": {\n", " \"@id\": \"nsg:SubjectCollection\"\n", " },\n", " \"SynapseRelease\": {\n", " \"@id\": \"nsg:SynapseRelease\"\n", " },\n", " \"Target\": {\n", " \"@id\": \"nsg:Target\"\n", " },\n", " \"TemplateImageData\": {\n", " \"@id\": \"nsg:TemplateImageData\"\n", " },\n", " \"TemplateReconstruction\": {\n", " \"@id\": \"nsg:TemplateReconstruction\"\n", " },\n", " \"TemplateVolume\": {\n", " \"@id\": \"nsg:TemplateVolume\"\n", " },\n", " \"Thickness\": {\n", " \"@id\": \"nsg:Thickness\"\n", " },\n", " \"Threshold\": {\n", " \"@id\": \"nsg:Threshold\"\n", " },\n", " \"Trace\": {\n", " \"@id\": \"nsg:Trace\"\n", " },\n", " \"TraceCollection\": {\n", " \"@id\": \"nsg:TraceCollection\"\n", " },\n", " \"TraceFeature\": {\n", " \"@id\": \"nsg:TraceFeature\"\n", " },\n", " \"TraceFeatureExtraction\": {\n", " \"@id\": \"nsg:TraceFeatureExtraction\"\n", " },\n", " \"TraceGeneration\": {\n", " \"@id\": \"nsg:TraceGeneration\"\n", " },\n", " \"Transfection\": {\n", " \"@id\": \"nsg:Transfection\"\n", " },\n", " \"Transform\": {\n", " \"@id\": \"nsg:Transform\"\n", " },\n", " \"Transformation\": {\n", " \"@id\": \"nsg:Transformation\"\n", " },\n", " \"TwoPhotonImageDataLayer\": {\n", " \"@id\": \"nsg:TwoPhotonImageDataLayer\"\n", " },\n", " \"Usage\": {\n", " \"@id\": \"prov:Usage\"\n", " },\n", " \"ValidationResult\": {\n", " \"@id\": \"nsg:ValidationResult\"\n", " },\n", " \"VariableReport\": {\n", " \"@id\": \"nsg:VariableReport\"\n", " },\n", " \"VolumetricDataLayer\": {\n", " \"@id\": \"nsg:VolumetricDataLayer\"\n", " },\n", " \"WholeCellPatchClamp\": {\n", " \"@id\": \"nsg:WholeCellPatchClamp\"\n", " },\n", " \"WorkflowEngine\": {\n", " \"@id\": \"nsg:WorkflowEngine\"\n", " },\n", " \"WorkflowExecution\": {\n", " \"@id\": \"nsg:WorkflowExecution\",\n", " \"@type\": \"@id\"\n", " },\n", " \"about\": {\n", " \"@id\": \"schema:about\",\n", " \"@type\": \"@id\"\n", " },\n", " \"activity\": {\n", " \"@id\": \"prov:activity\"\n", " },\n", " \"activityType\": {\n", " \"@id\": \"nsg:activityType\"\n", " },\n", " \"additionalName\": {\n", " \"@id\": \"schema:additionalName\"\n", " },\n", " \"address\": {\n", " \"@id\": \"schema:address\"\n", " },\n", " \"addressCountry\": {\n", " \"@id\": \"schema:addressCountry\"\n", " },\n", " \"addressLocality\": {\n", " \"@id\": \"schema:addressLocality\"\n", " },\n", " \"affiliation\": {\n", " \"@id\": \"schema:affiliation\"\n", " },\n", " \"age\": {\n", " \"@id\": \"nsg:age\"\n", " },\n", " \"agent\": {\n", " \"@id\": \"prov:agent\"\n", " },\n", " \"algorithm\": {\n", " \"@id\": \"schema:algorithm\"\n", " },\n", " \"altLabel\": {\n", " \"@id\": \"skos:altLabel\"\n", " },\n", " \"alternateName\": {\n", " \"@id\": \"schema:alternateName\"\n", " },\n", " \"alternateOf\": {\n", " \"@id\": \"prov:alternateOf\"\n", " },\n", " \"analogToDigitalConverter\": {\n", " \"@id\": \"nsg:analogToDigitalConverter\"\n", " },\n", " \"annotation\": {\n", " \"@id\": \"nsg:annotation\"\n", " },\n", " \"annotationAngle\": {\n", " \"@id\": \"nsg:annotationAngle\"\n", " },\n", " \"annotatorComment\": {\n", " \"@id\": \"nsg:annotatorComment\"\n", " },\n", " \"atTime\": {\n", " \"@id\": \"prov:atTime\"\n", " },\n", " \"atlasRelease\": {\n", " \"@id\": \"nsg:atlasRelease\"\n", " },\n", " \"atlasSpatialReferenceSystem\": {\n", " \"@id\": \"nsg:atlasSpatialReferenceSystem\",\n", " \"@type\": \"@id\"\n", " },\n", " \"atlasVersion\": {\n", " \"@id\": \"nsg:atlasVersion\"\n", " },\n", " \"atlas_id\": {\n", " \"@id\": \"mba:atlas_id\"\n", " },\n", " \"author\": {\n", " \"@id\": \"schema:author\",\n", " \"@type\": \"@id\"\n", " },\n", " \"axonProjection\": {\n", " \"@id\": \"nsg:axonProjection\"\n", " },\n", " \"bathSolution\": {\n", " \"@id\": \"nsg:bathSolution\"\n", " },\n", " \"bestScore\": {\n", " \"@id\": \"nsg:bestScore\"\n", " },\n", " \"birthDate\": {\n", " \"@id\": \"schema:birthDate\"\n", " },\n", " \"boundary\": {\n", " \"@id\": \"nsg:boundary\"\n", " },\n", " \"boundingBox\": {\n", " \"@id\": \"nsg:boundingBox\"\n", " },\n", " \"brainLocation\": {\n", " \"@id\": \"nsg:brainLocation\"\n", " },\n", " \"brainRegion\": {\n", " \"@id\": \"nsg:brainRegion\"\n", " },\n", " \"brainTemplateDataLayer\": {\n", " \"@id\": \"nsg:brainTemplateDataLayer\"\n", " },\n", " \"bufferEncoding\": {\n", " \"@id\": \"nsg:bufferEncoding\"\n", " },\n", " \"byteOffset\": {\n", " \"@id\": \"nsg:byteOffset\"\n", " },\n", " \"cellLibraryFile\": {\n", " \"@id\": \"nsg:cellLibraryFile\"\n", " },\n", " \"cellLine\": {\n", " \"@id\": \"nsg:cellLine\"\n", " },\n", " \"center\": {\n", " \"@id\": \"nsg:center\"\n", " },\n", " \"channel\": {\n", " \"@id\": \"nsg:channel\"\n", " },\n", " \"chlorideReversalPotential\": {\n", " \"@id\": \"nsg:chlorideReversalPotential\"\n", " },\n", " \"circuitCellProperties\": {\n", " \"@id\": \"nsg:circuitCellProperties\"\n", " },\n", " \"citation\": {\n", " \"@id\": \"schema:citation\"\n", " },\n", " \"color_hex_triplet\": {\n", " \"@id\": \"mba:color_hex_triplet\"\n", " },\n", " \"column\": {\n", " \"@id\": \"nsg:column\"\n", " },\n", " \"comment\": {\n", " \"@id\": \"rdfs:comment\"\n", " },\n", " \"compensationCurrent\": {\n", " \"@id\": \"nsg:compensationCurrent\"\n", " },\n", " \"componentEncoding\": {\n", " \"@id\": \"nsg:componentEncoding\"\n", " },\n", " \"compressionCorrection\": {\n", " \"@id\": \"nsg:compressionCorrection\"\n", " },\n", " \"configuration\": {\n", " \"@id\": \"nsg:configuration\"\n", " },\n", " \"conformsTo\": {\n", " \"@id\": \"nsg:conformsTo\"\n", " },\n", " \"contentSize\": {\n", " \"@id\": \"schema:contentSize\"\n", " },\n", " \"contentUrl\": {\n", " \"@id\": \"schema:contentUrl\",\n", " \"@type\": \"@id\"\n", " },\n", " \"contribution\": {\n", " \"@id\": \"nsg:contribution\"\n", " },\n", " \"coordinatesInBrainAtlas\": {\n", " \"@id\": \"nsg:coordinatesInBrainAtlas\"\n", " },\n", " \"coordinatesInSlice\": {\n", " \"@id\": \"nsg:coordinatesInSlice\"\n", " },\n", " \"cuttingThickness\": {\n", " \"@id\": \"nsg:cuttingThickness\"\n", " },\n", " \"dateCreated\": {\n", " \"@id\": \"schema:dateCreated\"\n", " },\n", " \"dateModified\": {\n", " \"@id\": \"schema:dateModified\"\n", " },\n", " \"dateOfSurgery\": {\n", " \"@id\": \"nsg:dateOfSurgery\"\n", " },\n", " \"datePublished\": {\n", " \"@id\": \"schema:datePublished\"\n", " },\n", " \"dc\": \"http://purl.org/dc/elements/1.1/\",\n", " \"dcat\": \"http://www.w3.org/ns/dcat#\",\n", " \"dcterms\": \"http://purl.org/dc/terms/\",\n", " \"deathDate\": {\n", " \"@id\": \"schema:deathDate\"\n", " },\n", " \"defines\": {\n", " \"@id\": \"nsg:defines\",\n", " \"@type\": \"@id\"\n", " },\n", " \"definition\": {\n", " \"@id\": \"skos:definition\"\n", " },\n", " \"density\": {\n", " \"@id\": \"nsg:density\"\n", " },\n", " \"derivation\": {\n", " \"@id\": \"nsg:derivation\"\n", " },\n", " \"description\": {\n", " \"@id\": \"schema:description\"\n", " },\n", " \"digest\": {\n", " \"@id\": \"nsg:digest\"\n", " },\n", " \"digitalToAnalogConverter\": {\n", " \"@id\": \"nsg:digitalToAnalogConverter\"\n", " },\n", " \"dimension\": {\n", " \"@id\": \"nsg:dimension\",\n", " \"@container\": \"@list\"\n", " },\n", " \"disease\": {\n", " \"@id\": \"nsg:disease\"\n", " },\n", " \"diseaseModel\": {\n", " \"@id\": \"nsg:diseaseModel\"\n", " },\n", " \"distance\": {\n", " \"@id\": \"schema:distance\"\n", " },\n", " \"distanceToBoundary\": {\n", " \"@id\": \"nsg:distanceToBoundary\"\n", " },\n", " \"distribution\": {\n", " \"@id\": \"schema:distribution\"\n", " },\n", " \"doi\": {\n", " \"@id\": \"nsg:doi\"\n", " },\n", " \"drug\": {\n", " \"@id\": \"schema:drug\"\n", " },\n", " \"eCode\": {\n", " \"@id\": \"nsg:eCode\"\n", " },\n", " \"eModel\": {\n", " \"@id\": \"nsg:eModel\"\n", " },\n", " \"eType\": {\n", " \"@id\": \"nsg:eType\"\n", " },\n", " \"edgeCollection\": {\n", " \"@id\": \"nsg:edgeCollection\"\n", " },\n", " \"edgePopulation\": {\n", " \"@id\": \"nsg:edgePopulation\"\n", " },\n", " \"electrodeNumber\": {\n", " \"@id\": \"nsg:electrodeNumber\"\n", " },\n", " \"electrodeResistance\": {\n", " \"@id\": \"nsg:electrodeResistance\"\n", " },\n", " \"email\": {\n", " \"@id\": \"schema:email\"\n", " },\n", " \"emodelIndex\": {\n", " \"@id\": \"nsg:emodelIndex\"\n", " },\n", " \"emodelRelease\": {\n", " \"@id\": \"nsg:emodelRelease\"\n", " },\n", " \"encodingFormat\": {\n", " \"@id\": \"schema:encodingFormat\"\n", " },\n", " \"endMembranePotential\": {\n", " \"@id\": \"nsg:endMembranePotential\"\n", " },\n", " \"endedAtTime\": {\n", " \"@id\": \"prov:endedAtTime\"\n", " },\n", " \"endianness\": {\n", " \"@id\": \"nsg:endianness\"\n", " },\n", " \"entity\": {\n", " \"@id\": \"prov:entity\"\n", " },\n", " \"experimentalCell\": {\n", " \"@id\": \"nsg:experimentalCell\"\n", " },\n", " \"familyName\": {\n", " \"@id\": \"schema:familyName\"\n", " },\n", " \"faxNumber\": {\n", " \"@id\": \"schema:faxNumber\"\n", " },\n", " \"featureExtractionConfiguration\": {\n", " \"@id\": \"nsg:featureExtractionConfiguration\"\n", " },\n", " \"features\": {\n", " \"@id\": \"nsg:features\"\n", " },\n", " \"fileExtension\": {\n", " \"@id\": \"nsg:fileExtension\"\n", " },\n", " \"first\": {\n", " \"@id\": \"rdf:first\"\n", " },\n", " \"firstRow\": {\n", " \"@id\": \"nsg:firstRow\"\n", " },\n", " \"fixationMethod\": {\n", " \"@id\": \"nsg:fixationMethod\"\n", " },\n", " \"fixedSliceHeight\": {\n", " \"@id\": \"nsg:fixedSliceHeight\"\n", " },\n", " \"fixedSliceWidth\": {\n", " \"@id\": \"nsg:fixedSliceWidth\"\n", " },\n", " \"gain\": {\n", " \"@id\": \"nsg:gain\"\n", " },\n", " \"gene\": {\n", " \"@id\": \"nsg:gene\"\n", " },\n", " \"generated\": {\n", " \"@id\": \"prov:generated\"\n", " },\n", " \"generation\": {\n", " \"@id\": \"nsg:generation\"\n", " },\n", " \"geometry\": {\n", " \"@id\": \"nsg:geometry\"\n", " },\n", " \"geometryParameter\": {\n", " \"@id\": \"nsg:geometryParameter\"\n", " },\n", " \"givenName\": {\n", " \"@id\": \"schema:givenName\"\n", " },\n", " \"graph_order\": {\n", " \"@id\": \"mba:graph_order\"\n", " },\n", " \"hadActivity\": {\n", " \"@id\": \"prov:hadActivity\"\n", " },\n", " \"hadMember\": {\n", " \"@id\": \"prov:hadMember\"\n", " },\n", " \"hadPlan\": {\n", " \"@id\": \"prov:hadPlan\"\n", " },\n", " \"hadProtocol\": {\n", " \"@id\": \"nsg:hadProtocol\"\n", " },\n", " \"hadRole\": {\n", " \"@id\": \"prov:hadRole\"\n", " },\n", " \"hadUsage\": {\n", " \"@id\": \"prov:hadUsage\"\n", " },\n", " \"hasApicalDendrite\": {\n", " \"@id\": \"nsg:hasApicalDendrite\"\n", " },\n", " \"hasAxon\": {\n", " \"@id\": \"nsg:hasAxon\"\n", " },\n", " \"hasBasalDendrite\": {\n", " \"@id\": \"nsg:hasBasalDendrite\"\n", " },\n", " \"hasBody\": {\n", " \"@id\": \"nsg:hasBody\"\n", " },\n", " \"hasPart\": {\n", " \"@id\": \"schema:hasPart\",\n", " \"@type\": \"@id\"\n", " },\n", " \"hasSelector\": {\n", " \"@id\": \"nsg:hasSelector\"\n", " },\n", " \"hasSoma\": {\n", " \"@id\": \"nsg:hasSoma\"\n", " },\n", " \"hasSource\": {\n", " \"@id\": \"nsg:hasSource\"\n", " },\n", " \"hasTarget\": {\n", " \"@id\": \"nsg:hasTarget\"\n", " },\n", " \"heightAnatomicalDirection\": {\n", " \"@id\": \"nsg:heightAnatomicalDirection\"\n", " },\n", " \"heightResolution\": {\n", " \"@id\": \"nsg:heightResolution\"\n", " },\n", " \"hemisphere\": {\n", " \"@id\": \"nsg:hemisphere\"\n", " },\n", " \"hemisphere_id\": {\n", " \"@id\": \"mba:hemisphere_id\"\n", " },\n", " \"hypampThreshold\": {\n", " \"@id\": \"nsg:hypampThreshold\"\n", " },\n", " \"identifier\": {\n", " \"@id\": \"schema:identifier\"\n", " },\n", " \"image\": {\n", " \"@id\": \"schema:image\"\n", " },\n", " \"imageDirection\": {\n", " \"@id\": \"nsg:imageDirection\"\n", " },\n", " \"imageModality\": {\n", " \"@id\": \"nsg:imageModality\"\n", " },\n", " \"imageOrigin\": {\n", " \"@id\": \"nsg:imageOrigin\"\n", " },\n", " \"imageVolume\": {\n", " \"@id\": \"nsg:imageVolume\"\n", " },\n", " \"imagingMethod\": {\n", " \"@id\": \"nsg:imagingMethod\"\n", " },\n", " \"imports\": {\n", " \"@id\": \"owl:imports\"\n", " },\n", " \"inScheme\": {\n", " \"@id\": \"skos:inScheme\"\n", " },\n", " \"index\": {\n", " \"@id\": \"nsg:index\"\n", " },\n", " \"inputResistance\": {\n", " \"@id\": \"nsg:inputResistance\"\n", " },\n", " \"invalidation\": {\n", " \"@id\": \"nsg:invalidation\"\n", " },\n", " \"ionChannelGene\": {\n", " \"@id\": \"nsg:ionChannelGene\"\n", " },\n", " \"isDefinedBy\": {\n", " \"@id\": \"rdfs:isDefinedBy\",\n", " \"@type\": \"@id\"\n", " },\n", " \"isPartOf\": {\n", " \"@id\": \"schema:isPartOf\",\n", " \"@type\": \"@id\"\n", " },\n", " \"isRegisteredIn\": {\n", " \"@id\": \"nsg:isRegisteredIn\"\n", " },\n", " \"keywords\": {\n", " \"@id\": \"schema:keywords\"\n", " },\n", " \"label\": {\n", " \"@id\": \"rdfs:label\"\n", " },\n", " \"labelingCompound\": {\n", " \"@id\": \"nsg:labelingCompound\"\n", " },\n", " \"language\": {\n", " \"@id\": \"schema:language\"\n", " },\n", " \"layer\": {\n", " \"@id\": \"nsg:layer\"\n", " },\n", " \"license\": {\n", " \"@id\": \"schema:license\"\n", " },\n", " \"liquidJunctionPotential\": {\n", " \"@id\": \"nsg:liquidJunctionPotential\"\n", " },\n", " \"location\": {\n", " \"@id\": \"nsg:location\"\n", " },\n", " \"locationInSlice\": {\n", " \"@id\": \"nsg:locationInSlice\"\n", " },\n", " \"longitudinalAxis\": {\n", " \"@id\": \"nsg:longitudinalAxis\"\n", " },\n", " \"lowerPoint\": {\n", " \"@id\": \"nsg:lowerPoint\"\n", " },\n", " \"mType\": {\n", " \"@id\": \"nsg:mType\"\n", " },\n", " \"MType\": {\n", " \"@id\": \"nsg:MType\"\n", " },\n", " \"CellPositions\": {\n", " \"@id\": \"nsg:CellPositions\"\n", " },\n", " \"mainModelScript\": {\n", " \"@id\": \"nsg:mainModelScript\"\n", " },\n", " \"materials\": {\n", " \"@id\": \"nsg:materials\"\n", " },\n", " \"maxValue\": {\n", " \"@id\": \"schema:maxValue\"\n", " },\n", " \"mba\": \"http://api.brain-map.org/api/v2/data/Structure/\",\n", " \"measuredHoldingPotential\": {\n", " \"@id\": \"nsg:measuredHoldingPotential\"\n", " },\n", " \"memodelIndex\": {\n", " \"@id\": \"nsg:memodelIndex\"\n", " },\n", " \"memodelRelease\": {\n", " \"@id\": \"nsg:memodelRelease\"\n", " },\n", " \"minValue\": {\n", " \"@id\": \"schema:minValue\"\n", " },\n", " \"modelOf\": {\n", " \"@id\": \"nsg:modelOf\"\n", " },\n", " \"modelScript\": {\n", " \"@id\": \"nsg:modelScript\"\n", " },\n", " \"morphology\": {\n", " \"@id\": \"nsg:morphology\"\n", " },\n", " \"morphologyIndex\": {\n", " \"@id\": \"nsg:morphologyIndex\"\n", " },\n", " \"morphologyRelease\": {\n", " \"@id\": \"nsg:morphologyRelease\"\n", " },\n", " \"mountingMedia\": {\n", " \"@id\": \"nsg:mountingMedia\"\n", " },\n", " \"name\": {\n", " \"@id\": \"schema:name\"\n", " },\n", " \"nodeCollection\": {\n", " \"@id\": \"nsg:nodeCollection\"\n", " },\n", " \"normalizedScore\": {\n", " \"@id\": \"nsg:normalizedScore\"\n", " },\n", " \"notation\": {\n", " \"@id\": \"skos:notation\"\n", " },\n", " \"note\": {\n", " \"@id\": \"skos:note\"\n", " },\n", " \"nsg\": \"https://neuroshapes.org/\",\n", " \"numberOfRecords\": {\n", " \"@id\": \"nsg:numberOfRecords\"\n", " },\n", " \"numberOfSlices\": {\n", " \"@id\": \"nsg:numberOfSlices\"\n", " },\n", " \"objectOfStudy\": {\n", " \"@id\": \"nsg:objectOfStudy\"\n", " },\n", " \"objectiveMagnification\": {\n", " \"@id\": \"nsg:objectiveMagnification\"\n", " },\n", " \"objectiveType\": {\n", " \"@id\": \"nsg:objectiveType\"\n", " },\n", " \"orientation\": {\n", " \"@id\": \"nsg:orientation\"\n", " },\n", " \"origin\": {\n", " \"@id\": \"nsg:origin\"\n", " },\n", " \"owl\": \"http://www.w3.org/2002/07/owl#\",\n", " \"parameter\": {\n", " \"@id\": \"nsg:parameter\"\n", " },\n", " \"parcellationOntology\": {\n", " \"@id\": \"nsg:parcellationOntology\"\n", " },\n", " \"parcellationVolume\": {\n", " \"@id\": \"nsg:parcellationVolume\"\n", " },\n", " \"parentOrganization\": {\n", " \"@id\": \"schema:parentOrganization\"\n", " },\n", " \"period\": {\n", " \"@id\": \"nsg:period\"\n", " },\n", " \"pipetteNumber\": {\n", " \"@id\": \"nsg:pipetteNumber\"\n", " },\n", " \"pipetteResistance\": {\n", " \"@id\": \"nsg:pipetteResistance\"\n", " },\n", " \"polygon\": {\n", " \"@id\": \"schema:polygon\"\n", " },\n", " \"positionInLayer\": {\n", " \"@id\": \"nsg:positionInLayer\"\n", " },\n", " \"postSynaptic\": {\n", " \"@id\": \"nsg:postSynaptic\"\n", " },\n", " \"postalCode\": {\n", " \"@id\": \"schema:postalCode\"\n", " },\n", " \"preSynaptic\": {\n", " \"@id\": \"nsg:preSynaptic\"\n", " },\n", " \"prefLabel\": {\n", " \"@id\": \"skos:prefLabel\"\n", " },\n", " \"projectName\": {\n", " \"@id\": \"nsg:projectName\"\n", " },\n", " \"properties\": {\n", " \"@id\": \"nsg:properties\"\n", " },\n", " \"propertyID\": {\n", " \"@id\": \"schema:propertyID\"\n", " },\n", " \"prov\": \"http://www.w3.org/ns/prov#\",\n", " \"providerExperimentId\": {\n", " \"@id\": \"nsg:providerExperimentId\"\n", " },\n", " \"providerExperimentName\": {\n", " \"@id\": \"nsg:providerExperimentName\"\n", " },\n", " \"putativeEtype\": {\n", " \"@id\": \"nsg:putativeEtype\"\n", " },\n", " \"putativeMType\": {\n", " \"@id\": \"nsg:putativeMType\"\n", " },\n", " \"qualifiedAssociation\": {\n", " \"@id\": \"prov:qualifiedAssociation\"\n", " },\n", " \"qualifiedGeneration\": {\n", " \"@id\": \"prov:qualifiedGeneration\"\n", " },\n", " \"qualifiedUsage\": {\n", " \"@id\": \"prov:qualifiedUsage\"\n", " },\n", " \"quality\": {\n", " \"@id\": \"nsg:quality\"\n", " },\n", " \"radius\": {\n", " \"@id\": \"nsg:radius\"\n", " },\n", " \"rdf\": \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\n", " \"rdfs\": \"http://www.w3.org/2000/01/rdf-schema#\",\n", " \"reagentLinearFormula\": {\n", " \"@id\": \"nsg:reagentLinearFormula\"\n", " },\n", " \"reagentMolarWeight\": {\n", " \"@id\": \"nsg:reagentMolarWeight\"\n", " },\n", " \"reagentName\": {\n", " \"@id\": \"nsg:reagentName\"\n", " },\n", " \"reagentVendor\": {\n", " \"@id\": \"nsg:reagentVendor\"\n", " },\n", " \"reconstructable\": {\n", " \"@id\": \"nsg:reconstructable\"\n", " },\n", " \"reconstructionRequested\": {\n", " \"@id\": \"nsg:reconstructionRequested\"\n", " },\n", " \"recordMeasure\": {\n", " \"@id\": \"nsg:recordMeasure\",\n", " \"@container\": \"@list\"\n", " },\n", " \"releaseDate\": {\n", " \"@id\": \"schema:releaseDate\"\n", " },\n", " \"repetition\": {\n", " \"@id\": \"nsg:repetition\"\n", " },\n", " \"repetitions\": {\n", " \"@id\": \"schema:repetitions\"\n", " },\n", " \"resolution\": {\n", " \"@id\": \"nsg:resolution\"\n", " },\n", " \"rest\": {\n", " \"@id\": \"rdf:rest\"\n", " },\n", " \"row\": {\n", " \"@id\": \"nsg:row\"\n", " },\n", " \"sType\": {\n", " \"@id\": \"nsg:sType\",\n", " \"@type\": \"@id\"\n", " },\n", " \"sameAs\": {\n", " \"@id\": \"schema:sameAs\"\n", " },\n", " \"sampleType\": {\n", " \"@id\": \"nsg:sampleType\"\n", " },\n", " \"scale\": {\n", " \"@id\": \"nsg:scale\"\n", " },\n", " \"schema\": \"http://schema.org/\",\n", " \"score\": {\n", " \"@id\": \"nsg:score\"\n", " },\n", " \"sealResistance\": {\n", " \"@id\": \"nsg:sealResistance\"\n", " },\n", " \"secondRow\": {\n", " \"@id\": \"nsg:secondRow\"\n", " },\n", " \"series\": {\n", " \"@id\": \"nsg:series\"\n", " },\n", " \"seriesResistance\": {\n", " \"@id\": \"nsg:seriesResistance\"\n", " },\n", " \"sex\": {\n", " \"@id\": \"nsg:sex\"\n", " },\n", " \"sh\": \"http://www.w3.org/ns/shacl#\",\n", " \"shsh\": \"http://www.w3.org/ns/shacl-shacl#\",\n", " \"size\": {\n", " \"@id\": \"schema:size\"\n", " },\n", " \"skos\": \"http://www.w3.org/2004/02/skos/core#\",\n", " \"sku\": {\n", " \"@id\": \"schema:sku\"\n", " },\n", " \"sliceHeight\": {\n", " \"@id\": \"nsg:sliceHeight\"\n", " },\n", " \"sliceInterval\": {\n", " \"@id\": \"nsg:sliceInterval\"\n", " },\n", " \"sliceIntervalValue\": {\n", " \"@id\": \"nsg:sliceIntervalValue\"\n", " },\n", " \"sliceResolution\": {\n", " \"@id\": \"nsg:sliceResolution\"\n", " },\n", " \"sliceWidth\": {\n", " \"@id\": \"nsg:sliceWidth\"\n", " },\n", " \"slicingAngle\": {\n", " \"@id\": \"nsg:slicingAngle\"\n", " },\n", " \"slicingPlane\": {\n", " \"@id\": \"nsg:slicingPlane\"\n", " },\n", " \"solution\": {\n", " \"@id\": \"nsg:solution\"\n", " },\n", " \"somaReconstructionType\": {\n", " \"@id\": \"nsg:somaReconstructionType\"\n", " },\n", " \"source\": {\n", " \"@id\": \"nsg:source\"\n", " },\n", " \"spatialCellName\": {\n", " \"@id\": \"nsg:spatialCellName\"\n", " },\n", " \"spatialIndex\": {\n", " \"@id\": \"nsg:spatialIndex\"\n", " },\n", " \"spatialReferenceSystem\": {\n", " \"@id\": \"nsg:spatialReferenceSystem\"\n", " },\n", " \"species\": {\n", " \"@id\": \"nsg:species\"\n", " },\n", " \"st_level\": {\n", " \"@id\": \"mba:st_level\"\n", " },\n", " \"stackAnatomicalDirection\": {\n", " \"@id\": \"nsg:stackAnatomicalDirection\"\n", " },\n", " \"stain\": {\n", " \"@id\": \"nsg:stain\"\n", " },\n", " \"startMembranePotential\": {\n", " \"@id\": \"nsg:startMembranePotential\"\n", " },\n", " \"startedAtTime\": {\n", " \"@id\": \"prov:startedAtTime\"\n", " },\n", " \"statistic\": {\n", " \"@id\": \"nsg:statistic\"\n", " },\n", " \"status\": {\n", " \"@id\": \"nsg:status\"\n", " },\n", " \"steps\": {\n", " \"@id\": \"nsg:steps\"\n", " },\n", " \"stimuliToExperimentMap\": {\n", " \"@id\": \"nsg:stimuliToExperimentMap\"\n", " },\n", " \"stimulus\": {\n", " \"@id\": \"nsg:stimulus\"\n", " },\n", " \"stimulusType\": {\n", " \"@id\": \"nsg:stimulusType\"\n", " },\n", " \"store\": {\n", " \"@id\": \"nsg:store\"\n", " },\n", " \"strain\": {\n", " \"@id\": \"nsg:strain\"\n", " },\n", " \"streetAddress\": {\n", " \"@id\": \"schema:streetAddress\"\n", " },\n", " \"subCellularMechanism\": {\n", " \"@id\": \"nsg:subCellularMechanism\"\n", " },\n", " \"subCellularModel\": {\n", " \"@id\": \"nsg:subCellularModel\"\n", " },\n", " \"subClassOf\": {\n", " \"@id\": \"rdfs:subClassOf\",\n", " \"@type\": \"@id\"\n", " },\n", " \"subject\": {\n", " \"@id\": \"nsg:subject\"\n", " },\n", " \"sweep\": {\n", " \"@id\": \"nsg:sweep\"\n", " },\n", " \"synapse\": {\n", " \"@id\": \"nsg:synapse\"\n", " },\n", " \"synapseRelease\": {\n", " \"@id\": \"nsg:synapseRelease\"\n", " },\n", " \"target\": {\n", " \"@id\": \"nsg:target\"\n", " },\n", " \"targetHoldingPotential\": {\n", " \"@id\": \"nsg:targetHoldingPotential\"\n", " },\n", " \"task\": {\n", " \"@id\": \"nsg:task\"\n", " },\n", " \"telephone\": {\n", " \"@id\": \"schema:telephone\"\n", " },\n", " \"temperature\": {\n", " \"@id\": \"nsg:temperature\"\n", " },\n", " \"templateVolume\": {\n", " \"@id\": \"nsg:templateVolume\"\n", " },\n", " \"thickness\": {\n", " \"@id\": \"nsg:thickness\"\n", " },\n", " \"thirdRow\": {\n", " \"@id\": \"nsg:thirdRow\"\n", " },\n", " \"timeStep\": {\n", " \"@id\": \"nsg:timeStep\"\n", " },\n", " \"title\": {\n", " \"@id\": \"schema:title\"\n", " },\n", " \"topConceptOf\": {\n", " \"@id\": \"skos:topConceptOf\"\n", " },\n", " \"transgenic\": {\n", " \"@id\": \"nsg:transgenic\"\n", " },\n", " \"treatment\": {\n", " \"@id\": \"nsg:treatment\"\n", " },\n", " \"type\": {\n", " \"@id\": \"rdf:type\"\n", " },\n", " \"uberon\": \"http://purl.obolibrary.org/obo/UBERON_\",\n", " \"unitCode\": {\n", " \"@id\": \"schema:unitCode\"\n", " },\n", " \"upperPoint\": {\n", " \"@id\": \"nsg:upperPoint\"\n", " },\n", " \"url\": {\n", " \"@id\": \"schema:url\",\n", " \"@type\": \"@id\"\n", " },\n", " \"used\": {\n", " \"@id\": \"prov:used\"\n", " },\n", " \"value\": {\n", " \"@id\": \"schema:value\"\n", " },\n", " \"valueX\": {\n", " \"@id\": \"nsg:valueX\"\n", " },\n", " \"valueY\": {\n", " \"@id\": \"nsg:valueY\"\n", " },\n", " \"valueZ\": {\n", " \"@id\": \"nsg:valueZ\"\n", " },\n", " \"vann\": \"http://purl.org/vocab/vann/\",\n", " \"variable\": {\n", " \"@id\": \"nsg:variable\"\n", " },\n", " \"vendor\": {\n", " \"@id\": \"nsg:vendor\"\n", " },\n", " \"version\": {\n", " \"@id\": \"schema:version\"\n", " },\n", " \"view2d\": {\n", " \"@id\": \"nsg:view2d\"\n", " },\n", " \"view3d\": {\n", " \"@id\": \"nsg:view3d\"\n", " },\n", " \"void\": \"http://rdfs.org/ns/void#\",\n", " \"volumeDimension\": {\n", " \"@id\": \"nsg:volumeDimension\"\n", " },\n", " \"voxelResolution\": {\n", " \"@id\": \"nsg:voxelResolution\"\n", " },\n", " \"voxelType\": {\n", " \"@id\": \"nsg:voxelType\"\n", " },\n", " \"warning\": {\n", " \"@id\": \"nsg:warning\"\n", " },\n", " \"wasAssociatedWith\": {\n", " \"@id\": \"prov:wasAssociatedWith\"\n", " },\n", " \"wasAttributedTo\": {\n", " \"@id\": \"prov:wasAttributedTo\"\n", " },\n", " \"wasDerivedFrom\": {\n", " \"@id\": \"prov:wasDerivedFrom\"\n", " },\n", " \"wasGeneratedBy\": {\n", " \"@id\": \"prov:wasGeneratedBy\"\n", " },\n", " \"wasInfluencedBy\": {\n", " \"@id\": \"prov:wasInfluencedBy\"\n", " },\n", " \"wasInformedBy\": {\n", " \"@id\": \"prov:wasInformedBy\"\n", " },\n", " \"wasRevisionOf\": {\n", " \"@id\": \"prov:wasRevisionOf\"\n", " },\n", " \"wasStartedBy\": {\n", " \"@id\": \"prov:wasStartedBy\"\n", " },\n", " \"washOut\": {\n", " \"@id\": \"nsg:washOut\"\n", " },\n", " \"weight\": {\n", " \"@id\": \"schema:weight\"\n", " },\n", " \"widthAnatomicalDirection\": {\n", " \"@id\": \"nsg:widthAnatomicalDirection\"\n", " },\n", " \"widthResolution\": {\n", " \"@id\": \"nsg:widthResolution\"\n", " },\n", " \"worldMatrix\": {\n", " \"@id\": \"nsg:worldMatrix\",\n", " \"@container\": \"@list\"\n", " },\n", " \"xml\": \"http://www.w3.org/XML/1998/namespace\",\n", " \"xsd\": \"http://www.w3.org/2001/XMLSchema#\"\n", " },\n", " \"@type\": \"Person\",\n", " \"name\": \"Jane Doe\"\n", "}\n" ] } ], "source": [ "pp(forge.as_jsonld(jane))" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"@type\": \"http://schema.org/Person\",\n", " \"http://schema.org/name\": \"Jane Doe\"\n", "}\n" ] } ], "source": [ "pp(forge.as_jsonld(jane, form=\"expanded\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### context from the Store\n", "\n", "It is possible to use a context that is available in the Store when configured." ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "jane = Resource(context=\"https://bbp.neuroshapes.org\", type=\"Person\", name=\"Jane Doe\")" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " context: https://bbp.neuroshapes.org\n", " type: Person\n", " name: Jane Doe\n", "}\n" ] } ], "source": [ "print(jane)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since this context is not locally resolvable the json-ld conversion will fail." ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " _resource_context\n", " ValueError: https://bbp.neuroshapes.org is not resolvable\n", "\n", "null\n" ] } ], "source": [ "pp(forge.as_jsonld(jane))" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " _resource_context\n", " ValueError: https://bbp.neuroshapes.org is not resolvable\n", "\n", "null\n" ] } ], "source": [ "pp(forge.as_jsonld(jane, form=\"expanded\"))" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " _register_one\n", " False\n", " ValueError: https://bbp.neuroshapes.org is not resolvable\n" ] } ], "source": [ "forge.register(jane)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " _resource_context\n", " ValueError: https://bbp.neuroshapes.org is not resolvable\n", "\n", "null\n" ] } ], "source": [ "pp(forge.as_jsonld(jane, store_metadata=True))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## JSON-LD to Resource" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "john = Resource(context=context, type=\"Person\", name=\"John Smith\")" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "data = {\n", " \"@context\": context,\n", " \"@type\": \"Person\",\n", " \"name\": \"John Smith\",\n", "}" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "resource = forge.from_jsonld(data)" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resource == john" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.7 (nexusforgelatest)", "language": "python", "name": "nexusforgelatest" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 4 }