10 Replies Latest reply on Nov 17, 2010 7:08 PM by alwu-Oracle

    Jena Adapter for 11g2: Wrong binding skos with preflabel and literal form

    725543
      Dear all,

      We did installed the latest version of the Jena Oracle Adapter under http://www.oracle.com/technology/software/tech/semantic_technologies/index.html.

      We are using the Jena API to execute our SPARQL queries. Since we replaced the old Jena Adaptor with the latest one we get some strange results.
      The query results are bound to the wrong parameters for queries with the following pattern:

      SELECT ?c ?pl ?literal
      WHERE { <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c.
      OPTIONAL{ ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl. ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal. FILTER(lang(?literal) = 'en'). }
      }

      When executing queries with this pattern:
      •     The concept uri is assigned/bounded to parameter ‘pl’ instead of parameter ‘c’
      •     The prefLabel uri is assigned/bounded to parameter ‘c’ instead of parameter ‘pl’

      When we use the old Jena adaptor the boundings are correct.

      In the logging I can see the following query results:
      <domain 0:http://namespace/2180 1:http://namespace/209106 2:"party organisation"@en>
      <domain 0:http://namespace/4436 1:http://namespace/209102 2:"political tendency"@en>
      <domain 0:http://namespace/2258 1:http://namespace/209116 2:"political parties"@en>


      With the new adapter, these results are correct but the bindings done afterwards are incorrect:
      http://namespace/2180 is bound to parameter ‘pl’ but should be bound to ‘c’ while http://namespace/209106 is bound to parameter ‘c’ but should be bound to parameter ‘pl’
      http://namespace/4436 is bound to parameter ‘pl’ but should be bound to ‘c’ while http://namespace/209102 is bound to parameter ‘c’ but should be bound to parameter ‘pl’
      http://namespace/2258 is bound to parameter ‘pl’ but should be bound to ‘c’ while http://namespace/209116 is bound to parameter ‘c’ but should be bound to parameter ‘pl’

      Where it goes wrong in java code:
      public static List<Map<String, RDFNode>> convertToListOfMaps(ResultSet resultSet) {
      List<Map<String, RDFNode>> result = new ArrayList<Map<String, RDFNode>>();
      while (resultSet.hasNext()) {
      // when executing following statement “<domain 0:http://namespace/2180 1:http://namespace/209106 2:"party organisation"@en>” is logged which looks ok
      // but in the QuerySolution object http://namespace/2180 is mapped to parameter ‘pl’ and http://namespace/209106 is mapped to parameter ‘c’
      QuerySolution querySolution = (QuerySolution) resultSet.next();
      result.add(convertRowToMap(querySolution));
      }
      return result;
      }

      This is the logging:
      9:42:31.272 [http-8080-1] DEBUG o.spatial.rdf.client.jena.OraclePool - OraclePool: getting a connection from the datasource
      09:42:31.678 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - Oracle constructor. username = EURES
      09:42:31.709 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - Oracle constructor: bHasNumTripleID false
      09:42:31.709 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - executeQuery: in [0] seconds, dop [1] select OBJECT_NAME, DETERMINISTIC from user_procedures where (object_name, DETERMINISTIC) in (('ORACLE_ORARDF_GETPLIST','NO'), ('ORACLE_ORARDF_GRANT','NO'), ('ORACLE_ORARDF_RES2VID','YES'), ('ORACLE_ORARDF_VID2URI','YES'))
      09:42:31.740 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleUtils - constructor: skip grant
      09:42:31.740 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleUtils - constructor: skip plist
      09:42:31.740 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleUtils - constructor: skip res2id
      09:42:31.740 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleUtils - constructor: skip vid2uri
      09:42:31.740 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - GraphOracleSem: constructor
      09:42:31.756 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - executeQuery: in [0] seconds, dop [1]select 1 from v$version where banner like '%11.1.0.6%'
      09:42:31.772 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - GraphOracleSem: not v11.1.0.6
      09:42:31.772 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - GraphOracleSem: ruleIndexName namespace_INF_RI
      09:42:31.772 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - GraphOracleSem: username EURES
      09:42:31.912 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - isModel: start
      09:42:31.912 [http-8080-1] DEBUG o.s.r.c.jena.OraclePrefixMapping - ensureInitialized: start
      09:42:31.912 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - executeQuery: in [0] seconds, dop [1]SELECT * from namespace_INF_NS
      09:42:32.131 [http-8080-1] DEBUG o.s.r.c.jena.OraclePrefixMapping - Could not initialize namespace prefixes from database table (probably does not exist)namespace_INF_NS
      09:42:32.131 [http-8080-1] DEBUG o.s.r.c.jena.OraclePrefixMapping - ensureInitialized: done
      09:42:32.131 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - retrieveModelId: starts
      09:42:32.131 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - GraphOracleSem: constructor. running count 2
      09:42:32.147 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - executeOp: constructor
      09:42:32.147 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - parseOrgQuery: pm = pm:{}
      09:42:32.147 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - setUseOrdered : false
      09:42:32.147 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - setGeneralHint: hint = {}
      09:42:32.147 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - parseOrgQuery: pass on skip clob to the context false
      09:42:32.147 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - executeOp: Op
      09:42:32.147 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - executeOp: First Op: (project (?c ?pl ?literal)
      (conditional
      (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))
      (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))))

      09:42:32.147 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: count = 1, bgp = (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))

      09:42:32.147 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: count = 2, bgp = (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      )

      09:42:32.147 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: opFilter (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))

      09:42:32.163 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: opProject (project (?c ?pl ?literal)
      (conditional
      (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))
      (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))))

      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - visit1
      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - visit2
      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - visit0
      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - visit1
      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - executeOp: do not translate query to pure sql! plain sql done false
      09:42:32.163 [http-8080-1] DEBUG o.s.r.c.jena.OracleExecutionDispatch - exec: op
      09:42:32.163 [http-8080-1] DEBUG o.s.r.c.jena.OracleExecutionDispatch - push: starts
      09:42:32.163 [http-8080-1] DEBUG o.s.r.c.jena.OracleExecutionDispatch - exec: OpProject = (project (?c ?pl ?literal)
      (conditional
      (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))
      (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))))

      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - execute: OpProject
      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - buildQueryIterUsingSemMatchVisitor: input class com.hp.hpl.jena.sparql.engine.iterator.QueryIterRoot
      09:42:32.163 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - buildQueryIter: now trying visit OP for translation com.hp.hpl.jena.sparql.algebra.op.OpProject
      09:42:32.163 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: count = 1, bgp = (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))

      09:42:32.163 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: count = 2, bgp = (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      )

      09:42:32.163 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: opFilter (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))

      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.j.OracleNestedOpCheckVisitor - visit: opProject (project (?c ?pl ?literal)
      (conditional
      (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))
      (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))))

      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: constructor. new visit...............................
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: opProject (project (?c ?pl ?literal)
      (conditional
      (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))
      (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))))

      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: opProject var c
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: opProject var pl
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: opProject var literal
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: opCond
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - semMatchVisit: opConditional (conditional
      (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))
      (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      )))

      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: opBGP
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - semMatchVisit: bgp = (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))

      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - semMatchVisit: opFilter (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))

      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: opBGP
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - semMatchVisit: bgp = (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      )

      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - semMatchVisit: OpFilter: el = [( lang(?literal) = "en" )]
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - semMatchVisit: OpFilter: expr type is com.hp.hpl.jena.sparql.expr.E_Equals
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OpToSemMatchVisitor - visit: szReplacedExpr ( lang(?literal) = "en" )
      09:42:32.178 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - buildQueryIter: no distinct
      09:42:32.178 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - buildQueryIter: iterator com.hp.hpl.jena.sparql.engine.iterator.QueryIterRoot
      09:42:32.178 [http-8080-1] DEBUG o.s.r.c.jena.OracleExecutionDispatch - push: starts
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - nextStage: outerBinding is [Root] , size = 0
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - nextStage: op (after substitute if needed) is (project (?c ?pl ?literal)
      (conditional
      (bgp (triple <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c))
      (filter (= (lang ?literal) "en")
      (bgp
      (triple ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl)
      (triple ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal)
      ))))

      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - nextStage: the old op visitor is usable
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: start
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: size 3
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: - get var name c
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: var is used in triple
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: getUseDistinct false, getUseHint false, getSkipClob false, param skip clob false
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: - get var name pl
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: var is used in triple
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: getUseDistinct false, getUseHint false, getSkipClob false, param skip clob false
      09:42:32.178 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: - get var name literal
      09:42:32.194 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: var is used in triple
      09:42:32.194 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: five columns
      09:42:32.194 [http-8080-1] DEBUG o.s.r.client.jena.OracleRepeatApply - buildSemMatchQueryPrefix: getUseDistinct false, getUseHint false, getSkipClob false, param skip clob false
      09:42:32.194 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - setGuide: starts
      09:42:32.194 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - setGuide: size =3
      09:42:32.194 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - buildExtraHint:
      09:42:32.194 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - executeQuery: in [0] seconds, dop [1]select inner.* from ( select c$RDFVTYP,decode(c$RDFVTYP, 'BLN', ('_:'||substr(c,instr(c,'m',4)+1)), c) c , pl$RDFVTYP,decode(pl$RDFVTYP, 'BLN', ('_:'||substr(pl,instr(pl,'m',4)+1)), pl) pl , literal$RDFVTYP,literal$RDFLTYP,literal$RDFLANG, literal$RDFCLOB,decode(literal$RDFVTYP, 'BLN', ('_:'||substr(literal,instr(literal,'m',4)+1)), literal) literal from table(sem_match(' { <http://namespace/100164> <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?c .  OPTIONAL { ?c <http://www.w3.org/2008/05/skos-xl#prefLabel> ?pl . ?pl <http://www.w3.org/2008/05/skos-xl#literalForm> ?literal .  FILTER (( lang(?literal) = "en" ) )  } } ', sdo_rdf_models('namespace_INF') , null , null , null , NULL,' ' ) ) ) inner
      09:42:34.523 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - OracleSemIterator: constructor
      09:42:34.523 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - OracleSemIterator: numberOfColumns 9
      09:42:34.523 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - setQueryFetchSize: size 1000
      09:42:34.523 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - setGuide: size of list 3
      09:42:34.523 [http-8080-1] DEBUG o.s.rdf.client.jena.OracleOpExecutor - convertToVarArray: start
      09:42:34.523 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - <domain 0:http://namespace/2180 1:http://namespace/209106 2:"party organisation"@en>
      09:42:34.523 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - <domain 0:http://namespace/4436 1:http://namespace/209102 2:"political tendency"@en>
      09:42:34.539 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - <domain 0:http://namespace/2258 1:http://namespace/209116 2:"political parties"@en>
      09:42:34.539 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - hasNext: rs is null
      09:42:34.539 [http-8080-1] DEBUG o.s.r.client.jena.OracleSemIterator - close: start
      09:42:34.539 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - closeWithoutCommit: start
      09:42:34.539 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - closeWithoutCommit: flush adds
      09:42:34.539 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - invalidateCursor: exec refresh
      09:42:34.632 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - closeWithoutCommit: flush deletes
      09:42:34.632 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - closeWithoutCommit: close grants
      09:42:34.632 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - closeWithoutCommit: close refreStmt
      09:42:34.632 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - closeWithoutCommit: close plistStmt
      09:42:34.632 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - closeWithoutCommit: done
      09:42:34.632 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - close: commit transaction
      09:42:34.742 [http-8080-1] DEBUG o.s.rdf.client.jena.GraphOracleSem - close: done
      09:42:34.742 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - dispose: start
      09:42:34.742 [http-8080-1] DEBUG o.spatial.rdf.client.jena.Oracle - dispose: rollback and then close connection


      Can-you help us.

      Thank-you