Ejemplo n.º 1
0
 internal static TvShow CreateNewTvShow()
 {
     TvShow tvShow = new TvShow();
      tvShow.airTime = "12";
      tvShow.favorites = 1;
      tvShow.firstAired = new DateTime(2010, 12, 1, 10, 10, 10).ToString("u");
      tvShow.genres = new List<string>();
      tvShow.genres.Add("Thriller");
      tvShow.genres.Add("Comedy");
      tvShow.hasTranslators = true;
      tvShow.id = 1;
      tvShow.IsValid = true;
      tvShow.lastAired = new DateTime(2010, 12, 1, 10, 10, 10).ToString("u");
      tvShow.network = "CBS";
      tvShow.nextEpisode = new DateTime(2010, 12, 1, 10, 10, 10).ToString("u");
      tvShow.numberOfEpisodes = 10;
      tvShow.runTime = 45;
      tvShow.score = "5.5";
      tvShow.season = "1";
      tvShow.showLink = "http://myshow";
      tvShow.showStatus = "Running";
      tvShow.status = "Running";
      tvShow.summary = "The brown fox jumps over the lazy dog";
      tvShow.showName = "My Show";
      tvShow.tvDbId = 12;
      return tvShow;
 }
Ejemplo n.º 2
0
        public virtual bool TryReadShow(string showName, out TvShow show)
        {
            string sparqlQuery = string.Format("PREFIX tv: <http://www.semanticarchitecture.net/tv#> SELECT * WHERE {{?s tv:Name \"{0}\"}}", showName);
             Object results = tripleStore.ExecuteQuery(sparqlQuery);
             if (results is SparqlResultSet)
             {

             }
             show = null;
             return true;
        }
        public virtual string Convert(TvShow show)
        {
            StringBuilder rdfString = new StringBuilder();
             using (StringWriter stringWriter = new StringWriter(rdfString))
             {
            using (XmlWriter textWriter = XmlWriter.Create(stringWriter, CreateXmlWriteSettings()))
            {
               textWriter.WriteProcessingInstruction("xml", "version=\"1.0\"");
               textWriter.WriteStartElement("rdf", "RDF", W3CRdfNameSpace);
               textWriter.WriteAttributeString("xmlns", "rdf", null, W3CRdfNameSpace);
               textWriter.WriteAttributeString("xmlns", "tv", null, TvShowNameSpace);
               textWriter.WriteStartElement("tv", "Show", TvShowNameSpace);
               string showUri = string.Format("http://www.semanticarchitecture.net/TvShow.rdf@TvShow{0}", show.id);
               textWriter.WriteAttributeString("rdf", "about", null, showUri);

               WriteTvElement(textWriter, "AirTime", show.airTime);
               WriteTvElement(textWriter, "Favorites", show.favorites.ToString());
               WriteTvElement(textWriter, "FirstAired", show.firstAired);

               WriteTvShowGenres(textWriter, show);

               WriteTvElement(textWriter, "HasTranslators", show.hasTranslators.ToString());
               WriteTvElement(textWriter, "Id", show.id.ToString());
               WriteTvElement(textWriter, "IsValid", show.IsValid.ToString());
               WriteTvElement(textWriter, "LastAired", show.lastAired);
               WriteTvElement(textWriter, "Network", show.network);
               WriteTvElement(textWriter, "NextEpisode", show.nextEpisode);
               WriteTvElement(textWriter, "NumberOfEpisodes", show.numberOfEpisodes.ToString());
               WriteTvElement(textWriter, "Runtime", show.runTime.ToString());
               WriteTvElement(textWriter, "Score", show.score);
               WriteTvElement(textWriter, "Season", show.season);
               WriteTvElement(textWriter, "Link", show.showLink);
               WriteTvElement(textWriter, "ShowStatus", show.showStatus);
               WriteTvElement(textWriter, "Status", show.status);
               WriteTvElement(textWriter, "Summary", show.summary);
               WriteTvElement(textWriter, "Name", show.showName);
               WriteTvElement(textWriter, "TvDbId", show.tvDbId.ToString());

               textWriter.WriteEndElement();

               textWriter.WriteEndElement();
               textWriter.Flush();
               return rdfString.ToString();
            }
             }
        }
Ejemplo n.º 4
0
 private static TvShow CreateTvShowToStore()
 {
     TvShow tvShow = new TvShow();
      tvShow.showName = ShowName;
      return tvShow;
 }
Ejemplo n.º 5
0
 public virtual void Store(TvShow tvShow)
 {
     Graph graph = new Graph();
      StringParser.Parse(graph, tvShowRdfXmlConverter.Convert(tvShow));
      tripleStore.Add(graph);
 }