Esempio n. 1
0
        public void IdsFileLoading()
        {
            DotNetFileProvider prov = new DotNetFileProvider();
            Graph g = GraphXmlDeserializer.GetGraphInstance("ids.xml", prov, ExternalRessourcesLoadingPolicy.None);

            Assert.IsNotNull(g);
        }
Esempio n. 2
0
        public void QueryGraph()
        {
            Graph idsGraph = GraphXmlDeserializer.GetGraphInstance(absoluteIdsFilePath, new FileLoader(), ExternalRessourcesLoadingPolicy.None);

            Assert.IsNotNull(idsGraph);

            SQLiteConnection connection = GetSqliteConnection();

            Assert.IsNotNull(connection);

            OrientedBinaryGraphToDatabaseConverter <SQLiteCommand> converter = new OrientedBinaryGraphToDatabaseConverter <SQLiteCommand>(connection);

            Assert.IsNotNull(converter);
            converter.CreateDatabase();
            converter.PopulateDatabase(idsGraph);

            connection.Open();
            IGraph sqlGraph = new SqlGraph <SQLiteCommand>(new DbProvider <SQLiteCommand>(connection,
                                                                                          new SqliteVertexStoreRawSqlProvider(), new SqliteEdgeStoreRawSqlProvider()));

            Assert.IsNotNull(sqlGraph);

            IEnumerable <IVertex> result = sqlGraph.SearchNode("", "乃");

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count());

            IVertex v = result.First();

            Assert.AreEqual(103, v.GetLinkedObjects().Count);
        }
Esempio n. 3
0
        public void EditableVertexLoadingTest()
        {
            Graph g = GraphXmlDeserializer.GetGraphInstance("annotations_test.xml", new DotNetFileProvider(), typeof(EditableVertex));

            Assert.IsNotNull(g);

            var search = g.SearchNode("", "avion");

            Assert.IsNotNull(search);
            IVertex v = search[0];
        }
Esempio n. 4
0
        // Use the debugguer to inspect object
        public static void Main_3(string[] args)
        {
            Graph graph = CreateGraph();
            GraphXmlSerializer serializer = new GraphXmlSerializer();
            XDocument          xdoc       = serializer.Serialize(graph);

            xdoc.Save("graph.xml");

            graph = null;

            graph = GraphXmlDeserializer.GetGraphInstance("graph.xml", new FileLoader());
        }
        public void ExtensibleSerializationDeserializationAsGraph()
        {
            ExtensibleXmlGraphSerializer ser = new ExtensibleXmlGraphSerializer();
            Graph g = GetTestGraph();

            XDocument doc  = ser.Serialize(g);
            string    path = Path.GetTempFileName();

            doc.Save(path);

            Assert.IsTrue(File.Exists(path));

            g = GraphXmlDeserializer.GetGraphInstance(path, new FileLoader());
            Assert.IsNotNull(g);
        }
Esempio n. 6
0
        public void CreateSqliteCreateHyperGraphDatabase()
        {
            Graph n1Graph = GraphXmlDeserializer.GetGraphInstance(absoluteN1FilePath, new FileLoader(), ExternalRessourcesLoadingPolicy.None);

            Assert.IsNotNull(n1Graph);

            SQLiteConnection connection = GetSqliteConnection();

            Assert.IsNotNull(connection);

            GeneralHyperGraphDatabaseConverter <SQLiteCommand> converter = new GeneralHyperGraphDatabaseConverter <SQLiteCommand>(connection);

            Assert.IsNotNull(converter);

            converter.CreateDatabase();
        }
Esempio n. 7
0
        public void CreateSqliteCreateOrientedBinaryGraphDatabase()
        {
            Graph idsGraph = GraphXmlDeserializer.GetGraphInstance(absoluteIdsFilePath, new FileLoader(), ExternalRessourcesLoadingPolicy.None);

            Assert.IsNotNull(idsGraph);

            SQLiteConnection connection = GetSqliteConnection();

            Assert.IsNotNull(connection);

            OrientedBinaryGraphToDatabaseConverter <SQLiteCommand> converter = new OrientedBinaryGraphToDatabaseConverter <SQLiteCommand>(connection);

            Assert.IsNotNull(converter);

            converter.CreateDatabase();
            converter.PopulateDatabase(idsGraph);
        }
Esempio n. 8
0
        public void NodeExternalAnnotationTest()
        {
            Graph g = GraphXmlDeserializer.GetGraphInstance("annotations_test.xml", new DotNetFileProvider(), ExternalRessourcesLoadingPolicy.None);

            Assert.IsNotNull(g);

            var search = g.SearchNode("", "porter");

            Assert.IsNotNull(search);
            IVertex v = search[0];

            var annotations = g.GetAnnotations(v);

            Assert.AreEqual <int>(1, annotations.Count);
            Assert.AreEqual <string>("", annotations[0].Namespace);
            Assert.AreEqual <string>("pos", annotations[0].Key);
            Assert.AreEqual <string>("verbe", annotations[0].Value);
        }
        public static Trie GetTrieInstance(string resourcePath, IFileProvider fileProvider)
        {
            Graph g = GraphXmlDeserializer.GetGraphInstance(resourcePath, fileProvider, ExternalRessourcesLoadingPolicy.None);

            return(new Trie(g));
        }