org.apache.jena.atlas.json.JSON.parse()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中org.apache.jena.atlas.json.JSON.parse()方法的一些代码示例,展示了JSON.parse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.parse()方法的具体详情如下:
包路径:org.apache.jena.atlas.json.JSON
类名称:JSON
方法名:parse

JSON.parse介绍

[英]Parse a complete JSON object
[中]解析完整的JSON对象

代码示例

代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client

/** Set version and datasource id from a string which is JOSN */
private static void setStateFromString(DataState state, String string) {
  JsonObject obj = JSON.parse(string);
  setFromJsonObject(state, obj);
}

代码示例来源:origin: apache/jena

private JsonObject parseAsJSON (ByteArrayOutputStream bout) 
{
  return JSON.parse(new ByteArrayInputStream(bout.toByteArray())) ;
}

代码示例来源:origin: apache/jena

@Test(expected = JsonParseException.class)
public void js_value_9() {
  JSON.parse("[1 2 3]") ;
}

代码示例来源:origin: apache/jena

@Test(expected = JsonParseException.class)
public void js_value_11() {
  JSON.parse("\"foo\"") ;
}

代码示例来源:origin: apache/jena

@Test(expected = JsonParseException.class)
public void js_value_10() {
  JSON.parse("1") ;
}

代码示例来源:origin: apache/jena

@Test public void jsonAPI_01() {
  JsonObject obj = JSON.parse("{ key1: 'str1' , key2: [ 1 , 2 ] }") ;
  assertEquals(2, obj.size());
}

代码示例来源:origin: apache/jena

@Test public void store_params_13() {
  String xs = "{ \"tdb.triple_indexes\" : [ \"POS\" , \"PSO\"] } " ; 
  JsonObject x = JSON.parse(xs) ;
  StoreParams params = StoreParamsCodec.decode(x) ;
  String[] expected =  { "POS" , "PSO" } ;
  assertArrayEquals(expected, params.getTripleIndexes()) ;
}

代码示例来源:origin: apache/jena

@Test(expected=TDBException.class)
public void store_params_14() {
  String xs = "{ \"tdb.triples_indexes\" : [ \"POS\" , \"PSO\"] } " ; // Misspelt. 
  JsonObject x = JSON.parse(xs) ;
  StoreParams params = StoreParamsCodec.decode(x) ;
  String[] expected =  { "POS" , "PSO" } ;
  assertArrayEquals(expected, params.getTripleIndexes()) ;
}

代码示例来源:origin: apache/jena

@Test(expected=TDBException.class)
public void store_params_14() {
  String xs = "{ \"tdb.triples_indexes\" : [ \"POS\" , \"PSO\"] } " ; // Misspelt. 
  JsonObject x = JSON.parse(xs) ;
  StoreParams params = StoreParamsCodec.decode(x) ;
  String[] expected =  { "POS" , "PSO" } ;
  assertArrayEquals(expected, params.getTripleIndexes()) ;
}

代码示例来源:origin: apache/jena

@Test public void jsonAPI_02() {
  JsonObject obj = JSON.parse("{ key1: 'str1' , key2: [ 1 , 2 ] }") ;
  JsonObject obj2 = (JsonObject)JSON.copy(obj);
  assertNotSame(obj, obj2);
  assertEquals(obj, obj2);
}

代码示例来源:origin: org.apache.jena/jena-tdb

@Test public void store_params_13() {
  String xs = "{ \"tdb.triple_indexes\" : [ \"POS\" , \"PSO\"] } " ; 
  JsonObject x = JSON.parse(xs) ;
  StoreParams params = StoreParamsCodec.decode(x) ;
  String[] expected =  { "POS" , "PSO" } ;
  assertArrayEquals(expected, params.getTripleIndexes()) ;
}

代码示例来源:origin: org.apache.jena/jena-tdb2

@Test public void store_params_13() {
  String xs = "{ \"tdb.triple_indexes\" : [ \"POS\" , \"PSO\"] } " ; 
  JsonObject x = JSON.parse(xs) ;
  StoreParams params = StoreParamsCodec.decode(x) ;
  String[] expected =  { "POS" , "PSO" } ;
  assertArrayEquals(expected, params.getTripleIndexes()) ;
}

