#!/usr/bin/env python # coding: utf-8 # # Resources # # A [Resource](https://nexus-forge.readthedocs.io/en/latest/interaction.html#resource) is an identifiable data object with a set of properties. This notebook shows how to create a resource from keyword arguments, JSON dictionary, or pandas dataframe. # In[ ]: from kgforge.core import KnowledgeGraphForge # 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). # In[ ]: forge = KnowledgeGraphForge("../../configurations/forge.yml") # ## Imports # In[ ]: from kgforge.core import Resource # ## Creation # # It is possible to assign arbitrary properties to create a resource, and link them to other resources via properties. # In[ ]: jane = Resource(type="Person", name="Jane Doe") # In[ ]: association = Resource(type="Association", agent=jane) # ## Properties # ### modification # In[ ]: jane.email = "jane.doe@epfl.ch" # ### access # In[ ]: jane.email # In[ ]: association.agent.email # ## Display # In[ ]: print(jane) # In[ ]: print(association)