This content has been marked as final.
Show 3 replies
-
1. Re: Removing a single statement without using jena or sesame
alwu-Oracle Aug 8, 2015 1:31 AM (in response to jerven)Hi,
Here is an example PL/SQL code snippet (declared in a Java string) that might be useful. You will need to pass in model name (and graph name), subject, predicate, and object. Note that it assumes that you have an index on the application table. Given that you want to remove a single triple, it is important to have an index on the application table. There is an API graphOracleSem.rebuildApplicationTableIndex in Jena Adapter that you can call to create it (if absent)
String szStmt = "DECLARE " + " tid varchar2(1000); " + " val varchar2(1000); " + "BEGIN " + " tid := sdo_rdf.GET_TRIPLE_ID( ?, ?, ?, ? ); " + " val := tid; " + " " + " delete /*+ index(app " + indexName + ") */ " + " from " + tableName + " app " + " where " + " bitand(app." + colName + ".rdf_m_id,79228162514264337593543950335-4294967295) / 4294967296 = " + " (CASE when instr(val,'g') = 0 " + " then 0 " + " else sys_op_rawtonum(substr(val,instr(val,'g')+1, instr(val,'_') - instr(val,'g') - 1)) " + " END) and " + " (app." + colName + ".rdf_s_id) = sys_op_rawtonum(substr(val,instr(val,'_')+1, instr(val,'_',instr(val,'_')+1) - instr(val,'_') -1) ) and " + " (app." + colName + ".rdf_p_id) = sys_op_rawtonum(substr(val,instr(val,'_',1,2)+1, instr(val,'_',1,3) - instr(val,'_',1,2)-1) ) and " + " (app." + colName + ".rdf_c_id) = sys_op_rawtonum(substr(val,instr(val,'_',1,3)+1, length(val) - instr(val,'_',1,3)) ); " + " ? := SQL%ROWCOUNT; " + "END; ";
Hope it helps,
Zhe Wu
-
2. Re: Removing a single statement without using jena or sesame
jerven Aug 12, 2015 8:34 AM (in response to alwu-Oracle)I was worried this was going to be the answer... Its fine for now but a function in the sem_apis would be appreciated in the future.
-
3. Re: Removing a single statement without using jena or sesame
alwu-Oracle Aug 12, 2015 5:33 PM (in response to jerven)Hi,
That is a good suggestion. I will log an enhancement request.
Thanks,
Zhe Wu