Adding a new ML-related task and method¶
Adding semantic components to a bottom-level KG schema¶
When extending an existing bottom-level KG schema, naming conventions should be followed and can be inferred by the below example code snippets. The placeholders used are specified below each snippet. For the sake of example, the namespace prefix of the ML KG schema (ml
) is used in the following code snippets.
To add the required semantic components, the following steps should be followed:
- Open the
.ttl
file of the desired bottom-level KG schema, found in the relevant repo. -
Add a new sub-class of ds:AtomicTask.
In the above example,ml:NewTask rdf:type owl:Class ; rdfs:subClassOf ds:AtomicTask .
NewTask
should be replaced with the desired task name. 3. Add a new sub-class of ds:AtomicMethod.In the above example,ml:NewMethod rdf:type owl:Class ; rdfs:subClassOf ds:AtomicMethod .
NewMethod
should be replaced with the desired method name. 4. Add a new sub-property of ds:hasMethod.In the above example,ml:hasNewMethod rdf:type owl:ObjectProperty ; rdfs:subPropertyOf ds:hasMethod ; rdfs:domain ml:NewTask ; rdfs:range ml:NewMethod .
NewMethod
andNewTask
should be replaced with the desired method and task names respectively. 5. Add and link the desired input and output entities for the new task.In the above example, the occurences of numberml:DataIn1NewTask rdf:type owl:Class ; rdfs:subClassOf ds:DataEntity . ... ml:DataOut1NewTask rdf:type owl:Class ; rdfs:subClassOf ds:DataEntity . ... ml:hasNewTaskInput rdf:type owl:ObjectProperty ; rdfs:subPropertyOf ds:hasInput ; rdfs:domain ml:NewTask ; rdfs:range ml:DataIn1NewTask, ... . ml:hasNewTaskOutput rdf:type owl:ObjectProperty ; rdfs:subPropertyOf ds:hasOutput ; rdfs:domain ml:NewTask ; rdfs:range ml:DataOut1NewTask, ... .
1
in the input and output entity names should be replaced with the desired input and output names respectively. Also,NewTask
should be replaced with the desired task name. 6. Add the desired data properties for the new method.In the above example,ml:hasNewProperty1 rdf:type owl:DatatypeProperty ; rdfs:domain ml:NewMethod ; rdfs:range xsd:float . ml:hasNewProperty2 rdf:type owl:DatatypeProperty ; rdfs:domain ml:NewMethod ; rdfs:range xsd:string .
NewProperty1
andNewProperty2
should be replaced with the desired property names.
Adding a relevant Python class¶
To achieve this, a sub-class of exe_kg_lib.classes.task.Task
should be added to an existing module of exe_kg_lib.classes.tasks
package according to the conventions mentioned in the package's documentation.
Last update: January 7, 2023