コード例 #1
0
 private RDFNode checkUri(Node node, Model map) {
   if (node.isURI()) {
     String uri = node.getURI();
     if (uri.contains("{")) {
       List<String> colList = FormatUtil.extractCols(uri);
       uri = uri.replaceAll("\\{.*?}", "\\{\\}");
       Set<String> existing = joinData.get(uri);
       if (existing == null) {
         existing = new HashSet<String>();
       }
       existing.addAll(colList);
       joinData.put(uri, existing);
     }
   }
   return map.asRDFNode(node);
 }
コード例 #2
0
 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;
 }