Examples of NamedNodeImpl


Examples of org.wymiwyg.rdf.graphs.impl.NamedNodeImpl

  /**
   * Test method for {@link com.hp.hpl.jena.gvs.impl.SimpleFilterableDecomposition#getFunctionallyGroundedNodes(java.util.Set)}.
   */
  public void testGetFunctionallyGroundedNodesSetOfGroundedNode() {
    Set<GroundedNode> requiredGroundedNodes = new HashSet<GroundedNode>();
    requiredGroundedNodes.add(new NamedNodeImpl("http://example.org/a#"));
    assertEquals(0, simpleFilterableDecomposition.getFunctionallyGroundedNodes(requiredGroundedNodes).size());
    requiredGroundedNodes.add(new NamedNodeImpl("http://example.org/a"));
    assertEquals(0, simpleFilterableDecomposition.getFunctionallyGroundedNodes(requiredGroundedNodes).size());
    requiredGroundedNodes.add(new NamedNodeImpl("http://example.org/b"));
    assertEquals(1, simpleFilterableDecomposition.getFunctionallyGroundedNodes(requiredGroundedNodes).size());
  }
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.impl.NamedNodeImpl

  /**
   * Test method for {@link com.hp.hpl.jena.gvs.impl.SimpleFilterableDecomposition#getTerminalMolecules(java.util.Set)}.
   */
  public void testGetTerminalMoleculesSetOfGroundedNode() {
    Set<GroundedNode> requiredGroundedNodes = new HashSet<GroundedNode>();
    requiredGroundedNodes.add(new NamedNodeImpl("http://example.org/a#"));
    assertEquals(0, simpleFilterableDecomposition.getTerminalMolecules(requiredGroundedNodes).size());
    requiredGroundedNodes.add(new NamedNodeImpl("http://example.org/b"));
    assertEquals(0, simpleFilterableDecomposition.getTerminalMolecules(requiredGroundedNodes).size());
    requiredGroundedNodes.add(new NamedNodeImpl("http://example.org/a"));
    assertEquals(1, simpleFilterableDecomposition.getTerminalMolecules(requiredGroundedNodes).size());
  }
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.impl.NamedNodeImpl

   * @return
   * @throws IOException
   */
  private CrossGraphFgNode getCgFgNodeFromPathNode(ZipFile zipFile, PathNode currentPath)
      throws IOException {
    NamedNode describingResource = new NamedNodeImpl(
        ReferencingNaturalizer.rootURL + currentPath.getPath());
    CrossGraphFgNode result = new CrossGraphFgNode();
    PathNode nodesIn1Path = currentPath.getSubPath("onlyIn1/");
    deserializeFgNodes(zipFile, nodesIn1Path, result.getNodesIn1());
    PathNode nodesIn2Path = currentPath.getSubPath("onlyIn2/");
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.impl.NamedNodeImpl

   * @throws IOException
   */
  private FunctionallyGroundedNode getFgNodeFromPathNode(ZipFile zipFile,
      PathNode pathNode) throws IOException {
   
    NamedNode describingResource = new NamedNodeImpl(
        ReferencingNaturalizer.rootURL + pathNode.getPath());
    FunctionallyGroundedNode existing = descriptionPathToFgNode.get(describingResource);
    if (existing != null) {
      return existing;
    }
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.impl.NamedNodeImpl

    relativePath.append(baseURL);
    relativePath.append(categoryLabel);
    relativePath.append('/');
    relativePath.append(Util.createRandomString(8));
    relativePath.append('/');
    return new NamedNodeImpl(relativePath.toString());
  }
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.impl.NamedNodeImpl

public class FgNodeMergerTest {

  @Test
  public void simple() {
    SimpleGraph graph = new SimpleGraph();
    Node nanmedNode = new NamedNodeImpl("http://1.example.org/");
    graph.add(new TripleImpl(new NodeImpl(),
        new InverseFunctionalPropertyNodeImpl(
            "http://example.org/functional"), nanmedNode));
    Node fg2 = new NodeImpl();
    graph.add(new TripleImpl(fg2, new InverseFunctionalPropertyNodeImpl(
        "http://example.org/functional"), nanmedNode));
    graph.add(new TripleImpl(fg2, new InverseFunctionalPropertyNodeImpl(
        "http://example.org/f2"), new NamedNodeImpl(
        "http://2.example.org/")));
    ReferenceGroundedDecomposition dec = new ReferenceGroundedDecompositionImpl(
        graph);
    Set<FunctionallyGroundedNode> functionallyGroundedNodes = dec
        .getFunctionallyGroundedNodes();
View Full Code Here

Examples of spark.spi.rdf.NamedNodeImpl

  }
 
  @Test
  public void testData() {
    NamedNodeImpl uri1 = new NamedNodeImpl(URI.create("http://example.org/foo"));
    NamedNodeImpl uri2 = new NamedNodeImpl(URI.create("http://example.org/bar"));
    TypedLiteralImpl lit1 = new TypedLiteralImpl("10", XsdTypes.INT);
    TypedLiteralImpl lit2 = new TypedLiteralImpl("20", XsdTypes.INT);
    List<List<Object>> data = toList(
        new Object[][] {
            new Object[] { iri(uri1), iri(uri2), toInt(lit1) },
View Full Code Here

Examples of spark.spi.rdf.NamedNodeImpl

  }
 
  @Test
  public void testDatatypes() {
    Date d = new Date();
    NamedNodeImpl uri = new NamedNodeImpl(URI.create("http://example.org/foo"));
    PlainLiteralImpl lit1 = new PlainLiteralImpl("bar");
    PlainLiteralImpl lit2 = new PlainLiteralImpl("baz", "en");
    TypedLiteralImpl lit3 = new TypedLiteralImpl(DateTime.format(d, TimeZone.getDefault()), XsdTypes.DATE_TIME);
    TypedLiteralImpl aInt = new TypedLiteralImpl("20", XsdTypes.INT);
    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) },
            new Object[] { plainLit(lit2) },
            new Object[] { typedLit(lit3) },
            new Object[] { Integer.valueOf(aInt.getLexical()) },
            new Object[] { Long.valueOf(aLong.getLexical()) },
            new Object[] { Boolean.valueOf(aBool.getLexical()) },
            new Object[] { Float.valueOf(aFloat.getLexical()) },
            new Object[] { Double.valueOf(aDouble.getLexical()) },
            new Object[] { aString.getLexical() },
            new Object[] { bNode(bn) },
            new Object[] { null },
        });
   
    DummySherpaServer server = new DummySherpaServer(data);
    try {
      Solutions s = helpExecuteQuery(server, 10);
      String var = "a";
     
      Assert.assertTrue(s.next());
      Assert.assertEquals(uri, s.getBinding(var));
      Assert.assertEquals(uri.getURI(), s.getURI(var));
     
      Assert.assertTrue(s.next());
      Assert.assertEquals(lit1, s.getBinding(var));
      Assert.assertEquals(lit1, s.getLiteral(var));
     
View Full Code Here

Examples of spark.spi.rdf.NamedNodeImpl

    if (value == null) {
      return null;
    } else if (value instanceof RDFNode) {
      return (RDFNode) value;
    } else if (value instanceof IRI) {
      return new NamedNodeImpl(URI.create(((IRI)value).iri.toString()));
    } else if (value instanceof PlainLiteral) {
      PlainLiteral pl = (PlainLiteral)value;
      String lang = pl.language != null ? pl.language.toString() : null;
      return new PlainLiteralImpl(pl.lexical.toString(), lang);
    } else if (value instanceof TypedLiteral) {
View Full Code Here

Examples of spark.spi.rdf.NamedNodeImpl

    List<Map<String,RDFNode>> sl = new ArrayList<Map<String,RDFNode>>();
    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);
    sl.get(3).put(var, new PlainLiteralImpl(A_DATE_TIME));
    sl.get(4).put(var, new PlainLiteralImpl("198765415975423167465132498465"));
    sl.get(5).put(var, new PlainLiteralImpl("true"));
    sl.get(6).put(var, new PlainLiteralImpl("3.14"));
    sl.get(7).put(var, new PlainLiteralImpl("98.6"));
    sl.get(8).put(var, new PlainLiteralImpl("42"));
   
    SolutionSet s = new SolutionSet(null, Arrays.asList("x"), sl);
    TestCursor.assertCursor(s, BEFORE_FIRST);
   
    assertTrue(s.next());
    TestCursor.assertCursor(s, FIRST);
    assertEquals(uriRef, s.getNamedNode(var));   
    assertEquals(uriRef.getURI(), s.getURI(var));   
   
    assertTrue(s.next());
    TestCursor.assertCursor(s, NONE);
    assertEquals(bn, s.getBlankNode(var));   
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.