protected AbstractIterHashJoin( JoinKey joinKey, QueryIterator probeIter, QueryIterator streamIter, ExecutionContext execCxt) { super(probeIter, streamIter, execCxt); if (joinKey == null) { QueryIterPeek pProbe = QueryIterPeek.create(probeIter, execCxt); QueryIterPeek pStream = QueryIterPeek.create(streamIter, execCxt); Binding bLeft = pProbe.peek(); Binding bRight = pStream.peek(); List<Var> varsLeft = Iter.toList(bLeft.vars()); List<Var> varsRight = Iter.toList(bRight.vars()); joinKey = JoinKey.createVarKey(varsLeft, varsRight); probeIter = pProbe; streamIter = pStream; } this.joinKey = joinKey; this.iterStream = streamIter; this.hashTable = new HashProbeTable(joinKey); this.iterCurrent = null; buildHashTable(probeIter); }
private ResultSet ConvertResults(org.apache.jena.query.ResultSet results) { ResultSet rs = new ResultSet(); while (results.hasNext()) { Binding b = results.nextBinding(); Result result = new Result(); Iterator<Var> v = b.vars(); while (v.hasNext()) { Var currentV = v.next(); Node val = b.get(currentV); if (currentV.toString().contains("_info_")) { String[] parts = val.getLiteral().getLexicalForm().toString().split("="); if (parts.length > 1) { for (int i = 0; i < parts.length; i++) { String[] subParts = parts[i].split("\\."); if (subParts.length > 1) { if (!Character.isDigit(subParts[1].charAt(0))) result.addTable(subParts[0]); } } } result.addWhere(val.getLiteral().getLexicalForm()); } else { if (val.isLiteral()) { String value = val.getLiteral().getLexicalForm(); String datatype = val.getLiteralDatatypeURI(); if (datatype.equals(S2SML.LITERAL_MAP_IRI)) { String[] parts = value.split("\\."); if (parts.length > 1) { if (!Character.isDigit(parts[1].charAt(0))) result.addTable(parts[0]); } } } // System.out.println(currentV.toString().replace("?", "") +" "+val); result.addVarMapping( currentV.toString().replace("?", ""), FormatUtil.processNode(val, dialect)); } } rs.add(result); } return rs; }