Examples of NodeAttribute


Examples of org.sindice.siren.analysis.attributes.NodeAttribute

    if (expectedPosIncrs != null) {
      assertTrue("has PositionIncrementAttribute", t.hasAttribute(PositionIncrementAttribute.class));
      posIncrAtt = t.getAttribute(PositionIncrementAttribute.class);
    }

    NodeAttribute nodeAtt = null;
    if (expectedNode != null) {
      assertTrue("has NodeAttribute", t.hasAttribute(NodeAttribute.class));
      nodeAtt = t.getAttribute(NodeAttribute.class);
    }

    t.setReader(new StringReader(input));
    t.reset(); // reset the stream for the new reader

    for (int i = 0; i < expectedImages.length; i++) {

      assertTrue("token "+i+" exists", t.incrementToken());

      assertEquals("i=" + i, expectedImages[i], termAtt.toString());

      if (expectedTypes != null) {
        assertEquals("i=" + i, expectedTypes[i], typeAtt.type());
      }

      if (expectedDatatypes != null) {
        assertEquals("i=" + i, expectedDatatypes[i], dtypeAtt.datatypeURI() == null ? "" : String.valueOf(dtypeAtt.datatypeURI()));
      }

      if (expectedPosIncrs != null) {
        assertEquals("i=" + i, expectedPosIncrs[i], posIncrAtt.getPositionIncrement());
      }

      if (expectedNode != null) {
        assertEquals("i=" + i, expectedNode[i], nodeAtt.node());
      }

    }

    assertFalse("end of stream", t.incrementToken());
View Full Code Here

Examples of org.structr.core.graph.NodeAttribute

      SchemaNode node = null;

      // setup
      try (final Tx tx = app.tx()) {

        node = app.create(SchemaNode.class, new NodeAttribute(SchemaNode.name, "TestType"));
        node.setProperty(new StringProperty("_test"), "Integer");

        tx.success();
      }

      // fetch dynamic type info
      final Class dynamicType   = StructrApp.getConfiguration().getNodeEntityClass("TestType");
      final PropertyKey testKey = StructrApp.getConfiguration().getPropertyKeyForJSONName(dynamicType, "test");

      // modify schema node but keep reference to "old" type
      try (final Tx tx = app.tx()) {

        node.setProperty(new StringProperty("_test2"), "String");

        tx.success();
      }

      // create test nodes
      try (final Tx tx = app.tx()) {

        app.create(dynamicType, new NodeAttribute(testKey, 10));
        app.create(dynamicType, new NodeAttribute(testKey, 11));
        app.create(dynamicType, new NodeAttribute(testKey, 12));

        tx.success();
      }

      // query test nodes
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.