Search in sources :

Example 1 with DFramedGraphFactory

use of org.openntf.domino.graph2.impl.DFramedGraphFactory in project org.openntf.domino by OpenNTF.

the class Graph2Demo method run3.

public void run3() {
    long testStartTime = System.nanoTime();
    marktime = System.nanoTime();
    try {
        timelog("Beginning graph2 test3...");
        DElementStore crewStore = new DElementStore();
        crewStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(crewId));
        crewStore.addType(Crew.class);
        DElementStore movieStore = new DElementStore();
        movieStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(movieId));
        movieStore.addType(Movie.class);
        DElementStore characterStore = new DElementStore();
        characterStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(characterId));
        characterStore.addType(Character.class);
        DElementStore edgeStore = new DElementStore();
        edgeStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(edgeId));
        DElementStore usersStore = new DElementStore();
        usersStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(nabId));
        usersStore.setProxyStoreKey(NoteCoordinate.Utils.getLongFromReplid(usersId));
        usersStore.addType(Person.class);
        DConfiguration config = new DConfiguration();
        config.addElementStore(crewStore);
        config.addElementStore(movieStore);
        config.addElementStore(characterStore);
        config.addElementStore(edgeStore);
        config.addElementStore(usersStore);
        config.setDefaultElementStore(NoteCoordinate.Utils.getLongFromReplid(edgeId));
        graph = new DGraph(config);
        JavaHandlerModule jhm = new JavaHandlerModule();
        Module module = new TypedGraphModuleBuilder().withClass(Person.class).withClass(Movie.class).withClass(Character.class).withClass(Crew.class).build();
        DFramedGraphFactory factory = new DFramedGraphFactory(module, jhm);
        FramedTransactionalGraph<DGraph> framedGraph = factory.create(graph);
        Person ntfUser = framedGraph.getVertex(nabId + ntfUnid, Person.class);
        Movie newhopeMovie = framedGraph.getVertex("Star Wars", Movie.class);
        Movie empireMovie = framedGraph.getVertex("The Empire Strikes Back", Movie.class);
        Movie jediMovie = framedGraph.getVertex("Return of the Jedi", Movie.class);
        Movie phantomMovie = framedGraph.getVertex("The Phantom Menace", Movie.class);
        Movie clonesMovie = framedGraph.getVertex("Attack of the Clones", Movie.class);
        Movie revengeMovie = framedGraph.getVertex("Revenge of the Sith", Movie.class);
        System.out.println("***************************");
        System.out.println("Don't miss " + newhopeMovie.getTitle());
        Iterable<Starring> starrings = newhopeMovie.getStarring();
        for (Starring starring : starrings) {
            Crew crew = starring.getStar();
            Character character = crew.getPortraysCharacters().iterator().next();
            System.out.println(crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName());
        }
        System.out.println("***************************");
        System.out.println("Don't miss " + empireMovie.getTitle());
        starrings = empireMovie.getStarring();
        for (Starring starring : starrings) {
            Crew crew = starring.getStar();
            Character character = crew.getPortraysCharacters().iterator().next();
            System.out.println(crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName());
        }
        System.out.println("***************************");
        System.out.println("Don't miss " + jediMovie.getTitle());
        starrings = jediMovie.getStarring();
        for (Starring starring : starrings) {
            Crew crew = starring.getStar();
            Character character = crew.getPortraysCharacters().iterator().next();
            System.out.println(crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName());
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
Also used : JavaHandlerModule(com.tinkerpop.frames.modules.javahandler.JavaHandlerModule) TypedGraphModuleBuilder(com.tinkerpop.frames.modules.typedgraph.TypedGraphModuleBuilder) DElementStore(org.openntf.domino.graph2.impl.DElementStore) DGraph(org.openntf.domino.graph2.impl.DGraph) DConfiguration(org.openntf.domino.graph2.impl.DConfiguration) JavaHandlerModule(com.tinkerpop.frames.modules.javahandler.JavaHandlerModule) Module(com.tinkerpop.frames.modules.Module) Person(org.openntf.domino.graph2.builtin.identity.Person) DFramedGraphFactory(org.openntf.domino.graph2.impl.DFramedGraphFactory)

Example 2 with DFramedGraphFactory

use of org.openntf.domino.graph2.impl.DFramedGraphFactory in project org.openntf.domino by OpenNTF.

the class Graph2Demo method run1.

public void run1() {
    long testStartTime = System.nanoTime();
    marktime = System.nanoTime();
    try {
        timelog("Beginning graph2 test...");
        DElementStore crewStore = new DElementStore();
        crewStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(crewId));
        crewStore.addType(Crew.class);
        DElementStore movieStore = new DElementStore();
        movieStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(movieId));
        movieStore.addType(Movie.class);
        DElementStore characterStore = new DElementStore();
        characterStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(characterId));
        characterStore.addType(Character.class);
        DElementStore edgeStore = new DElementStore();
        edgeStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(edgeId));
        DElementStore usersStore = new DElementStore();
        usersStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(nabId));
        usersStore.setProxyStoreKey(NoteCoordinate.Utils.getLongFromReplid(usersId));
        usersStore.addType(Person.class);
        DConfiguration config = new DConfiguration();
        config.addElementStore(crewStore);
        config.addElementStore(movieStore);
        config.addElementStore(characterStore);
        config.addElementStore(edgeStore);
        config.addElementStore(usersStore);
        config.setDefaultElementStore(NoteCoordinate.Utils.getLongFromReplid(edgeId));
        graph = new DGraph(config);
        JavaHandlerModule jhm = new JavaHandlerModule();
        Module module = new TypedGraphModuleBuilder().withClass(Person.class).withClass(Movie.class).withClass(Character.class).withClass(Crew.class).build();
        DFramedGraphFactory factory = new DFramedGraphFactory(module, jhm);
        FramedTransactionalGraph<DGraph> framedGraph = factory.create(graph);
        ((org.openntf.domino.Database) crewStore.getStoreDelegate()).getAllDocuments().removeAll(true);
        ((org.openntf.domino.Database) movieStore.getStoreDelegate()).getAllDocuments().removeAll(true);
        ((org.openntf.domino.Database) characterStore.getStoreDelegate()).getAllDocuments().removeAll(true);
        ((org.openntf.domino.Database) edgeStore.getStoreDelegate()).getAllDocuments().removeAll(true);
        Person ntfUser = framedGraph.getVertex(nabId + ntfUnid, Person.class);
        Movie newhopeMovie = framedGraph.addVertex("Star Wars", Movie.class);
        newhopeMovie.setTitle("Star Wars");
        Rates ntfRatesNH = ntfUser.addRateable(newhopeMovie);
        ntfRatesNH.setRating(4);
        Movie empireMovie = framedGraph.addVertex("The Empire Strikes Back", Movie.class);
        empireMovie.setTitle("The Empire Strikes Back");
        Rates ntfRatesESB = ntfUser.addRateable(empireMovie);
        ntfRatesESB.setRating(5);
        Movie jediMovie = framedGraph.addVertex("Return of the Jedi", Movie.class);
        jediMovie.setTitle("Return of the Jedi");
        Rates ntfRatesRoJ = ntfUser.addRateable(jediMovie);
        ntfRatesRoJ.setRating(5);
        Movie phantomMovie = framedGraph.addVertex("The Phantom Menace", Movie.class);
        phantomMovie.setTitle("The Phantom Menace");
        Movie clonesMovie = framedGraph.addVertex("Attack of the Clones", Movie.class);
        clonesMovie.setTitle("Attack of the Clones");
        Movie revengeMovie = framedGraph.addVertex("Revenge of the Sith", Movie.class);
        revengeMovie.setTitle("Revenge of the Sith");
        Crew lucasCrew = framedGraph.addVertex("George Lucas", Crew.class);
        lucasCrew.setFullName("George Lucas");
        Crew kershnerCrew = framedGraph.addVertex("Irvin Kershner", Crew.class);
        kershnerCrew.setFullName("Irvin Kershner");
        Crew marquandCrew = framedGraph.addVertex("Richard Marquand", Crew.class);
        marquandCrew.setFullName("Richard Marquand");
        DirectedBy nhDirector = newhopeMovie.addDirectedBy(lucasCrew);
        nhDirector.setRating(4);
        DirectedBy esbDirector = empireMovie.addDirectedBy(kershnerCrew);
        esbDirector.setRating(5);
        DirectedBy rojDirector = jediMovie.addDirectedBy(marquandCrew);
        rojDirector.setRating(4);
        DirectedBy pmDirector = phantomMovie.addDirectedBy(lucasCrew);
        pmDirector.setRating(3);
        DirectedBy aocDirector = clonesMovie.addDirectedBy(lucasCrew);
        aocDirector.setRating(2);
        DirectedBy rosDirector = revengeMovie.addDirectedBy(lucasCrew);
        rosDirector.setRating(1);
        Character luke = framedGraph.addVertex("Luke Skywalker", Character.class);
        luke.setName("Luke Skywalker");
        luke.addAppearsIn(newhopeMovie);
        luke.addAppearsIn(empireMovie);
        luke.addAppearsIn(jediMovie);
        Character leia = framedGraph.addVertex("Leia Organa", Character.class);
        leia.setName("Leia Organa");
        leia.addAppearsIn(newhopeMovie);
        leia.addAppearsIn(empireMovie);
        leia.addAppearsIn(jediMovie);
        Character han = framedGraph.addVertex("Han Solo", Character.class);
        han.setName("Han Solo");
        han.addAppearsIn(newhopeMovie);
        han.addAppearsIn(empireMovie);
        han.addAppearsIn(jediMovie);
        Character chewy = framedGraph.addVertex("Chewbacca", Character.class);
        chewy.setName("Chewbacca");
        chewy.addAppearsIn(newhopeMovie);
        chewy.addAppearsIn(empireMovie);
        chewy.addAppearsIn(jediMovie);
        chewy.addAppearsIn(revengeMovie);
        Character threepio = framedGraph.addVertex("C-3PO", Character.class);
        threepio.setName("C-3PO");
        threepio.addAppearsIn(newhopeMovie);
        threepio.addAppearsIn(empireMovie);
        threepio.addAppearsIn(jediMovie);
        threepio.addAppearsIn(phantomMovie);
        threepio.addAppearsIn(clonesMovie);
        threepio.addAppearsIn(revengeMovie);
        Character artoo = framedGraph.addVertex("R2D2", Character.class);
        artoo.setName("R2D2");
        artoo.addAppearsIn(newhopeMovie);
        artoo.addAppearsIn(empireMovie);
        artoo.addAppearsIn(jediMovie);
        artoo.addAppearsIn(phantomMovie);
        artoo.addAppearsIn(clonesMovie);
        artoo.addAppearsIn(revengeMovie);
        Character lando = framedGraph.addVertex("Lando Calrissian", Character.class);
        lando.setName("Lando Calrissian");
        lando.addAppearsIn(empireMovie);
        lando.addAppearsIn(jediMovie);
        Character anakin = framedGraph.addVertex("Anakin Skywalker", Character.class);
        anakin.setName("Anakin Skywalker");
        anakin.addAppearsIn(newhopeMovie);
        anakin.addAppearsIn(empireMovie);
        anakin.addAppearsIn(jediMovie);
        anakin.addAppearsIn(phantomMovie);
        anakin.addAppearsIn(clonesMovie);
        anakin.addAppearsIn(revengeMovie);
        Character palpatine = framedGraph.addVertex("Darth Sidious", Character.class);
        palpatine.setName("Darth Sidious");
        palpatine.addAppearsIn(empireMovie);
        palpatine.addAppearsIn(jediMovie);
        palpatine.addAppearsIn(phantomMovie);
        palpatine.addAppearsIn(clonesMovie);
        palpatine.addAppearsIn(revengeMovie);
        Character obiwan = framedGraph.addVertex("Obi-Wan Kenobi", Character.class);
        obiwan.setName("Obi-Wan Kenobi");
        obiwan.addAppearsIn(newhopeMovie);
        obiwan.addAppearsIn(empireMovie);
        obiwan.addAppearsIn(jediMovie);
        obiwan.addAppearsIn(phantomMovie);
        obiwan.addAppearsIn(clonesMovie);
        obiwan.addAppearsIn(revengeMovie);
        Character quigon = framedGraph.addVertex("Qui-Gon Jinn", Character.class);
        quigon.setName("Qui-Gon Jinn");
        quigon.addAppearsIn(phantomMovie);
        Character yoda = framedGraph.addVertex("Yoda", Character.class);
        yoda.setName("Yoda");
        yoda.addAppearsIn(empireMovie);
        yoda.addAppearsIn(jediMovie);
        yoda.addAppearsIn(phantomMovie);
        yoda.addAppearsIn(clonesMovie);
        yoda.addAppearsIn(revengeMovie);
        Character jango = framedGraph.addVertex("Jango Fett", Character.class);
        jango.setName("Jango Fett");
        jango.addAppearsIn(clonesMovie);
        Character boba = framedGraph.addVertex("Boba Fett", Character.class);
        boba.setName("Boba Fett");
        boba.addAppearsIn(empireMovie);
        boba.addAppearsIn(jediMovie);
        boba.addAppearsIn(clonesMovie);
        Character padme = framedGraph.addVertex("Padme", Character.class);
        padme.setName("Padme");
        padme.addAppearsIn(phantomMovie);
        padme.addAppearsIn(clonesMovie);
        padme.addAppearsIn(revengeMovie);
        Character shmi = framedGraph.addVertex("Shmi Skywalker", Character.class);
        shmi.setName("Shmi Skywalker");
        shmi.addAppearsIn(phantomMovie);
        shmi.addAppearsIn(clonesMovie);
        Character tyranus = framedGraph.addVertex("Darth Tyranus", Character.class);
        tyranus.setName("Darth Tyranus");
        tyranus.addAppearsIn(clonesMovie);
        tyranus.addAppearsIn(revengeMovie);
        Character maul = framedGraph.addVertex("Darth Maul", Character.class);
        maul.setName("Darth Maul");
        maul.addAppearsIn(phantomMovie);
        maul.addAppearsIn(clonesMovie);
        Character tarkin = framedGraph.addVertex("Grand Moff Tarkin", Character.class);
        tarkin.setName("Grand Moff Tarkin");
        tarkin.addAppearsIn(newhopeMovie);
        Character windu = framedGraph.addVertex("Mace Windu", Character.class);
        windu.setName("Mace Windu");
        windu.addAppearsIn(phantomMovie);
        windu.addAppearsIn(clonesMovie);
        windu.addAppearsIn(revengeMovie);
        Character greedo = framedGraph.addVertex("Greedo", Character.class);
        greedo.setName("Greedo");
        greedo.addAppearsIn(newhopeMovie);
        Character wedge = framedGraph.addVertex("Wedge Antilles", Character.class);
        wedge.setName("Wedge Antilles");
        wedge.addAppearsIn(newhopeMovie);
        wedge.addAppearsIn(empireMovie);
        wedge.addAppearsIn(jediMovie);
        Crew ford = framedGraph.addVertex("Harrison Ford", Crew.class);
        ford.setFullName("Harrison Ford");
        ford.addStarsInMovie(newhopeMovie);
        ford.addStarsInMovie(empireMovie);
        ford.addStarsInMovie(jediMovie);
        han.addPortrayedBy(ford);
        Crew fischer = framedGraph.addVertex("Carrie Fischer", Crew.class);
        fischer.setFullName("Carrie Fischer");
        fischer.addStarsInMovie(newhopeMovie);
        fischer.addStarsInMovie(empireMovie);
        fischer.addStarsInMovie(jediMovie);
        fischer.addPortrayals(leia);
        Crew hammill = framedGraph.addVertex("Mark Hammill", Crew.class);
        hammill.setFullName("Mark Hammill");
        hammill.addStarsInMovie(newhopeMovie);
        hammill.addStarsInMovie(empireMovie);
        hammill.addStarsInMovie(jediMovie);
        hammill.addPortrayals(luke);
        Crew daniels = framedGraph.addVertex("Anthony Daniels", Crew.class);
        daniels.setFullName("Anthony Daniels");
        daniels.addStarsInMovie(newhopeMovie);
        daniels.addStarsInMovie(empireMovie);
        daniels.addStarsInMovie(jediMovie);
        daniels.addStarsInMovie(phantomMovie);
        daniels.addStarsInMovie(clonesMovie);
        daniels.addStarsInMovie(revengeMovie);
        daniels.addPortrayals(threepio);
        Crew baker = framedGraph.addVertex("Kenny Baker", Crew.class);
        baker.setFullName("Kenny Baker");
        baker.addStarsInMovie(newhopeMovie);
        baker.addStarsInMovie(empireMovie);
        baker.addStarsInMovie(jediMovie);
        baker.addStarsInMovie(phantomMovie);
        baker.addStarsInMovie(clonesMovie);
        baker.addStarsInMovie(revengeMovie);
        baker.addPortrayals(artoo);
        Crew prowse = framedGraph.addVertex("David Prowse", Crew.class);
        prowse.setFullName("David Prowse");
        prowse.addStarsInMovie(newhopeMovie);
        prowse.addStarsInMovie(empireMovie);
        prowse.addStarsInMovie(jediMovie);
        prowse.addPortrayals(anakin);
        Crew williams = framedGraph.addVertex("Billy Dee Williams", Crew.class);
        williams.setFullName("Billy Dee Williams");
        williams.addStarsInMovie(empireMovie);
        williams.addStarsInMovie(jediMovie);
        williams.addPortrayals(lando);
        Crew guinness = framedGraph.addVertex("Alec Guinness", Crew.class);
        guinness.setFullName("Alec Guinness");
        guinness.addStarsInMovie(newhopeMovie);
        guinness.addStarsInMovie(empireMovie);
        guinness.addStarsInMovie(jediMovie);
        guinness.addPortrayals(obiwan);
        Crew ewan = framedGraph.addVertex("Ewan McGregor", Crew.class);
        ewan.setFullName("Ewan McGregor");
        ewan.addStarsInMovie(phantomMovie);
        ewan.addStarsInMovie(clonesMovie);
        ewan.addStarsInMovie(revengeMovie);
        ewan.addPortrayals(obiwan);
        Crew cushing = framedGraph.addVertex("Peter Cushing", Crew.class);
        cushing.setFullName("Peter Cushing");
        cushing.addStarsInMovie(newhopeMovie);
        cushing.addPortrayals(tarkin);
        Crew mayhew = framedGraph.addVertex("Peter Mayhew", Crew.class);
        mayhew.setFullName("Peter Mayhew");
        mayhew.addStarsInMovie(newhopeMovie);
        mayhew.addStarsInMovie(empireMovie);
        mayhew.addStarsInMovie(jediMovie);
        mayhew.addStarsInMovie(revengeMovie);
        mayhew.addPortrayals(chewy);
        Crew oz = framedGraph.addVertex("Frank Oz", Crew.class);
        oz.setFullName("Frank Oz");
        oz.addStarsInMovie(empireMovie);
        oz.addStarsInMovie(jediMovie);
        oz.addStarsInMovie(phantomMovie);
        oz.addStarsInMovie(clonesMovie);
        oz.addStarsInMovie(revengeMovie);
        oz.addPortrayals(yoda);
        Crew bulloch = framedGraph.addVertex("Jeremy Bulloch", Crew.class);
        bulloch.setFullName("Jeremy Bulloch");
        bulloch.addStarsInMovie(empireMovie);
        bulloch.addStarsInMovie(jediMovie);
        bulloch.addPortrayals(boba);
        Crew revill = framedGraph.addVertex("Clive Revill", Crew.class);
        revill.setFullName("Clive Revill");
        revill.addStarsInMovie(empireMovie);
        revill.addPortrayals(palpatine);
        Crew ian = framedGraph.addVertex("Ian McDiarmid", Crew.class);
        ian.setFullName("Ian McDiarmid");
        ian.addStarsInMovie(jediMovie);
        ian.addStarsInMovie(phantomMovie);
        ian.addStarsInMovie(clonesMovie);
        ian.addStarsInMovie(revengeMovie);
        ian.addPortrayals(palpatine);
        Crew shaw = framedGraph.addVertex("Sebastian Shaw", Crew.class);
        shaw.setFullName("Sebastian Shaw");
        shaw.addStarsInMovie(jediMovie);
        shaw.addPortrayals(anakin);
        Crew liam = framedGraph.addVertex("Liam Neeson", Crew.class);
        liam.setFullName("Liam Neeson");
        liam.addStarsInMovie(phantomMovie);
        liam.addPortrayals(quigon);
        Crew portman = framedGraph.addVertex("Natalie Portman", Crew.class);
        portman.setFullName("Natalie Portman");
        portman.addStarsInMovie(phantomMovie);
        portman.addStarsInMovie(clonesMovie);
        portman.addStarsInMovie(revengeMovie);
        portman.addPortrayals(padme);
        Crew lloyd = framedGraph.addVertex("Jake Lloyd", Crew.class);
        lloyd.setFullName("Jake Lloyd");
        lloyd.addStarsInMovie(phantomMovie);
        lloyd.addPortrayals(anakin);
        Crew hayden = framedGraph.addVertex("Hayden Christensen", Crew.class);
        hayden.setFullName("Hayden Christensen");
        hayden.addStarsInMovie(clonesMovie);
        hayden.addStarsInMovie(revengeMovie);
        hayden.addPortrayals(anakin);
        Crew august = framedGraph.addVertex("Pernill August", Crew.class);
        august.setFullName("Pernill August");
        august.addStarsInMovie(phantomMovie);
        august.addStarsInMovie(clonesMovie);
        august.addPortrayals(shmi);
        Crew park = framedGraph.addVertex("Ray Park", Crew.class);
        park.setFullName("Ray Park");
        park.addStarsInMovie(phantomMovie);
        park.addPortrayals(maul);
        Crew samuel = framedGraph.addVertex("Samuel L. Jackson", Crew.class);
        samuel.setFullName("Samuel L. Jackson");
        samuel.addStarsInMovie(phantomMovie);
        samuel.addStarsInMovie(clonesMovie);
        samuel.addStarsInMovie(revengeMovie);
        samuel.addPortrayals(windu);
        Crew lee = framedGraph.addVertex("Christopher Lee", Crew.class);
        lee.setFullName("Christopher Lee");
        lee.addStarsInMovie(clonesMovie);
        lee.addStarsInMovie(revengeMovie);
        lee.addPortrayals(tyranus);
        Crew morrison = framedGraph.addVertex("Temuera Morrison", Crew.class);
        morrison.setFullName("Temuera Morrison");
        morrison.addStarsInMovie(clonesMovie);
        morrison.addPortrayals(jango);
        Crew logan = framedGraph.addVertex("Daniel Logan", Crew.class);
        logan.setFullName("Daniel Logan");
        logan.addStarsInMovie(clonesMovie);
        logan.addPortrayals(boba);
        Crew blake = framedGraph.addVertex("Paul Blake", Crew.class);
        blake.setFullName("Paul Blake");
        blake.addStarsInMovie(newhopeMovie);
        blake.addPortrayals(greedo);
        Crew lawson = framedGraph.addVertex("Denis Lawson", Crew.class);
        lawson.setFullName("Denis Lawson");
        lawson.addStarsInMovie(newhopeMovie);
        lawson.addStarsInMovie(empireMovie);
        lawson.addStarsInMovie(jediMovie);
        lawson.addPortrayals(wedge);
        Kills curKills = null;
        curKills = anakin.addKills(obiwan);
        curKills.setFilm(newhopeMovie.asVertex().getId().toString());
        curKills = luke.addKills(tarkin);
        curKills.setFilm(newhopeMovie.asVertex().getId().toString());
        curKills = windu.addKills(jango);
        curKills.setFilm(clonesMovie.asVertex().getId().toString());
        curKills = palpatine.addKills(windu);
        curKills.setFilm(revengeMovie.asVertex().getId().toString());
        curKills = wedge.addKills(palpatine);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        curKills = lando.addKills(palpatine);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        curKills = maul.addKills(quigon);
        curKills.setFilm(phantomMovie.asVertex().getId().toString());
        curKills = obiwan.addKills(maul);
        curKills.setFilm(phantomMovie.asVertex().getId().toString());
        curKills = han.addKills(greedo);
        curKills.setFilm(newhopeMovie.asVertex().getId().toString());
        curKills = han.addKills(boba);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        curKills = anakin.addKills(tyranus);
        curKills.setFilm(revengeMovie.asVertex().getId().toString());
        curKills = palpatine.addKills(anakin);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        anakin.addSpawns(threepio);
        anakin.addSpawns(luke);
        anakin.addSpawns(leia);
        padme.addSpawns(luke);
        padme.addSpawns(leia);
        shmi.addSpawns(anakin);
        jango.addSpawns(boba);
        graph.commit();
    } catch (Throwable t) {
        t.printStackTrace();
    }
    long testEndTime = System.nanoTime();
    System.out.println("Completed " + getClass().getSimpleName() + " run in " + ((testEndTime - testStartTime) / 1000000) + " ms");
}
Also used : JavaHandlerModule(com.tinkerpop.frames.modules.javahandler.JavaHandlerModule) Rates(org.openntf.domino.graph2.builtin.social.Rates) TypedGraphModuleBuilder(com.tinkerpop.frames.modules.typedgraph.TypedGraphModuleBuilder) DElementStore(org.openntf.domino.graph2.impl.DElementStore) DGraph(org.openntf.domino.graph2.impl.DGraph) DConfiguration(org.openntf.domino.graph2.impl.DConfiguration) JavaHandlerModule(com.tinkerpop.frames.modules.javahandler.JavaHandlerModule) Module(com.tinkerpop.frames.modules.Module) Person(org.openntf.domino.graph2.builtin.identity.Person) DFramedGraphFactory(org.openntf.domino.graph2.impl.DFramedGraphFactory)

Example 3 with DFramedGraphFactory

use of org.openntf.domino.graph2.impl.DFramedGraphFactory in project org.openntf.domino by OpenNTF.

the class Graph2Demo method setupGraph.

private FramedTransactionalGraph<DGraph> setupGraph() {
    DElementStore crewStore = new DElementStore();
    crewStore.setStoreKey(crewId);
    crewStore.addType(Crew.class);
    DElementStore movieStore = new DElementStore();
    movieStore.setStoreKey(movieId);
    movieStore.addType(Movie.class);
    DElementStore characterStore = new DElementStore();
    characterStore.setStoreKey(characterId);
    characterStore.addType(Character.class);
    DElementStore edgeStore = new DElementStore();
    edgeStore.addType(DirectedBy.class);
    edgeStore.addType(AppearsIn.class);
    edgeStore.addType(Kills.class);
    edgeStore.addType(Starring.class);
    edgeStore.addType(Portrays.class);
    edgeStore.addType(Spawns.class);
    edgeStore.setStoreKey(edgeId);
    DElementStore usersStore = new DElementStore();
    usersStore.setStoreKey(nabId);
    usersStore.setProxyStoreKey(usersId);
    usersStore.addType(Person.class);
    SocialStore socialStore = new SocialStore();
    socialStore.setStoreKey(socialId);
    DConfiguration config = new DConfiguration();
    graph = new DGraph(config);
    config.addElementStore(crewStore);
    config.addElementStore(movieStore);
    config.addElementStore(characterStore);
    config.addElementStore(edgeStore);
    config.addElementStore(usersStore);
    config.addElementStore(socialStore);
    config.setDefaultElementStore(edgeStore.getStoreKey());
    DFramedGraphFactory factory = new DFramedGraphFactory(config);
    FramedTransactionalGraph<DGraph> framedGraph = factory.create(graph);
    return framedGraph;
}
Also used : SocialStore(org.openntf.domino.graph2.builtin.social.SocialStore) DElementStore(org.openntf.domino.graph2.impl.DElementStore) DGraph(org.openntf.domino.graph2.impl.DGraph) DConfiguration(org.openntf.domino.graph2.impl.DConfiguration) DFramedGraphFactory(org.openntf.domino.graph2.impl.DFramedGraphFactory)

Example 4 with DFramedGraphFactory

use of org.openntf.domino.graph2.impl.DFramedGraphFactory in project org.openntf.domino by OpenNTF.

the class Graph2Test method run1.

public void run1() {
    long testStartTime = System.nanoTime();
    marktime = System.nanoTime();
    try {
        timelog("Beginning graph2 test...");
        DElementStore crewStore = new DElementStore();
        crewStore.setStoreKey(crewPath);
        crewStore.addType(Crew.class);
        DElementStore movieStore = new DElementStore();
        movieStore.setStoreKey(moviePath);
        movieStore.addType(Movie.class);
        DElementStore characterStore = new DElementStore();
        characterStore.setStoreKey(charactersPath);
        characterStore.addType(Character.class);
        DElementStore edgeStore = new DElementStore();
        edgeStore.setStoreKey(edgePath);
        // DElementStore usersStore = new DElementStore();
        // usersStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(nabId));
        // usersStore.setProxyStoreKey(NoteCoordinate.Utils.getLongFromReplid(usersId));
        // usersStore.addType(User.class);
        DConfiguration config = new DConfiguration();
        graph = new DGraph(config);
        config.addElementStore(crewStore);
        config.addElementStore(movieStore);
        config.addElementStore(characterStore);
        config.addElementStore(edgeStore);
        // config.addElementStore(usersStore);
        config.setDefaultElementStore(edgeStore.getStoreKey());
        DGraph graph = new DGraph(config);
        DFramedGraphFactory factory = new DFramedGraphFactory(config);
        FramedTransactionalGraph<DGraph> framedGraph = factory.create(graph);
        resetDbs();
        // User ntfUser = framedGraph.getVertex(nabId + ntfUnid, User.class);
        Movie newhopeMovie = framedGraph.addVertex("Star Wars", Movie.class);
        newhopeMovie.setTitle("Star Wars");
        // Likes ntfLikesNH = ntfUser.addLikes(newhopeMovie);
        // ntfLikesNH.setRating(4);
        Movie empireMovie = framedGraph.addVertex("The Empire Strikes Back", Movie.class);
        empireMovie.setTitle("The Empire Strikes Back");
        // Likes ntfLikesESB = ntfUser.addLikes(empireMovie);
        // ntfLikesESB.setRating(5);
        Movie jediMovie = framedGraph.addVertex("Return of the Jedi", Movie.class);
        jediMovie.setTitle("Return of the Jedi");
        // Likes ntfLikesRoJ = ntfUser.addLikes(jediMovie);
        // ntfLikesRoJ.setRating(5);
        Movie phantomMovie = framedGraph.addVertex("The Phantom Menace", Movie.class);
        phantomMovie.setTitle("The Phantom Menace");
        Movie clonesMovie = framedGraph.addVertex("Attack of the Clones", Movie.class);
        clonesMovie.setTitle("Attack of the Clones");
        Movie revengeMovie = framedGraph.addVertex("Revenge of the Sith", Movie.class);
        revengeMovie.setTitle("Revenge of the Sith");
        Crew lucasCrew = framedGraph.addVertex("George Lucas", Crew.class);
        lucasCrew.setFullName("George Lucas");
        Crew kershnerCrew = framedGraph.addVertex("Irvin Kershner", Crew.class);
        kershnerCrew.setFullName("Irvin Kershner");
        Crew marquandCrew = framedGraph.addVertex("Richard Marquand", Crew.class);
        marquandCrew.setFullName("Richard Marquand");
        DirectedBy nhDirector = newhopeMovie.addDirectedBy(lucasCrew);
        nhDirector.setRating(4);
        DirectedBy esbDirector = empireMovie.addDirectedBy(kershnerCrew);
        esbDirector.setRating(5);
        DirectedBy rojDirector = jediMovie.addDirectedBy(marquandCrew);
        rojDirector.setRating(4);
        DirectedBy pmDirector = phantomMovie.addDirectedBy(lucasCrew);
        pmDirector.setRating(3);
        DirectedBy aocDirector = clonesMovie.addDirectedBy(lucasCrew);
        aocDirector.setRating(2);
        DirectedBy rosDirector = revengeMovie.addDirectedBy(lucasCrew);
        rosDirector.setRating(1);
        Character luke = framedGraph.addVertex("Luke Skywalker", Character.class);
        luke.setName("Luke Skywalker");
        luke.addAppearsIn(newhopeMovie);
        luke.addAppearsIn(empireMovie);
        luke.addAppearsIn(jediMovie);
        Character leia = framedGraph.addVertex("Leia Organa", Character.class);
        leia.setName("Leia Organa");
        leia.addAppearsIn(newhopeMovie);
        leia.addAppearsIn(empireMovie);
        leia.addAppearsIn(jediMovie);
        Character han = framedGraph.addVertex("Han Solo", Character.class);
        han.setName("Han Solo");
        han.addAppearsIn(newhopeMovie);
        han.addAppearsIn(empireMovie);
        han.addAppearsIn(jediMovie);
        Character chewy = framedGraph.addVertex("Chewbacca", Character.class);
        chewy.setName("Chewbacca");
        chewy.addAppearsIn(newhopeMovie);
        chewy.addAppearsIn(empireMovie);
        chewy.addAppearsIn(jediMovie);
        chewy.addAppearsIn(revengeMovie);
        Character threepio = framedGraph.addVertex("C-3PO", Character.class);
        threepio.setName("C-3PO");
        threepio.addAppearsIn(newhopeMovie);
        threepio.addAppearsIn(empireMovie);
        threepio.addAppearsIn(jediMovie);
        threepio.addAppearsIn(phantomMovie);
        threepio.addAppearsIn(clonesMovie);
        threepio.addAppearsIn(revengeMovie);
        Character artoo = framedGraph.addVertex("R2D2", Character.class);
        artoo.setName("R2D2");
        artoo.addAppearsIn(newhopeMovie);
        artoo.addAppearsIn(empireMovie);
        artoo.addAppearsIn(jediMovie);
        artoo.addAppearsIn(phantomMovie);
        artoo.addAppearsIn(clonesMovie);
        artoo.addAppearsIn(revengeMovie);
        Character lando = framedGraph.addVertex("Lando Calrissian", Character.class);
        lando.setName("Lando Calrissian");
        lando.addAppearsIn(empireMovie);
        lando.addAppearsIn(jediMovie);
        Character anakin = framedGraph.addVertex("Anakin Skywalker", Character.class);
        anakin.setName("Anakin Skywalker");
        anakin.addAppearsIn(newhopeMovie);
        anakin.addAppearsIn(empireMovie);
        anakin.addAppearsIn(jediMovie);
        anakin.addAppearsIn(phantomMovie);
        anakin.addAppearsIn(clonesMovie);
        anakin.addAppearsIn(revengeMovie);
        Character palpatine = framedGraph.addVertex("Darth Sidious", Character.class);
        palpatine.setName("Darth Sidious");
        palpatine.addAppearsIn(empireMovie);
        palpatine.addAppearsIn(jediMovie);
        palpatine.addAppearsIn(phantomMovie);
        palpatine.addAppearsIn(clonesMovie);
        palpatine.addAppearsIn(revengeMovie);
        Character obiwan = framedGraph.addVertex("Obi-Wan Kenobi", Character.class);
        obiwan.setName("Obi-Wan Kenobi");
        obiwan.addAppearsIn(newhopeMovie);
        obiwan.addAppearsIn(empireMovie);
        obiwan.addAppearsIn(jediMovie);
        obiwan.addAppearsIn(phantomMovie);
        obiwan.addAppearsIn(clonesMovie);
        obiwan.addAppearsIn(revengeMovie);
        Character quigon = framedGraph.addVertex("Qui-Gon Jinn", Character.class);
        quigon.setName("Qui-Gon Jinn");
        quigon.addAppearsIn(phantomMovie);
        Character yoda = framedGraph.addVertex("Yoda", Character.class);
        yoda.setName("Yoda");
        yoda.addAppearsIn(empireMovie);
        yoda.addAppearsIn(jediMovie);
        yoda.addAppearsIn(phantomMovie);
        yoda.addAppearsIn(clonesMovie);
        yoda.addAppearsIn(revengeMovie);
        Character jango = framedGraph.addVertex("Jango Fett", Character.class);
        jango.setName("Jango Fett");
        jango.addAppearsIn(clonesMovie);
        Character boba = framedGraph.addVertex("Boba Fett", Character.class);
        boba.setName("Boba Fett");
        boba.addAppearsIn(empireMovie);
        boba.addAppearsIn(jediMovie);
        boba.addAppearsIn(clonesMovie);
        Character padme = framedGraph.addVertex("Padme", Character.class);
        padme.setName("Padme");
        padme.addAppearsIn(phantomMovie);
        padme.addAppearsIn(clonesMovie);
        padme.addAppearsIn(revengeMovie);
        Character shmi = framedGraph.addVertex("Shmi Skywalker", Character.class);
        shmi.setName("Shmi Skywalker");
        shmi.addAppearsIn(phantomMovie);
        shmi.addAppearsIn(clonesMovie);
        Character tyranus = framedGraph.addVertex("Darth Tyranus", Character.class);
        tyranus.setName("Darth Tyranus");
        tyranus.addAppearsIn(clonesMovie);
        tyranus.addAppearsIn(revengeMovie);
        Character maul = framedGraph.addVertex("Darth Maul", Character.class);
        maul.setName("Darth Maul");
        maul.addAppearsIn(phantomMovie);
        maul.addAppearsIn(clonesMovie);
        Character tarkin = framedGraph.addVertex("Grand Moff Tarkin", Character.class);
        tarkin.setName("Grand Moff Tarkin");
        tarkin.addAppearsIn(newhopeMovie);
        Character windu = framedGraph.addVertex("Mace Windu", Character.class);
        windu.setName("Mace Windu");
        windu.addAppearsIn(phantomMovie);
        windu.addAppearsIn(clonesMovie);
        windu.addAppearsIn(revengeMovie);
        Character greedo = framedGraph.addVertex("Greedo", Character.class);
        greedo.setName("Greedo");
        greedo.addAppearsIn(newhopeMovie);
        Character wedge = framedGraph.addVertex("Wedge Antilles", Character.class);
        wedge.setName("Wedge Antilles");
        wedge.addAppearsIn(newhopeMovie);
        wedge.addAppearsIn(empireMovie);
        wedge.addAppearsIn(jediMovie);
        Crew ford = framedGraph.addVertex("Harrison Ford", Crew.class);
        ford.setFullName("Harrison Ford");
        ford.addStarsInMovie(newhopeMovie);
        ford.addStarsInMovie(empireMovie);
        ford.addStarsInMovie(jediMovie);
        han.addPortrayedBy(ford);
        Crew fischer = framedGraph.addVertex("Carrie Fischer", Crew.class);
        fischer.setFullName("Carrie Fischer");
        fischer.addStarsInMovie(newhopeMovie);
        fischer.addStarsInMovie(empireMovie);
        fischer.addStarsInMovie(jediMovie);
        fischer.addPortrayals(leia);
        Crew hammill = framedGraph.addVertex("Mark Hammill", Crew.class);
        hammill.setFullName("Mark Hammill");
        hammill.addStarsInMovie(newhopeMovie);
        hammill.addStarsInMovie(empireMovie);
        hammill.addStarsInMovie(jediMovie);
        hammill.addPortrayals(luke);
        Crew daniels = framedGraph.addVertex("Anthony Daniels", Crew.class);
        daniels.setFullName("Anthony Daniels");
        daniels.addStarsInMovie(newhopeMovie);
        daniels.addStarsInMovie(empireMovie);
        daniels.addStarsInMovie(jediMovie);
        daniels.addStarsInMovie(phantomMovie);
        daniels.addStarsInMovie(clonesMovie);
        daniels.addStarsInMovie(revengeMovie);
        daniels.addPortrayals(threepio);
        Crew baker = framedGraph.addVertex("Kenny Baker", Crew.class);
        baker.setFullName("Kenny Baker");
        baker.addStarsInMovie(newhopeMovie);
        baker.addStarsInMovie(empireMovie);
        baker.addStarsInMovie(jediMovie);
        baker.addStarsInMovie(phantomMovie);
        baker.addStarsInMovie(clonesMovie);
        baker.addStarsInMovie(revengeMovie);
        baker.addPortrayals(artoo);
        Crew prowse = framedGraph.addVertex("David Prowse", Crew.class);
        prowse.setFullName("David Prowse");
        prowse.addStarsInMovie(newhopeMovie);
        prowse.addStarsInMovie(empireMovie);
        prowse.addStarsInMovie(jediMovie);
        prowse.addPortrayals(anakin);
        Crew williams = framedGraph.addVertex("Billy Dee Williams", Crew.class);
        williams.setFullName("Billy Dee Williams");
        williams.addStarsInMovie(empireMovie);
        williams.addStarsInMovie(jediMovie);
        williams.addPortrayals(lando);
        Crew guinness = framedGraph.addVertex("Alec Guinness", Crew.class);
        guinness.setFullName("Alec Guinness");
        guinness.addStarsInMovie(newhopeMovie);
        guinness.addStarsInMovie(empireMovie);
        guinness.addStarsInMovie(jediMovie);
        guinness.addPortrayals(obiwan);
        Crew ewan = framedGraph.addVertex("Ewan McGregor", Crew.class);
        ewan.setFullName("Ewan McGregor");
        ewan.addStarsInMovie(phantomMovie);
        ewan.addStarsInMovie(clonesMovie);
        ewan.addStarsInMovie(revengeMovie);
        ewan.addPortrayals(obiwan);
        Crew cushing = framedGraph.addVertex("Peter Cushing", Crew.class);
        cushing.setFullName("Peter Cushing");
        cushing.addStarsInMovie(newhopeMovie);
        cushing.addPortrayals(tarkin);
        Crew mayhew = framedGraph.addVertex("Peter Mayhew", Crew.class);
        mayhew.setFullName("Peter Mayhew");
        mayhew.addStarsInMovie(newhopeMovie);
        mayhew.addStarsInMovie(empireMovie);
        mayhew.addStarsInMovie(jediMovie);
        mayhew.addStarsInMovie(revengeMovie);
        mayhew.addPortrayals(chewy);
        Crew oz = framedGraph.addVertex("Frank Oz", Crew.class);
        oz.setFullName("Frank Oz");
        oz.addStarsInMovie(empireMovie);
        oz.addStarsInMovie(jediMovie);
        oz.addStarsInMovie(phantomMovie);
        oz.addStarsInMovie(clonesMovie);
        oz.addStarsInMovie(revengeMovie);
        oz.addPortrayals(yoda);
        Crew bulloch = framedGraph.addVertex("Jeremy Bulloch", Crew.class);
        bulloch.setFullName("Jeremy Bulloch");
        bulloch.addStarsInMovie(empireMovie);
        bulloch.addStarsInMovie(jediMovie);
        bulloch.addPortrayals(boba);
        Crew revill = framedGraph.addVertex("Clive Revill", Crew.class);
        revill.setFullName("Clive Revill");
        revill.addStarsInMovie(empireMovie);
        revill.addPortrayals(palpatine);
        Crew ian = framedGraph.addVertex("Ian McDiarmid", Crew.class);
        ian.setFullName("Ian McDiarmid");
        ian.addStarsInMovie(jediMovie);
        ian.addStarsInMovie(phantomMovie);
        ian.addStarsInMovie(clonesMovie);
        ian.addStarsInMovie(revengeMovie);
        ian.addPortrayals(palpatine);
        Crew shaw = framedGraph.addVertex("Sebastian Shaw", Crew.class);
        shaw.setFullName("Sebastian Shaw");
        shaw.addStarsInMovie(jediMovie);
        shaw.addPortrayals(anakin);
        Crew liam = framedGraph.addVertex("Liam Neeson", Crew.class);
        liam.setFullName("Liam Neeson");
        liam.addStarsInMovie(phantomMovie);
        liam.addPortrayals(quigon);
        Crew portman = framedGraph.addVertex("Natalie Portman", Crew.class);
        portman.setFullName("Natalie Portman");
        portman.addStarsInMovie(phantomMovie);
        portman.addStarsInMovie(clonesMovie);
        portman.addStarsInMovie(revengeMovie);
        portman.addPortrayals(padme);
        Crew lloyd = framedGraph.addVertex("Jake Lloyd", Crew.class);
        lloyd.setFullName("Jake Lloyd");
        lloyd.addStarsInMovie(phantomMovie);
        lloyd.addPortrayals(anakin);
        Crew hayden = framedGraph.addVertex("Hayden Christensen", Crew.class);
        hayden.setFullName("Hayden Christensen");
        hayden.addStarsInMovie(clonesMovie);
        hayden.addStarsInMovie(revengeMovie);
        hayden.addPortrayals(anakin);
        Crew august = framedGraph.addVertex("Pernill August", Crew.class);
        august.setFullName("Pernill August");
        august.addStarsInMovie(phantomMovie);
        august.addStarsInMovie(clonesMovie);
        august.addPortrayals(shmi);
        Crew park = framedGraph.addVertex("Ray Park", Crew.class);
        park.setFullName("Ray Park");
        park.addStarsInMovie(phantomMovie);
        park.addPortrayals(maul);
        Crew samuel = framedGraph.addVertex("Samuel L. Jackson", Crew.class);
        samuel.setFullName("Samuel L. Jackson");
        samuel.addStarsInMovie(phantomMovie);
        samuel.addStarsInMovie(clonesMovie);
        samuel.addStarsInMovie(revengeMovie);
        samuel.addPortrayals(windu);
        Crew lee = framedGraph.addVertex("Christopher Lee", Crew.class);
        lee.setFullName("Christopher Lee");
        lee.addStarsInMovie(clonesMovie);
        lee.addStarsInMovie(revengeMovie);
        lee.addPortrayals(tyranus);
        Crew morrison = framedGraph.addVertex("Temuera Morrison", Crew.class);
        morrison.setFullName("Temuera Morrison");
        morrison.addStarsInMovie(clonesMovie);
        morrison.addPortrayals(jango);
        Crew logan = framedGraph.addVertex("Daniel Logan", Crew.class);
        logan.setFullName("Daniel Logan");
        logan.addStarsInMovie(clonesMovie);
        logan.addPortrayals(boba);
        Crew blake = framedGraph.addVertex("Paul Blake", Crew.class);
        blake.setFullName("Paul Blake");
        blake.addStarsInMovie(newhopeMovie);
        blake.addPortrayals(greedo);
        Crew lawson = framedGraph.addVertex("Denis Lawson", Crew.class);
        lawson.setFullName("Denis Lawson");
        lawson.addStarsInMovie(newhopeMovie);
        lawson.addStarsInMovie(empireMovie);
        lawson.addStarsInMovie(jediMovie);
        lawson.addPortrayals(wedge);
        Kills curKills = null;
        curKills = anakin.addKills(obiwan);
        curKills.setFilm(newhopeMovie.asVertex().getId().toString());
        curKills = luke.addKills(tarkin);
        curKills.setFilm(newhopeMovie.asVertex().getId().toString());
        curKills = windu.addKills(jango);
        curKills.setFilm(clonesMovie.asVertex().getId().toString());
        curKills = palpatine.addKills(windu);
        curKills.setFilm(revengeMovie.asVertex().getId().toString());
        curKills = wedge.addKills(anakin);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        curKills = lando.addKills(anakin);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        curKills = anakin.addKills(palpatine);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        curKills = maul.addKills(quigon);
        curKills.setFilm(phantomMovie.asVertex().getId().toString());
        curKills = obiwan.addKills(maul);
        curKills.setFilm(phantomMovie.asVertex().getId().toString());
        curKills = han.addKills(greedo);
        curKills.setFilm(newhopeMovie.asVertex().getId().toString());
        curKills = han.addKills(boba);
        curKills.setFilm(jediMovie.asVertex().getId().toString());
        curKills = anakin.addKills(tyranus);
        curKills.setFilm(revengeMovie.asVertex().getId().toString());
        anakin.addSpawns(threepio);
        anakin.addSpawns(luke);
        anakin.addSpawns(leia);
        padme.addSpawns(luke);
        padme.addSpawns(leia);
        shmi.addSpawns(anakin);
        jango.addSpawns(boba);
        graph.commit();
    } catch (Throwable t) {
        t.printStackTrace();
    }
    long testEndTime = System.nanoTime();
    System.out.println("Completed " + getClass().getSimpleName() + " run in " + ((testEndTime - testStartTime) / 1000000) + " ms");
}
Also used : DElementStore(org.openntf.domino.graph2.impl.DElementStore) DGraph(org.openntf.domino.graph2.impl.DGraph) DConfiguration(org.openntf.domino.graph2.impl.DConfiguration) DFramedGraphFactory(org.openntf.domino.graph2.impl.DFramedGraphFactory)

Example 5 with DFramedGraphFactory

use of org.openntf.domino.graph2.impl.DFramedGraphFactory in project org.openntf.domino by OpenNTF.

the class ConferenceGraph method initialize.

@SuppressWarnings({ "unchecked", "rawtypes" })
protected void initialize() {
    DElementStore attendeeStore = new DElementStore();
    attendeeStore.setStoreKey(ATTENDEE_PATH);
    attendeeStore.addType(Attendee.class);
    DElementStore groupStore = new DElementStore();
    groupStore.setStoreKey(GROUP_PATH);
    groupStore.addType(Group.class);
    groupStore.addType(Sponsor.class);
    DElementStore eventStore = new DElementStore();
    eventStore.setStoreKey(EVENT_PATH);
    eventStore.addType(Event.class);
    eventStore.addType(Presentation.class);
    eventStore.addType(Social.class);
    eventStore.addType(Meeting.class);
    eventStore.addType(Track.class);
    DElementStore inviteStore = new DElementStore();
    inviteStore.setStoreKey(INVITE_PATH);
    inviteStore.addType(Invite.class);
    DElementStore timesStore = new DElementStore();
    timesStore.setStoreKey(TIMES_PATH);
    timesStore.addType(TimeSlot.class);
    DElementStore commentStore = new DElementStore();
    commentStore.setStoreKey(COMMENTS_PATH);
    commentStore.addType(Comment.class);
    DElementStore locationStore = new DElementStore();
    locationStore.setStoreKey(LOCATION_PATH);
    locationStore.addType(Location.class);
    DElementStore socialStore = new DElementStore();
    socialStore.setStoreKey(SOCIAL_PATH);
    socialStore.addType(Likes.class);
    socialStore.addType(Rates.class);
    socialStore.addType(Mentions.class);
    DElementStore defaultStore = new DElementStore();
    defaultStore.setStoreKey(DEFAULT_PATH);
    DConfiguration config = new DConfiguration();
    DGraph graph = new DGraph(config);
    config.addElementStore(attendeeStore);
    config.addElementStore(groupStore);
    config.addElementStore(eventStore);
    config.addElementStore(inviteStore);
    config.addElementStore(timesStore);
    config.addElementStore(locationStore);
    config.addElementStore(defaultStore);
    config.setDefaultElementStore(defaultStore.getStoreKey());
    // JavaHandlerModule jhm = new JavaHandlerModule();
    // Module module = config.getModule();
    DFramedGraphFactory factory = new DFramedGraphFactory(config);
    framedGraph_ = (DFramedTransactionalGraph) factory.create(graph);
}
Also used : DElementStore(org.openntf.domino.graph2.impl.DElementStore) DGraph(org.openntf.domino.graph2.impl.DGraph) DConfiguration(org.openntf.domino.graph2.impl.DConfiguration) DFramedGraphFactory(org.openntf.domino.graph2.impl.DFramedGraphFactory)

Aggregations

DConfiguration (org.openntf.domino.graph2.impl.DConfiguration)7 DElementStore (org.openntf.domino.graph2.impl.DElementStore)7 DFramedGraphFactory (org.openntf.domino.graph2.impl.DFramedGraphFactory)7 DGraph (org.openntf.domino.graph2.impl.DGraph)7 Module (com.tinkerpop.frames.modules.Module)2 JavaHandlerModule (com.tinkerpop.frames.modules.javahandler.JavaHandlerModule)2 TypedGraphModuleBuilder (com.tinkerpop.frames.modules.typedgraph.TypedGraphModuleBuilder)2 Person (org.openntf.domino.graph2.builtin.identity.Person)2 List (java.util.List)1 Rates (org.openntf.domino.graph2.builtin.social.Rates)1 SocialStore (org.openntf.domino.graph2.builtin.social.SocialStore)1 DFramedTransactionalGraph (org.openntf.domino.graph2.impl.DFramedTransactionalGraph)1