BlogsAPI published-FOAF-parser |
Copy Source | Copy HTML- namespace BlogsAPI.Rdf
- {
- using System;
- using RssToolkit.Xml;
- using NUnit.Framework;
-
- [TestFixture]
- public class RdfUnitTest
- {
- /// <summary>
- /// Parsing FOAF data from Internet
- /// </summary>
- [Test]
- public void LoadFoaf()
- {
- Uri[] FOAFs = new[] {
- new Uri("http://www.liveinternet.ru/users/flashr/foaf/"),
- new Uri("http://community.livejournal.com/ktosomnoi/data/foaf"),
- new Uri("http://dolboeb.livejournal.com/data/foaf"),
- new Uri("http://flashr.ya.ru/foaf.xml"),
- new Uri("http://clubs.ya.ru/ya/foaf.xml"),
- new Uri("http://eikeon.com/foaf.rdf"),
- new Uri("http://madskristensen.net/foaf.axd")
- };
- foreach (Uri linkto in FOAFs)
- {
- RdfDocument rDoc = RdfDocument.Load(linkto);
- Assert.AreNotEqual(null, rDoc.Who);
- // String foafFile = rDoc.ToXml(DocumentType.Rdf);
- // Assert.AreEqual(false, String.IsNullOrEmpty(foafFile));
- }
- }
-
- /// <summary>
- /// Making FOAF file
- /// </summary>
- [Test]
- public void PublishFoaf()
- {
- RdfDocument rdf = new RdfDocument
- {
- Version = "0.9",
- Lang = "ru",
- Who = new FoafPerson
- {
- Pages = new[]
- {
- new RdfElement
- {
- Resource = "http://ya.topbot.ru/feedback.aspx",
- Description = "Flashr's contact information",
- Date = DateTime.Now.ToString("yyyy-MM-dd"),
- },
- },
- Language = "ru-RU",
- Name = "Flashr",
- Nick = "Topbot",
- About = "Робот блогосферы",
- BirthDay = "1985-10-11",
- Bio = ".Net Developer",
- City = new RdfElement
- {
- Title = "Москва",
- Resource = "http://maps.google.com/maps?f=q&source=s_q&hl=ru&geocode=&q=%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0&sll=37.0625,-95.677068&sspn=27.976484,63.544922&ie=UTF8&hq=&hnear=%D0%A0%D0%BE%D1%81%D1%81%D0%B8%D1%8F,+%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0&t=h&z=9"
- },
- //Gender = FoafGender.male,
- Weblog = new WeblogExt
- {
- Title = "My Blog",
- Resource = "http://ya.topbot.ru"
- },
- Activities = new []
- {
- new BlogActivityClass{
- data = new PostsActivity
- {
- RSS =
- "http://feeds.feedburner.com/Topbot",
- Posted = 666
- }},
- new BlogActivityClass{
- data = new CommentsActivity
- {
- Received = 11
- }
- }
- },
- Knows = new []{
- new FoafKnow
- {
- Person = new FoafPerson
- {
-
- Nick = "idiot1",
- Name = "Someone",
- Weblog = new WeblogExt
- {
- Resource = "http://idiot1.livejournal.com"
- }
- }
- },
- new FoafKnow
- {
- Person = new FoafGroup
- {
- Name = "Клуб алкоголиков",
- Nick = "alco_club",
- Weblog = new WeblogExt
- {
- Resource = "http://community.livejournal.com/alco_club"
- }
-
- }
- }
- }
- }
- };
- //
- String foafFile = rdf.ToXml(DocumentType.Rdf);
- Assert.AreEqual(false,String.IsNullOrEmpty(foafFile));
- }
- }
- }
-
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |