Package spark.spi.rdf

Examples of spark.spi.rdf.BlankNodeImpl


    TypedLiteralImpl aLong = new TypedLiteralImpl("54687323427654", XsdTypes.LONG);
    TypedLiteralImpl aBool = new TypedLiteralImpl("true", XsdTypes.BOOLEAN);
    TypedLiteralImpl aFloat = new TypedLiteralImpl("3.14", XsdTypes.FLOAT);
    TypedLiteralImpl aDouble = new TypedLiteralImpl("98.6", XsdTypes.DOUBLE);
    TypedLiteralImpl aString = new TypedLiteralImpl("abcd", XsdTypes.STRING);
    BlankNodeImpl bn = new BlankNodeImpl("node0");
   
    List<List<Object>> data = toList(
        new Object[][] {
            new Object[] { iri(uri) },
            new Object[] { plainLit(lit1) },
View Full Code Here


      return new PlainLiteralImpl(pl.lexical.toString(), lang);
    } else if (value instanceof TypedLiteral) {
      TypedLiteral tl = (TypedLiteral)value;
      return new TypedLiteralImpl(tl.lexical.toString(), URI.create(tl.datatype.toString()));
    } else if (value instanceof BNode) {
      return new BlankNodeImpl(((BNode)value).label.toString());
    } else {
      // Sherpa passes strings as something other than java.lang.String, so convert.
      if (value instanceof CharSequence) {
        value = value.toString();
      }
View Full Code Here

  private static final String A_DATE_TIME = "2011-07-20T15:34:13.435-04:00";
 
  public void testSolution() {
    // setup solutions
    Map<String, RDFNode> solution1 = new HashMap<String, RDFNode>();
    BlankNodeImpl node1 = new BlankNodeImpl("1");
    solution1.put("x", node1);
    Map<String, RDFNode> solution2 = new HashMap<String, RDFNode>();
    solution2.put("x", new BlankNodeImpl("2"));
    List<Map<String, RDFNode>> solutionList = new ArrayList<Map<String, RDFNode>>();
    solutionList.add(solution1);
    solutionList.add(solution2);
       
    // exercise SolutionSet
View Full Code Here

    for (int i = 0; i < 10; i++) {
      sl.add(new HashMap<String,RDFNode>());
    }
   
    NamedNode uriRef = new NamedNodeImpl(URI.create("http://example.org/test"));
    BlankNode bn = new BlankNodeImpl("1");
    Literal lit = new PlainLiteralImpl("foo");
   
    sl.get(0).put(var, uriRef);
    sl.get(1).put(var, bn);
    sl.get(2).put(var, lit);
View Full Code Here

  }
 
  public void testIterator() {
    // setup solutions
    Map<String, RDFNode> solution1 = new HashMap<String, RDFNode>();
    BlankNodeImpl node1 = new BlankNodeImpl("1");
    solution1.put("x", node1);
    Map<String, RDFNode> solution2 = new HashMap<String, RDFNode>();
    solution2.put("x", new BlankNodeImpl("2"));
    List<Map<String, RDFNode>> solutionList = new ArrayList<Map<String, RDFNode>>();
    solutionList.add(solution1);
    solutionList.add(solution2);
       
    // setup SolutionSet
View Full Code Here

      case URI:
        if (reader.next() != CHARACTERS) throw new SparqlException("Unexpected data in URI binding");
        return new NamedNodeImpl(new URI(reader.getText()));
      case BNODE:
        if (reader.next() != CHARACTERS) throw new SparqlException("Unexpected data in BNode binding");
        return new BlankNodeImpl(reader.getText());
      case LITERAL:
        String dt = reader.getAttributeValue(null, DATATYPE);
        URI datatype = (dt == null) ? null : new URI(dt);
        String lang = reader.getAttributeValue(XML_NS, LANG);
        if (reader.next() != CHARACTERS) throw new SparqlException("Unexpected data in Literal binding");
View Full Code Here

      TestCursor.assertCursor(s, FIRST);
      assertEquals(URI.create("http://example.org/a"), s.getURI(var));
     
      assertTrue(s.next());
      TestCursor.assertCursor(s, NONE);
      assertEquals(new BlankNodeImpl("node0"), s.getBinding(var));
     
      assertTrue(s.next());
      TestCursor.assertCursor(s, NONE);
      assertEquals(new PlainLiteralImpl("xyz"), s.getBinding(var));
     
View Full Code Here

TOP

Related Classes of spark.spi.rdf.BlankNodeImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.