ORA-942 When Querying Virtual Models The Property Path + (Doc ID 1914306.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Spatial and Graph - Version 11.2.0.3 and later
Information in this document applies to any platform.

Symptoms

Error in the Jena / Oracle package
When querying virtual models the property path + fails

Example:

This query fails:
  String queryCausesError = "SELECT * { ?s <http://purl.org/dc/elements/1.1/title>+ ?q } ";

While this one works:
  String dontCauseError = "SELECT * { ?s <http://purl.org/dc/elements/1.1/title> ?q } ";

Running Oracle 12.1.0.1.0
The Jena adapter has version 12.1.0.1.

The following code recreates the problem.
create user rdfuser identified by rdfuser;
grant connect, resource, dba to rdfuser;
conn rdfuser/rdfuser

--- SQL Code
--- Create two models
CREATE TABLE m1_data (id NUMBER, triple SDO_RDF_TRIPLE_S);
CREATE TABLE m2_data (id NUMBER, triple SDO_RDF_TRIPLE_S);
EXECUTE SEM_APIS.CREATE_SEM_MODEL('m1', 'm1_data', 'triple');
EXECUTE SEM_APIS.CREATE_SEM_MODEL('m2', 'm2_data', 'triple');
 
--- Insert triples into model 1
INSERT INTO m1_data VALUES (1,
  SDO_RDF_TRIPLE_S ('m1','<http://nature.example.com/Article1>',
  '<http://purl.org/dc/elements/1.1/title>','"All about XYZ"'));
  
INSERT INTO m1_data VALUES (2,
  SDO_RDF_TRIPLE_S ('m1','<http://nature.example.com/Article1>',
  '<http://purl.org/dc/elements/1.1/creator>',
  '"Jane Smith"'));
 
INSERT INTO m1_data VALUES (3,
  SDO_RDF_TRIPLE_S ('m1',
  '<http://nature.example.com/Article1>',
  '<http://purl.org/dc/terms/references>',
  '<http://nature.example.com/Article2>'));
 
 
--- Insert triples into model 2
INSERT INTO m2_data VALUES (1,
  SDO_RDF_TRIPLE_S ('m2','<http://physics.example.com/Article1>',
  '<http://purl.org/dc/elements/1.1/title>','"All about XYZ"'));
  
INSERT INTO m2_data VALUES (2,
  SDO_RDF_TRIPLE_S ('m2','<http://physics.example.com/Article1>',
  '<http://purl.org/dc/elements/1.1/creator>',
  '"Jane Smith"'));
 
INSERT INTO m2_data VALUES (3,
  SDO_RDF_TRIPLE_S ('m2',
  '<http://physics.example.com/Article1>',
  '<http://purl.org/dc/terms/references>',
  '<http://physics.example.com/Article2>'));
 
commit;
--- Creating a virtual model
EXECUTE sem_apis.create_virtual_model('vm1', sem_models('m1', 'm2'), null);
--- END SQL CODE
 
Java code. The connection is a connection to the same schema as above.
 
private static void OracleExample(Connection con) throws SQLException {
 
  String virtualModelName = "vm1";
  Oracle oracle = new Oracle((OracleConnection) con);
  ModelOracleSem model = ModelOracleSem.createOracleSemModel(oracle, virtualModelName);
 
  
  String queryCausesError = "SELECT * { ?s <http://purl.org/dc/elements/1.1/title>+ ?q } ";
  String dontCauseError = "SELECT * { ?s <http://purl.org/dc/elements/1.1/title> ?q } ";
 
  QueryExecution qexec =
  QueryExecutionFactory.create(QueryFactory.create( queryCausesError,
  Syntax.syntaxARQ), model);
  
  ResultSet rs = qexec.execSelect();
  
  while (rs.hasNext())
  rs.next();
  }
 
 
 
The stacktrace for running the queryCausesError query is as follows. I don’t understand much of what is going on, but surely "MDSYS"."RDFM_VM1" is not a valid view for virtual models? That would be correct for ordinary models though, so maybe there’s a glitch here?
 
DEBUG: oracle.spatial.rdf.client.jena.Oracle - Oracle constructor. username = RDFDATA
DEBUG: oracle.spatial.rdf.client.jena.Oracle - getConnection: set client identifier JenaAdapter
DEBUG: oracle.spatial.rdf.client.jena.Oracle - executeSQL: stmt = BEGIN DBMS_SESSION.set_identifier(?); END; bindVarValue = JenaAdapter
DEBUG: oracle.spatial.rdf.client.jena.Oracle - getConnection: built SQLarraydesc
DEBUG: oracle.spatial.rdf.client.jena.Oracle - executeQuery: in [0] seconds, qid 0, dop [1], ods 2 select OBJECT_NAME, DETERMINISTIC from user_procedures where object_name in ('ORACLE_ORARDF_S2SSVR', 'ORACLE_ORARDF_S2SUSR','ORACLE_ORARDF_SGC','ORACLE_ORARDF_S2SSVRNG','ORACLE_ORARDF_S2SGETSRC','ORACLE_ORARDF_S2SUSRNGL','ORACLE_ORARDF_S2SUSRNG','ORACLE_ORARDF_S2SLG')
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip S2SSVR
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip S2SGETSRC
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip S2SSVRNG
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip SGC
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip S2SUSR
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip S2SUSRNG
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip S2SUSRNGL
DEBUG: oracle.spatial.rdf.client.jena.OracleSqlGenerator - loadPackages: skip S2SLG
DEBUG: oracle.spatial.rdf.client.jena.Oracle - executeQuery: in [0] seconds, qid 0, dop [1], ods 2 select OBJECT_NAME, DETERMINISTIC, PARALLEL from user_procedures where (object_name, DETERMINISTIC, PARALLEL) in (('ORACLE_ORARDF_GETPLIST','NO', 'NO'), ('ORACLE_ORARDF_GRANT','NO','NO'), ('ORACLE_ORARDF_RES2VID','YES','YES'), ('ORACLE_ORARDF_VID2URI','YES','YES'),('ORACLE_ORARDF_VID2NAME_TYPE','NO','YES'))
DEBUG: oracle.spatial.rdf.client.jena.OracleUtils - constructor: skip grant
DEBUG: oracle.spatial.rdf.client.jena.OracleUtils - constructor: skip plist
DEBUG: oracle.spatial.rdf.client.jena.OracleUtils - constructor: skip res2id
DEBUG: oracle.spatial.rdf.client.jena.OracleUtils - constructor: skip vid2uri
DEBUG: oracle.spatial.rdf.client.jena.OracleUtils - constructor: skip vid2name_type
DEBUG: com.hp.hpl.jena.sparql.mgt.ARQMgt - Register MBean: com.hp.hpl.jena.sparql.system:type=Context
DEBUG: com.hp.hpl.jena.sparql.mgt.ARQMgt - Register MBean: com.hp.hpl.jena.sparql.system:type=Engine
DEBUG: com.hp.hpl.jena.sparql.mgt.ARQMgt - Register MBean: com.hp.hpl.jena.sparql.system:type=SystemInfo
DEBUG: com.hp.hpl.jena.sparql.mgt.ARQMgt - Register MBean: com.hp.hpl.jena.sparql.system:type=SystemInfo
DEBUG: com.hp.hpl.jena.sparql.mgt.ARQMgt - Register MBean: org.openjena.riot.system:type=SystemInfo
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: close result set
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: done closing statement in final block
DEBUG: oracle.spatial.rdf.client.jena.OracleModelBase - isValidModel: start
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: close result set
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: done closing statement in final block
DEBUG: oracle.spatial.rdf.client.jena.OracleModelBase - isValidModel: model 'VM1' is VALID
DEBUG: oracle.spatial.rdf.client.jena.OracleModelBase - retrieveModelId: starts
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: close result set
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: done closing statement in final block
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: close result set
DEBUG: oracle.spatial.rdf.client.jena.OracleSemIterator - quietlyCloseResultSetAndStmt: done closing statement in final block
DEBUG: oracle.spatial.rdf.client.jena.OraclePrefixMapping - ensureInitialized: start
DEBUG: oracle.spatial.rdf.client.jena.Oracle - executeQuery: in [0] seconds, qid 0, dop [1], ods 2 SELECT * from VM1_NS
DEBUG: oracle.spatial.rdf.client.jena.OraclePrefixMapping - Could not initialize namespace prefixes from database table (probably does not exist)VM1_NS
DEBUG: oracle.spatial.rdf.client.jena.OraclePrefixMapping - ensureInitialized: done

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms