Pages: [1]
  Print  
Author Topic: Issue with Extract Information operator JsonPath query type  (Read 13 times)
mrmikev
Newbie
*
Posts: 3


« on: April 20, 2015, 07:16:05 PM »

I'm currently trying a basic example of the Extract Information operator using the JsonPath Query type.  No matter how I structure the jsonpath query expression(s), I get either the entire document or an error:
  • $.store.book yields the entire document, not just the books.
  • $.store.book[0] yields: Process Failed. net.minidev.json.JSONObject cannot be cast to net.minidev.json.JSONArray.

Both of the above jsonpath queries and sample json document work well in jsonpath expression tester.

Here's the process:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.3.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="6.3.000" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="text:create_document" compatibility="6.1.000" expanded="true" height="60" name="Create Document" width="90" x="45" y="30">
        <parameter key="text" value="{ &quot;store&quot;: {&#10;    &quot;book&quot;: [ &#10;      { &quot;category&quot;: &quot;reference&quot;,&#10;        &quot;author&quot;: &quot;Nigel Rees&quot;,&#10;        &quot;title&quot;: &quot;Sayings of the Century&quot;,&#10;        &quot;price&quot;: 8.95&#10;      },&#10;      { &quot;category&quot;: &quot;fiction&quot;,&#10;        &quot;author&quot;: &quot;Evelyn Waugh&quot;,&#10;        &quot;title&quot;: &quot;Sword of Honour&quot;,&#10;        &quot;price&quot;: 12.99&#10;      },&#10;      { &quot;category&quot;: &quot;fiction&quot;,&#10;        &quot;author&quot;: &quot;Herman Melville&quot;,&#10;        &quot;title&quot;: &quot;Moby Dick&quot;,&#10;        &quot;isbn&quot;: &quot;0-553-21311-3&quot;,&#10;        &quot;price&quot;: 8.99&#10;      },&#10;      { &quot;category&quot;: &quot;fiction&quot;,&#10;        &quot;author&quot;: &quot;J. R. R. Tolkien&quot;,&#10;        &quot;title&quot;: &quot;The Lord of the Rings&quot;,&#10;        &quot;isbn&quot;: &quot;0-395-19395-8&quot;,&#10;        &quot;price&quot;: 22.99&#10;      }&#10;    ],&#10;    &quot;bicycle&quot;: {&#10;      &quot;color&quot;: &quot;red&quot;,&#10;      &quot;price&quot;: 19.95&#10;    }&#10;  }&#10;}"/>
      </operator>
      <operator activated="true" class="text:extract_information" compatibility="6.1.000" expanded="true" height="60" name="Extract Information" width="90" x="447" y="30">
        <parameter key="query_type" value="JsonPath"/>
        <list key="string_machting_queries"/>
        <list key="regular_expression_queries"/>
        <list key="regular_region_queries"/>
        <list key="xpath_queries"/>
        <list key="namespaces"/>
        <list key="index_queries"/>
        <list key="jsonpath_queries">
          <parameter key="booksOnly" value="$.store.book"/>
        </list>
      </operator>
      <connect from_op="Create Document" from_port="output" to_op="Extract Information" to_port="document"/>
      <connect from_op="Extract Information" from_port="document" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>

Any direction on how the jsonpath query expressions should look for the RapidMiner is appreciated.

RapidMiner Studio 6.3.0000 (rev: 251598) - Professional Plus
Windows 8.1
« Last Edit: April 20, 2015, 09:23:24 PM by mrmikev » Logged
Pages: [1]
  Print  
 
Jump to: