Пример #1
0
        /// <summary>
        /// Executes the referencing queries
        /// </summary>
        private static void AddReferenceGraph()
        {
            Log("Executing AddReferenceGraph()");
            Log("Connecting to Movie store...");
            var movieStore = new StardogConnector(settings.ServerIp, MoviesDbName, settings.Login, settings.Password);

            movieStore.Timeout = int.MaxValue;
            movieStore.DeleteGraph("http://imn.htwk-leipzig.de/pbachman/ontologies/references#");

            Log("Inserting film references...");
            movieStore.Query(File.ReadAllText(ReferenceFilmsQuery));

            Log("Inserting Song references...");
            movieStore.Query(File.ReadAllText(ReferenceSongsQuery));

            Log("Inserting Artists references...");
            movieStore.Query(File.ReadAllText(ReferenceArtistsQuery));

            Log("Inserting Chart song references...");
            movieStore.Query(File.ReadAllText(ReferenceChartsDe1Query));
        }
Пример #2
0
        /// <summary>
        /// Merges the graphs from IMDb, LastFM and Charts_de into a new database
        /// </summary>
        private static void MergeGraphs()
        {
            Log("Executing MergeGraphs()");
            Log("Connecting to Movie store...");
            var movieStore = new StardogConnector(settings.ServerIp, MoviesDbName, settings.Login, settings.Password);

            movieStore.Timeout = int.MaxValue;

            #region Tunefind
            Log("Connecting to Tunefind store...");
            var tuneFindStore = new StardogConnector(settings.ServerIp, TuneFindDbName, settings.Login, settings.Password);
            var tuneFindGraph = new Graph();
            tuneFindGraph.BaseUri = new Uri("http://imn.htwk-leipzig.de/pbachman/ontologies/tunefind#");
            tuneFindStore.LoadGraph(tuneFindGraph, string.Empty);

            Log("Uploading Graph...");
            movieStore.DeleteGraph("http://imn.htwk-leipzig.de/pbachman/ontologies/tunefind#");
            movieStore.SaveGraph(tuneFindGraph);
            #endregion

            #region IMDB
            Log("Connecting to IMDB store...");
            var imdbStore = new StardogConnector(settings.ServerIp, ImdbDbName, settings.Login, settings.Password);
            var imdbGraph = new Graph();
            imdbGraph.BaseUri = new Uri("http://imn.htwk-leipzig.de/pbachman/ontologies/imdb#");
            imdbStore.LoadGraph(imdbGraph, string.Empty);

            Log("Uploading Graph...");
            movieStore.DeleteGraph("http://imn.htwk-leipzig.de/pbachman/ontologies/imdb#");
            movieStore.SaveGraph(imdbGraph);
            #endregion

            #region LastFM
            Log("Connecting to LastFm store...");
            var lastFmStore = new StardogConnector(settings.ServerIp, LastFmDbName, settings.Login, settings.Password);
            var lastFmGraph = new Graph();
            lastFmGraph.BaseUri = new Uri("http://imn.htwk-leipzig.de/pbachman/ontologies/lastfm#");
            lastFmStore.LoadGraph(lastFmGraph, string.Empty);

            Log("Uploading Graph...");
            movieStore.DeleteGraph("http://imn.htwk-leipzig.de/pbachman/ontologies/lastfm#");
            movieStore.SaveGraph(lastFmGraph);
            #endregion

            #region Charts_de
            Log("Connecting to Chart_De store...");
            var chartsDeStore = new StardogConnector(settings.ServerIp, ChartsDeDbName, settings.Login, settings.Password);
            var chartsDeGraph = new Graph();
            chartsDeGraph.BaseUri = new Uri("http://imn.htwk-leipzig.de/pbachman/ontologies/charts_de#");
            chartsDeStore.LoadGraph(chartsDeGraph, string.Empty);

            Log("Uploading Graph...");
            movieStore.DeleteGraph("http://imn.htwk-leipzig.de/pbachman/ontologies/charts_de#");
            movieStore.SaveGraph(chartsDeGraph);
            #endregion

            Log("Merging Graphs...");
            var movieGraph = SetupMovieGraph();
            movieGraph.Merge(tuneFindGraph);
            movieGraph.Merge(imdbGraph);
            movieGraph.Merge(lastFmGraph);
            movieGraph.Merge(chartsDeGraph);

            Log("Writing Graph...");
            var writer = new CompressingTurtleWriter(TurtleSyntax.W3C);
            writer.Save(movieGraph, @"01_Movies.ttl");
        }