public class JSONInstances
extends java.lang.Object
MISSING_VALUE| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ATTRIBUTES
the attributes object.
|
static java.lang.String |
CLASS
the class attribute indicator.
|
static java.lang.String |
DATA
the data section.
|
static java.lang.String |
DATEFORMAT
the dateformat attribute.
|
static java.lang.String |
HEADER
the header section.
|
static java.lang.String |
LABELS
the labels attribute.
|
static java.lang.String |
MISSING_VALUE
the missing value indicator.
|
static java.lang.String |
NAME
the name attribute.
|
static java.lang.String |
RELATION
the relation name.
|
static java.lang.String |
SPARSE
the sparse attribute.
|
static java.lang.String |
SPARSE_SEPARATOR
the separator for index/value in case of sparse instances.
|
static java.lang.String |
TYPE
the type attribute.
|
static java.lang.String |
VALUES
the values attribute.
|
static java.lang.String |
WEIGHT
the weight attribute.
|
| Constructor and Description |
|---|
JSONInstances() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args)
For testing only.
|
protected static Attribute |
toAttribute(JSONNode att,
boolean[] classAtt)
Turns the JSON object into an Attribute, if possible.
|
static Instances |
toHeader(JSONNode json)
Turns a JSON object, if possible, into an Instances object (only header).
|
protected static Instance |
toInstance(JSONNode inst,
Instances data)
Turns the JSON Object into an Instance, if possible.
|
static Instances |
toInstances(JSONNode json)
Turns a JSON object, if possible, into an Instances object.
|
protected static Instances |
toInstances(JSONNode json,
boolean onlyHeader)
Turns a JSON object, if possible, into an Instances object.
|
protected static JSONNode |
toJSON(Instance inst)
Turns the Instance into a JSON object.
|
static JSONNode |
toJSON(Instances inst)
Turns the Instances object into a JSON object.
|
protected static JSONNode |
toJSON(Instances inst,
Attribute att)
Turns the Attribute into a JSON object.
|
public static final java.lang.String HEADER
public static final java.lang.String DATA
public static final java.lang.String RELATION
public static final java.lang.String ATTRIBUTES
public static final java.lang.String NAME
public static final java.lang.String TYPE
public static final java.lang.String CLASS
public static final java.lang.String LABELS
public static final java.lang.String WEIGHT
public static final java.lang.String DATEFORMAT
public static final java.lang.String SPARSE
public static final java.lang.String VALUES
public static final java.lang.String SPARSE_SEPARATOR
public static final java.lang.String MISSING_VALUE
protected static Attribute toAttribute(JSONNode att, boolean[] classAtt)
att - the JSON object to turn into an AttributeclassAtt - for storing whether the attribute is the class attributeprotected static Instance toInstance(JSONNode inst, Instances data)
inst - the JSON object to turn into an Instancedata - the data so far (only used for header information)protected static Instances toInstances(JSONNode json, boolean onlyHeader)
json - the JSON object to convertonlyHeader - whether to retrieve only the headerpublic static Instances toInstances(JSONNode json)
json - the JSON object to convertpublic static Instances toHeader(JSONNode json)
json - the JSON object to convertprotected static JSONNode toJSON(Instances inst, Attribute att)
inst - the corresponding datasetatt - the attribute to convertprotected static JSONNode toJSON(Instance inst)
inst - the Instance to convertpublic static JSONNode toJSON(Instances inst)
inst - the Instances to turn into a JSON objectpublic static void main(java.lang.String[] args)
throws java.lang.Exception
args - expects a dataset as first parameterjava.lang.Exception - if something goes wrong