Examples of Subgraph


Examples of org.jboss.dna.graph.Subgraph

             * {@inheritDoc}
             *
             * @see org.jboss.dna.graph.connector.RepositoryContext#getConfiguration(int)
             */
            public Subgraph getConfiguration( int depth ) {
                Subgraph result = null;
                RepositorySource configSource = getConfigurationSource();
                if (configSource != null) {
                    Graph config = Graph.create(configSource, getExecutionContext());
                    String workspaceName = getConfigurationWorkspaceName();
                    if (workspaceName != null) {
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

            List<MimeTypeDetectorConfig> detectors = new ArrayList<MimeTypeDetectorConfig>();
            Graph graph = Graph.create(configurationRepository.getRepositorySource(), context);
            Path pathToSequencersNode = context.getValueFactories().getPathFactory().create(configurationRepository.getPath(),
                                                                                            DnaLexicon.MIME_TYPE_DETECTORS);
            try {
                Subgraph subgraph = graph.getSubgraphOfDepth(2).at(pathToSequencersNode);

                Set<Name> skipProperties = new HashSet<Name>();
                skipProperties.add(DnaLexicon.READABLE_NAME);
                skipProperties.add(DnaLexicon.DESCRIPTION);
                skipProperties.add(DnaLexicon.CLASSNAME);
                skipProperties.add(DnaLexicon.CLASSPATH);
                skipProperties.add(DnaLexicon.PATH_EXPRESSION);
                Set<String> skipNamespaces = new HashSet<String>();
                skipNamespaces.add(JcrLexicon.Namespace.URI);
                skipNamespaces.add(JcrNtLexicon.Namespace.URI);
                skipNamespaces.add(JcrMixLexicon.Namespace.URI);

                for (Location detectorLocation : subgraph.getRoot().getChildren()) {
                    Node node = subgraph.getNode(detectorLocation);
                    String name = stringValueOf(node, DnaLexicon.READABLE_NAME);
                    if (name == null) name = stringValueOf(node);
                    String desc = stringValueOf(node, DnaLexicon.DESCRIPTION);
                    String classname = stringValueOf(node, DnaLexicon.CLASSNAME);
                    String[] classpath = stringValuesOf(node, DnaLexicon.CLASSPATH);
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

            List<SequencerConfig> configs = new ArrayList<SequencerConfig>();
            Graph graph = Graph.create(configurationRepository.getRepositorySource(), context);
            Path pathToSequencersNode = context.getValueFactories().getPathFactory().create(configurationRepository.getPath(),
                                                                                            DnaLexicon.SEQUENCERS);
            try {
                Subgraph subgraph = graph.getSubgraphOfDepth(2).at(pathToSequencersNode);

                Set<Name> skipProperties = new HashSet<Name>();
                skipProperties.add(DnaLexicon.READABLE_NAME);
                skipProperties.add(DnaLexicon.DESCRIPTION);
                skipProperties.add(DnaLexicon.CLASSNAME);
                skipProperties.add(DnaLexicon.CLASSPATH);
                skipProperties.add(DnaLexicon.PATH_EXPRESSION);
                Set<String> skipNamespaces = new HashSet<String>();
                skipNamespaces.add(JcrLexicon.Namespace.URI);
                skipNamespaces.add(JcrNtLexicon.Namespace.URI);
                skipNamespaces.add(JcrMixLexicon.Namespace.URI);

                for (Location sequencerLocation : subgraph.getRoot().getChildren()) {
                    Node sequencerNode = subgraph.getNode(sequencerLocation);
                    String name = stringValueOf(sequencerNode, DnaLexicon.READABLE_NAME);
                    if (name == null) name = stringValueOf(sequencerNode);
                    String desc = stringValueOf(sequencerNode, DnaLexicon.DESCRIPTION);
                    String classname = stringValueOf(sequencerNode, DnaLexicon.CLASSNAME);
                    String[] classpath = stringValuesOf(sequencerNode, DnaLexicon.CLASSPATH);
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

                                                                                         DnaLexicon.SOURCES);
            try {
                String workspaceName = getConfigurationWorkspaceName();
                if (workspaceName != null) graph.useWorkspace(workspaceName);

                Subgraph sourcesGraph = graph.getSubgraphOfDepth(3).at(pathToSourcesNode);

                // Iterate over each of the children, and create the RepositorySource ...
                for (Location location : sourcesGraph.getRoot().getChildren()) {
                    Node sourceNode = sourcesGraph.getNode(location);
                    sources.addSource(createRepositorySource(location.getPath(), sourceNode.getPropertiesByName(), problems));
                }
            } catch (PathNotFoundException e) {
                // No sources were found, and this is okay!
            } catch (Throwable err) {
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

        }
    }

    @Test
    public void shouldReadSubgraphStartingAtRootAndWithMaximumDepthOfThree() {
        Subgraph subgraph = graph.getSubgraphOfDepth(3).at("/");
        assertThat(subgraph, is(notNullValue()));

        // Verify that the root node is the same as getting it directly ...
        Node root = subgraph.getRoot();
        assertSameNode(root, graph.getNodeAt("/"));

        // Verify the first-level children ...
        List<Location> children = graph.getChildren().of("/");
        assertThat(children, is(notNullValue()));
        for (Location childLocation : children) {
            // Verify the child in the subgraph matches the same node obtained directly from the graph ...
            Node child = subgraph.getNode(childLocation);
            assertSameNode(child, graph.getNodeAt(childLocation));

            // Now get the second-level children ...
            List<Location> grandChildren = graph.getChildren().of(childLocation);
            assertThat(grandChildren, is(notNullValue()));
            for (Location grandchildLocation : grandChildren) {
                // Verify the grandchild in the subgraph matches the same node obtained directly from the graph ...
                Node grandchild = subgraph.getNode(grandchildLocation);
                assertSameNode(grandchild, graph.getNodeAt(grandchildLocation));

                // The subgraph should contain the children locations and properties for the grandchildren.
                // However, the subgraph should not a node for the children of the grandchildren ...
                for (Location greatGrandchild : grandchild.getChildren()) {
                    assertThat(subgraph.getNode(greatGrandchild), is(nullValue()));
                }
            }
        }
    }
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

    @Test
    public void shouldReturnSameStructureForRepeatedReadBranchRequests() {
        // Verify that the content doesn't change
        Location root = graph.getCurrentWorkspace().getRoot();
        Subgraph subgraph1 = graph.getSubgraphOfDepth(10).at(root);
        for (int i = 0; i != 4; ++i) {
            Subgraph subgraph2 = graph.getSubgraphOfDepth(10).at(root);
            assertEquivalentSubgraphs(subgraph1, subgraph2, true, true);
        }
    }
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

            assertThat(fedProp, is(sourceProp));
        }

        // Try reading a subgraph of depth 2 ...
        FEDERATED_TIMER.start();
        Subgraph fedSubgraph = federated.getSubgraphOfDepth(2).at(pathInFederated);
        FEDERATED_TIMER.stop();
        SOURCE_TIMER.start();
        Subgraph sourceSubgraph = graphFor(sourceName, workspaceName).getSubgraphOfDepth(2).at(pathInSource);
        SOURCE_TIMER.stop();
        if (extraChildren.length == 0) {
            // Can only compare the graphs when there are no extra children ...
            AbstractConnectorTest.assertEquivalentSubgraphs(fedSubgraph, sourceSubgraph, true, false);
        }
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

                public Observer getObserver() {
                    return null; // no observers here
                }

                public Subgraph getConfiguration( int depth ) {
                    Subgraph result = null;
                    if (configSource != null) {
                        Graph config = Graph.create(configSource, getExecutionContext());
                        config.useWorkspace(null); // default workspace
                        result = config.getSubgraphOfDepth(depth).at(source.getName());
                    }
View Full Code Here

Examples of org.neo4j.cypher.export.SubGraph

    }

    //Creates the cyper representation for this database
    StringWriter out = new StringWriter();
    try ( Transaction tx = db.beginTx() ) {
      final SubGraph graph = DatabaseSubGraph.from( db );
      new SubGraphExporter( graph ).export( new PrintWriter( out ) );
      tx.success();
    }
    return out.toString();
  }
View Full Code Here

Examples of org.neo4j.geoff.Subgraph

        }
        return result;
    }

    public Map<String,PropertyContainer> mergeGeoff(final String geoff) throws SubgraphError, SyntaxError {
        final Subgraph subgraph = new Subgraph(geoff.replaceAll("\\s*;\\s*", "\n"));
        registerProperties(subgraph);
        return Geoff.mergeIntoNeo4j(subgraph, gdb, geoffNodeParams());
    }
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.