当前位置: 首页>>代码示例>>C#>>正文


C# Person.AddListOfExternalEntitie方法代码示例

本文整理汇总了C#中Person.AddListOfExternalEntitie方法的典型用法代码示例。如果您正苦于以下问题:C# Person.AddListOfExternalEntitie方法的具体用法?C# Person.AddListOfExternalEntitie怎么用?C# Person.AddListOfExternalEntitie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Person的用法示例。


在下文中一共展示了Person.AddListOfExternalEntitie方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPerson

        /// <summary>
        /// Gets all information avalible for the person with the given URI
        /// </summary>
        /// <param name="librisId">Unique URI from Libris</param>
        /// <returns>a Person object filld with data from Libris</returns>
        public Person GetPerson(String librisId)
        {
            SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri(URI));
            SparqlResultSet results = endpoint.QueryWithResultSet(
                " PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
                " PREFIX date: <http://dbpedia.org/property/> " +
                " PREFIX links: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
                " select ?name ?birth ?death ?links where{<" +
                    librisId + "> foaf:name ?name." +
                    "OPTIONAL {<" +
                    librisId + "> date:birthYear ?birth." +
                    "}OPTIONAL {<" +
                     librisId + "> date:deathYear ?death." +
                    " }}");

            Person person = new Person();
            foreach (SparqlResult result in results)
            {
                if (result.Value("name") != null)
                {
                    person.Name = result.Value("name").ToString();
                }
                if (result.Value("birth") != null)
                {
                    person.BirthYear = result.Value("birth").ToString();
                }
                if (result.Value("death") != null)
                {
                    person.DeathYear = result.Value("death").ToString();
                }

            }
            person.URI = librisId;
            person.AddListOfExternalEntitie(GetListOfBooksAbout(librisId));
            person.AddListOfExternalEntitie(GetListOfBooksBy(librisId));
            return person;
        }
开发者ID:RasmusEnekvist,项目名称:DoTheyMatch,代码行数:42,代码来源:LibrisSPARQLHandler.cs

示例2: GetPersonByURI

        /// <summary>
        /// Gets information about a person given the URI
        /// </summary>
        /// <param name="uri">The Unique URI for a person</param>
        /// <returns>a person object with data added</returns>
        public Person GetPersonByURI(String uri)
        {
            Person person = new Person();
            //Endast för test Gunnar Asplund  person.URI = "http://kulturarvsdata.se/raa/bbrp/21600000003542";
            SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri(URI));
            SparqlResultSet results = endpoint.QueryWithResultSet(
                "prefix ksamsok: <http://kulturarvsdata.se/ksamsok#>" +
                "prefix wiki: <http://kulturarvsdata.se/ugc#>" +
                "PREFIX foaf:   <http://xmlns.com/foaf/0.1/>" +
                "select  ?name ?wikiLink ?image ?born ?death" +
                "where{" +
                "<" + uri + "> foaf:fullName ?name." +
                "optional{<" + uri + "> wiki:sameAsWikipedia ?wikiLink}" +
                "optional{<" + uri + "> ksamsok:isVisualizedBy ?image}" +
                "}");
            person.URI = uri;

            foreach (SparqlResult result in results)
            {
                if (result.Value("name") != null)
                {
                    person.Name = result.Value("name").ToString();
                }
                if (result.Value("wikiLink") != null)
                {
                    person.WikipediaLink = result.Value("wikiLink").ToString();
                }
                if (result.Value("image") != null)
                {
                    person.SetImageUrl(result.Value("image").ToString());
                }
                person = GetBirthAndDeathYear(person);
            }
            person.AddListOfExternalEntitie(GetListOfHouses(person.URI));

            return person;
        }
开发者ID:RasmusEnekvist,项目名称:DoTheyMatch,代码行数:42,代码来源:RAASPARQLHandler.cs

示例3: GetPersons

        /// <summary>
        /// Gets a list of person objects where the name matches the param
        /// </summary>
        /// <param name="fullName">Name of the person</param>
        /// <returns>A list with all persons with the given name</returns>
        public List<Person> GetPersons(String fullName)
        {
            SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri(URI));
            SparqlResultSet results = endpoint.QueryWithResultSet(
                "PREFIX date: <http://dbpedia.org/property/> " +
                "PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
                "select ?a ?birth ?death where{" +
                    "?a foaf:name" + "'" + fullName + "'" + ". " +
                    "OPTIONAL {" +
                    "?a date:birthYear ?birth." +
                    "}OPTIONAL {" +
                    "?a date:deathYear ?death." +
                    "}}");

            List<Person> listOfPersons = new List<Person>();
            foreach (SparqlResult result in results)
            {
                Person person = new Person { Name = fullName };
                if (result.Value("a") != null)
                {
                    person.URI = result.Value("a").ToString();
                }
                if (result.Value("birth") != null)
                {
                    person.BirthYear = result.Value("birth").ToString();
                }
                if (result.Value("death") != null)
                {
                    person.DeathYear = result.Value("death").ToString();
                }

                person.AddListOfExternalEntitie(GetListOfBooksAbout(person.URI));
                person.AddListOfExternalEntitie(GetListOfBooksBy(person.URI));
                listOfPersons.Add(person);
            }
            return listOfPersons;
        }
开发者ID:RasmusEnekvist,项目名称:DoTheyMatch,代码行数:42,代码来源:LibrisSPARQLHandler.cs


注:本文中的Person.AddListOfExternalEntitie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。