[FOLDERS]
\templates
is generated by case_utils ontology and sub-ontologies alone.
[INSTALL & SETUP]:
pip install -r requirements.txt
[USAGE/RUN]
- generate.py [-o: default: uses case_util's case ontology and sub ontologies,-s:Optional[],--output:default="templates", -a:default = False, -t:default = False]
- "-o", ontology directory or string of directories delimited by "," , required.
- "-s", specify a class by name that has at least one property, Optional. The name must be conventional to the original vocabulary eg. observable, tool, action, etc.
- "--output", specify a specific directory to put the stubs, Optional, default = "templates"
- "-a" True/False whether to allow case_utils to load in uco or not. The generated object will differ depending on what is within the graph. default = False.
- "-t" True/False whether to generate a short stub (True) or full stub (False). default = False
[EXAMPLES]
generate all case and uco objects from case_utils alone:
python generate.py
generate a specific case object
python generate.py -s investigation:Authorization
[OUTPUT]: json-ld file with additional @version key for what version of case and case_utils generated the file.
[NOTE]
-
we load the ontology ttl files directly, implying the graph is blank. The uco ontology can be loaded via case_utils load_subclass_hierarchy. Because it loads the uco ontology as well, some of the uco ontology will be generated too due to it being present in the triple preprocessing.
-
in
generate.py
, there is another 'obs_prefix' commented out which uses the direct uco ontology prefixes instead of being padded with "uco-", use it you want a stand-alone uco object with its original vocabulary prefixes: eg. case uses "uco-core" while the uco ontology uses "core". -
The code queries the graph for all triples with sh:property and sh:path to build the entire list, therefore classes that do not have direct properties (properties not from superclass inheritence) will not be geneated using the
--short True
flag. By default, the flag is set to--short False
which additionally tries to pull triples that declare a subclass from a superclass, thereby adding superclass properties to the stub.