Item:OSW659a81662ff44af1b2b6febeee7c3a25: Difference between revisions

Update package: OSW Docs - Core
(Install package: OSW Docs - Core)
 
(Update package: OSW Docs - Core)
Line 1: Line 1:
==Overview==
==Overview==
{{Template:Editor/DrawIO|file_name=diagram-json|page_name=Item:OSWab674d663a5b472f838d8e1eb43e6784|uuid=95a74be1-e22d-4b6e-9e4f-836127d5915a|full_width=0}}
osw-python aims to simplify the application of linked data and linked data schemas stored in knowledge graphs in python{{Template:Editor/DrawIO|file_name=diagram-json|page_name=Item:OSWab674d663a5b472f838d8e1eb43e6784|uuid=95a74be1-e22d-4b6e-9e4f-836127d5915a|full_width=0}}
 
 
In a nutshell, it only requires a few lines to
 
* build required data classes from the knowledge graph
* load instances explicit or on demand from the knowledge graph
* call function through bound controller classes
* store created instances in the knowledge graph
<syntaxhighlight lang="python" line="1">
# illustrative example
 
osw.load("<schema iri or query>")
 
foo : model.Foo = osw.get("<instance iri or query>")
 
print(foo.bar.id)
 
baz = foo.cast(controller.Foo).calc()
 
osw.put(baz)
</syntaxhighlight>{{Template:Editor/DrawIO
| file_name = OSW Python Package core concepts
| page_name = Item:OSW659a81662ff44af1b2b6febeee7c3a25
| uuid = 71701a09-2d74-4393-ab8d-591efbab3856
| full_width = 0
}}


==JSON-Schema and Data Classes==
==JSON-Schema and Data Classes==
jsondata
Line 1: Line 1:
{
{
    "required_predecessor": [
"required_predecessor": [
        "Item:OSW7113f5cf921a4c82ad1872afeff9d01d",
"Item:OSW7113f5cf921a4c82ad1872afeff9d01d",
        "Item:OSWf4a9514baed04859a4c6c374a7312f10"
"Item:OSWf4a9514baed04859a4c6c374a7312f10"
    ],
],
    "type": [
"type": [
        "Category:OSW494f660e6a714a1a9681c517bbb975da"
"Category:OSW494f660e6a714a1a9681c517bbb975da"
    ],
],
    "uuid": "659a8166-2ff4-4af1-b2b6-febeee7c3a25",
"uuid": "659a8166-2ff4-4af1-b2b6-febeee7c3a25",
    "name": "OswPythonPackage",
"name": "OswPythonPackage",
    "label": [
"label": [
        {
{
            "text": "OSW Python Package",
"text": "OSW Python Package",
            "lang": "en"
"lang": "en"
        }
}
    ],
],
    "description": [
"description": [
        {
{
            "text": "Demonstrates Python code generation from Wiki Categories",
"text": "Demonstrates Python code generation from Wiki Categories",
            "lang": "en"
"lang": "en"
        }
}
    ]
]
}
}