1.20 Applying Oracle Machine Learning Algorithms to RDF Data
You can apply Oracle Machine Learning algorithms to RDF data.
Oracle Data Mining requires data to be in a single table or view, and each row represents a single case. Therefore, RDF data needs to be defined as a view mimicking this structure. To accomplish that, do the following:
-
Find the number of predicates of interest: P1, P2, P3, … , Pn.
-
Create a view with columns (S, C1, C2, C3, …. , Cn), where columns correspond to the subject, P1, P2, …, and Pn.
Depending upon requirements, such as a text column that needs to be defined in a table, you can also create a table.
Convert numerical values using the TO_NUMBER or CAST function.
For example:
CREATE VIEW ML_TAB (S, C1, C2, C3, … , Cn) AS SELECT subj, O1, to_number(O2), CAST (O3 AS INTEGER), ... , On FROM TABLE(SEM_MATCH( 'SELECT ?subj ?O1 ?O2 ?O3 … ?On WHERE { OPTIONAL { ?subj P1 ?O1 } OPTIONAL { ?subj P2 ?O2 } OPTIONAL { ?subj P3 ?O3 } …. OPTIONAL { ?subj Pn ?On } }' , SEM_MODELS('M1') ,null, null, null, null));
Now the view looks something like this:
SQL> SELECT * FROM ML_TAB; S C1 C2 C3 ---------- -------------------- -------------------- -------------------- S1 O11 O21 O31 S2 O21 O32 S3 O23
After you have this structure defined, you can directly apply Oracle Machine Learning algorithms on this view. Oracle Data Mining deals with three types of attributes:
- numerical attribute
- categorical attribute
- unstructured text
You must separate the data into three groups based on the data types of the three types of attributes.
Parent topic: RDF Graph Overview