Package com.tinkerpop.blueprints

Examples of com.tinkerpop.blueprints.Graph


        List<String> feedNamesOwnedByUser = getFeedsOwnedByAUser(feedType);
        List<String> expected = Arrays.asList("impression-feed/2014-01-01T00:00Z", "clicks-feed/2014-01-01T00:00Z",
                "imp-click-join1/2014-01-01T00:00Z", "imp-click-join2/2014-01-01T00:00Z");
        Assert.assertTrue(feedNamesOwnedByUser.containsAll(expected));

        Graph graph = service.getGraph();

        Iterator<Vertex> vertices = graph.getVertices("name", "impression-feed/2014-01-01T00:00Z").iterator();
        Assert.assertTrue(vertices.hasNext());
        Vertex feedInstanceVertex = vertices.next();
        Assert.assertEquals(feedInstanceVertex.getProperty(RelationshipProperty.TYPE.getName()),
                RelationshipType.FEED_INSTANCE.getName());

        Object vertexId = feedInstanceVertex.getId();
        Vertex vertexById = graph.getVertex(vertexId);
        Assert.assertEquals(vertexById, feedInstanceVertex);

        // feeds classified as secure
        verifyFeedsClassifiedAsSecure(feedType,
                Arrays.asList("impression-feed/2014-01-01T00:00Z",
View Full Code Here


     * @param cascade             kind of cascade used for dependent properties
     * @param objectsBeingUpdated map containing subgraph of obejcts currently being updated, this is used to avoid loops, and NOT as a cache
     * @return updated object
     */
    public <DataType> Object performUpdate(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, String objectVertexId, Vertex objectVertex, Class<?> valueClass, Map<Property, Collection<CascadeType>> containedProperties, Object toUpdate, CascadeType cascade, Map<String, Object> objectsBeingUpdated) {
        Graph database = service.getDatabase();
        // it's in fact an object creation
        if (objectVertex == null) {
            if (logger.isLoggable(Level.FINER)) {
                logger.log(Level.FINER, "object " + objectVertexId.toString() + " has never before been seen in graph, so create central node for it");
            }
View Full Code Here

     * @param toDelete             object to delete
     * @param cascade              kind of cascade used for dependent properties
     * @param objectsBeingAccessed map containing subgraph of objects currently being delete, this is used to avoid loops, and NOT as a cache
     */
    public <DataType> void performDelete(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, String objectVertexId, Vertex objectVertex, Class<?> valueClass, Map<Property, Collection<CascadeType>> containedProperties, DataType toDelete, CascadeType cascade, Map<String, Object> objectsBeingAccessed) {
        Graph database = service.getDatabase();
        for (Map.Entry<Property, Collection<CascadeType>> entry : containedProperties.entrySet()) {
          Property p = entry.getKey();
            // Static properties are by design not written
            if (!p.hasModifier(Modifier.STATIC) && !Annotations.TRANSIENT.is(p)) {
                // Per default, no operation is cascaded
View Full Code Here

   * @see com.dooapp.gaedo.blueprints.queries.tests.VertexTestVisitorAdapter#visit(com.dooapp.gaedo.blueprints.queries.tests.VertexPropertyTest)
   */
  @Override
  public void visit(final VertexPropertyTest vertexPropertyTest) {
    // TODO improve that code !!!
    Graph g = service.getDatabase();
    if (g instanceof IndexableGraph) {
      final IndexableGraph indexable = (IndexableGraph) g;
      final Index<Vertex> vertices = indexable
              .getIndex(IndexNames.VERTICES.getIndexName(), Vertex.class);
      result.put(new Iterable<Vertex>() {
View Full Code Here

   * @return updated object
   */
  public <DataType> Object performUpdate(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, GraphDatabaseDriver driver,
          String objectVertexId, Vertex objectVertex, Class<?> valueClass, Map<Property, Collection<CascadeType>> containedProperties,
          Object toUpdate, CascadeType cascade, ObjectCache objectsBeingUpdated) {
    Graph database = service.getDatabase();
    // it's in fact an object creation
    if (objectVertex == null) {
      if (logger.isLoggable(Level.FINER)) {
        logger.log(Level.FINER, "object " + objectVertexId.toString() + " has never before been seen in graph, so create central node for it");
      }
View Full Code Here

            final Class<?> valueClass,
            final Map<Property, Collection<CascadeType>> containedProperties,
            final DataType toDelete,
            CascadeType cascade,
            final ObjectCache objectsBeingAccessed) {
        final Graph database = service.getDatabase();
        new OperateOnProperties().execute(containedProperties, cascade, new DeleteProperties<DataType>(containedProperties, database, objectsBeingAccessed, objectVertex, toDelete, service));
        /* We try to locate vertex in graph before to delete it. Indeed, mainly due cascade delete, this vertex may have already been removed */
        Vertex notYetDeleted = driver.loadVertexFor(objectVertexId, valueClass.getName());
        if(notYetDeleted!=null)
          driver.removeSafely(notYetDeleted);
View Full Code Here

   * @return updated object
   */
  public <DataType> Object performUpdate(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, GraphDatabaseDriver driver,
          String objectVertexId, Vertex objectVertex, Class<?> valueClass, Map<Property, Collection<CascadeType>> containedProperties,
          Object toUpdate, CascadeType cascade, ObjectCache objectsBeingUpdated) {
    Graph database = service.getDatabase();
    // it's in fact an object creation
    if (objectVertex == null) {
      if (logger.isLoggable(Level.FINER)) {
        logger.log(Level.FINER, "object " + objectVertexId.toString() + " has never before been seen in graph, so create central node for it");
      }
View Full Code Here

    private FramedGraph<Graph> framedGraph;

    @Before
    public void setup() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        framedGraph = new FramedGraphFactory(new AbstractModule(){
          @Override
          protected void doConfigure(FramedGraphConfiguration config) {
            config.addFrameInitializer(nameDefaulter);
            config.addFrameInitializer(weightDefaulter);
View Full Code Here

       
    }
   
    @Test
    public void testDeprecatedRegistration() {
      Graph graph = TinkerGraphFactory.createTinkerGraph();
        FramedGraph<Graph> framedGraph = new FramedGraph(graph);
        framedGraph.registerFrameInitializer(nameDefaulter);
        Person person = framedGraph.addVertex(null, Person.class);
        assertEquals("Defaulted", person.getName());
       
View Full Code Here

* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public class FramedGraphTest extends GraphTest {

    public void testDeprecatedAnnotationUnregister() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        FramedGraph<Graph> framedGraph = new FramedGraph<Graph>(graph);

        int counter = framedGraph.getAnnotationHandlers().size();
        for (AnnotationHandler a : new HashSet<AnnotationHandler>(framedGraph.getAnnotationHandlers())) {
            assertTrue(framedGraph.hasAnnotationHandler(a.getAnnotationType()));
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.Graph

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.