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.
forge = KnowledgeGraphForge("../../configurations/forge.yml")
from kgforge.core import Resource
jane = Resource(type="Person", name="Jane Doe")
association = Resource(type="Association", agent=jane)
forge.register(association)
association._synchronized
association._last_action
association._store_metadata
john = Resource(type="Person", name="John Smith")
association.agent = john
association._synchronized
persons = [jane, john]
forge.register(jane)
forge.register(persons)
jane._synchronized
john._synchronized
Note: DemoStore doesn't implement file operations yet. Please use another store for this section.
distribution = forge.attach("../../data/persons.csv")
jane = Resource(type="Person", name="Jane Doe", distribution=distribution)
forge.register(jane)
distribution = forge.attach("../../data/my_data.xwz", content_type="application/xwz")
john = Resource(type="Person", name="John Smith", distribution=distribution)
forge.register(john)
jane = Resource(type="Person", name="Jane Doe")
association = Resource(type="Association", agent=jane)
forge.register(association)
try:
# DemoStore
print(association._store_metadata.version)
except:
# BlueBrainNexus
print(association._store_metadata._rev)
john = Resource(type="Person", name="John Smith")
association.agent = john
forge.update(association)
association._synchronized
try:
# DemoStore
print(association._store_metadata.version)
except:
# BlueBrainNexus
print(association._store_metadata._rev)
jane = Resource(type="Person", name="Jane Doe")
forge.register(jane)
try:
# DemoStore
print(jane._store_metadata.deprecated)
except:
# BlueBrainNexus
print(jane._store_metadata._deprecated)
forge.deprecate(jane)
try:
# DemoStore
print(jane._store_metadata.deprecated)
except:
# BlueBrainNexus
print(jane._store_metadata._deprecated)