代码示例来源:origin: apache/jena

@Test public void store_params_13() {
  String xs = "{ \"tdb.triple_indexes\" : [ \"POS\" , \"PSO\"] } " ; 
  JsonObject x = JSON.parse(xs) ;
  StoreParams params = StoreParamsCodec.decode(x) ;
  String[] expected =  { "POS" , "PSO" } ;
  assertArrayEquals(expected, params.getTripleIndexes()) ;
}

代码示例来源:origin: org.apache.jena/jena-tdb2

@Test(expected=TDBException.class)
public void store_params_14() {
  String xs = "{ \"tdb.triples_indexes\" : [ \"POS\" , \"PSO\"] } " ; // Misspelt. 
  JsonObject x = JSON.parse(xs) ;
  StoreParams params = StoreParamsCodec.decode(x) ;
  String[] expected =  { "POS" , "PSO" } ;
  assertArrayEquals(expected, params.getTripleIndexes()) ;
}

代码示例来源:origin: apache/jena

@Test public void store_params_11() {
  String xs = "{ \"tdb.block_size\": 2048 }" ;
  JsonObject x = JSON.parse(xs) ;
  StoreParams paramsExpected = StoreParams.builder().blockSize(2048).build() ;
  StoreParams paramsActual = StoreParamsCodec.decode(x) ;
  assertEqualsStoreParams(paramsExpected,paramsActual) ;
}

代码示例来源:origin: apache/jena

@Test public void store_params_11() {
  String xs = "{ \"tdb.block_size\": 2048 }" ;
  JsonObject x = JSON.parse(xs) ;
  StoreParams paramsExpected = StoreParams.builder().blockSize(2048).build() ;
  StoreParams paramsActual = StoreParamsCodec.decode(x) ;
  assertEqualsStoreParams(paramsExpected,paramsActual) ;
}

代码示例来源:origin: org.apache.jena/jena-tdb2

@Test public void store_params_11() {
  String xs = "{ \"tdb.block_size\": 2048 }" ;
  JsonObject x = JSON.parse(xs) ;
  StoreParams paramsExpected = StoreParams.builder().blockSize(2048).build() ;
  StoreParams paramsActual = StoreParamsCodec.decode(x) ;
  assertEqualsStoreParams(paramsExpected,paramsActual) ;
}

代码示例来源:origin: apache/jena

@Test public void store_params_12() {
  String xs = "{ \"tdb.file_mode\": \"direct\" , \"tdb.block_size\": 2048 }" ;
  JsonObject x = JSON.parse(xs) ;
  StoreParams paramsExpected = StoreParams.builder().blockSize(2048).fileMode(FileMode.direct).build() ;
  StoreParams paramsActual = StoreParamsCodec.decode(x) ;
  assertEqualsStoreParams(paramsExpected,paramsActual) ;
}

代码示例来源:origin: apache/jena

@Test public void store_params_12() {
  String xs = "{ \"tdb.file_mode\": \"direct\" , \"tdb.block_size\": 2048 }" ;
  JsonObject x = JSON.parse(xs) ;
  StoreParams paramsExpected = StoreParams.builder().blockSize(2048).fileMode(FileMode.direct).build() ;
  StoreParams paramsActual = StoreParamsCodec.decode(x) ;
  assertEqualsStoreParams(paramsExpected,paramsActual) ;
}

代码示例来源:origin: org.apache.jena/jena-tdb2

@Test public void store_params_12() {
  String xs = "{ \"tdb.file_mode\": \"direct\" , \"tdb.block_size\": 2048 }" ;
  JsonObject x = JSON.parse(xs) ;
  StoreParams paramsExpected = StoreParams.builder().blockSize(2048).fileMode(FileMode.direct).build() ;
  StoreParams paramsActual = StoreParamsCodec.decode(x) ;
  assertEqualsStoreParams(paramsExpected,paramsActual) ;
}

相关文章