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")
john = Resource(type="Person", name="John Smith")
persons = [jane, john]
resources = forge.reshape(persons, keep=["name"])
type(resources)
type(resources[0])
print(jane)
print(resources[0])
jane = Resource(type="Person", name="Jane Doe")
association = Resource(type="Association", agent=jane)
resource = forge.reshape(association, keep=["type", "agent.name"])
print(association)
print(resource)
jane = Resource(type="Person", name="Jane Doe")
forge.register(jane)
resource = forge.reshape(jane, keep=["id", "type"], versioned=True)
forge.as_json(jane)
print(resource)
john = Resource(type="Person", name="John Smith")
resource = forge.reshape(john, keep=["id", "type"], versioned=True)
resource is None