RDF 与 C# 集成

发布于 2024-07-28 00:04:54 字数 885 浏览 8 评论 0原文

我正在开发一个项目,要求我进行语义搜索。 该场景是一个数据库,其中包含 3 条信息的表:医生姓名、患者姓名和就诊日期。 我被要求创建一个包含 3 个字段的表单:医生、患者和日期。 因此,当用户想要搜索患者对应的医生或对应患者或其日期的医生时,他们只需输入任何字段即可从数据库中检索信息。 我使用正则表达式在 C# 中进行了字符串操作和信息检索的编码。 但主要任务是搜索应该使用 RDF 和 URI 进行。

现在我已经完成了大部分编码工作,有人可以帮助我如何使用 RDF 和 URI 创建搜索吗?有没有解决方案,我如何在 C# 中集成 RDF,是否有任何文档。

但根据我的主管的要求,他要求我建立一个与 RDF 一起使用的搜索,我的意思是患者的详细信息(例如患者姓名)、医生的姓名和日期将采用 URI 的形式,用于查找患者、医生的详细信息以及数据库中的日期信息,因此如果有人尝试搜索医生或患者等任何信息,只需在相应字段中输入他们的姓名即可检索信息。 我附上了我的代码的 2 个快照以便您理解。

图片1:http://img29.imageshack.us/i/15035706.jpg
图片2: http://img31.imageshack.us/img31/1117/86105845.jpg

第一张图片是我将所有详细信息输入数据库的位置,第二张图片是搜索。

这是我的项目的总体思路,你能建议我如何做到这一点吗?

如果有人能尽快帮助我,我将非常感激。

I'm working on a project where i had been asked to do a semantic search. The scenario is a database with a table containing 3 pieces of information, Doctor Name, Patient Name, and Date of Visit. I had been asked to create a form that contains 3 fields: Doctor, Patient and Date. So when a user wants to search for a patient's corresponding doctor or doctors for corresponding patients or their dates, they can just enter any of the fields to retrieve information form the database. I had done the coding in C# using Regular Expressions for string manipulation and information retrieval. But the main task is that the search should work using RDF and URI.

Now that I had worked on most part of the coding can someone help me how to create the search using RDF and URI, is there any solution for this, how can I integrate RDF in C#, is there any documentation.

But as per my supervisor's requirements he had asked me to build a search that works with RDF, I mean the details of patients (e.g. Patient's Name), Doctor's Name and Date would be in a form of URI which locates the details of patients, doctors and date information in the database so if anyone is trying to search for any information like doctor or patient can just enter their name in the corresponding field and retrieve the information. I'm attaching 2 snapshots of my code for your understanding.

Image 1: http://img29.imageshack.us/i/15035706.jpg
Image 2: http://img31.imageshack.us/img31/1117/86105845.jpg

The first image is where I enter all the details to the database and the second image is the search.

This is the overall idea about my project, can you advice me how this can be done?

I would be really grateful to you if someone could help me on this as soon as possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

与风相奔跑 2024-08-04 00:04:56

RDF 的 AC# 库似乎在 LinqToRDF 社区中变得非常流行。 该项目由 Andrew Matthews 发起,我认为自 2007 年以来一直在进行。 该软件已在 Google COde 上发布,可以在此处找到:

LinkToRDF

与库一起,还有一个名为“LinqToRDF 设计器”的东西,它适合 Visual Studio,并允许您以图形方式对 RDF 进行建模。

A C# library for RDF which seems to be becoming quite popular in the community of LinqToRDF. The project was originated by Andrew Matthews and has been going since 2007b I think. The software is up on Google COde and can be found here:

LinkToRDF

Together with the library, there's also something called "LinqToRDF designer" which fits into Visual Studio and allows you model RDF graphically.

明媚殇 2024-08-04 00:04:55

执行基于 RDF 和 URI 的搜索首先取决于您的数据是否位于 RDF 中。 如果不是,您必须将其从当前形式即时或永久转换为 RDF。 要即时执行此操作,您可以使用 D2R 等技术,它将关系数据库映射到 RDF http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/

还有一些其他的语义 Web C# 内容,例如 Rowlex http://rowlex.nc3a.nato.int/ 更基于 OWL 或者有我自己的 dotNetRDF 库 http://www.dotnetrdf.org 但这只是第一个 Alpha 版本,所以我还不会推荐它用于任何生产系统。 Alex 提到的 SemWeb 非常好,并且扩展性特别好 - 唯一的缺点是它是 .Net 2.0,所以如果你想用它做 LINQ,你需要一个单独的库

关于你的问题的问题...

你的问题不清楚您所说的语义搜索是什么意思,您确定您确实打算进行 RDF 搜索,还是有人只是在规范中指定了“语义搜索”,而您在 google 上搜索并找到了有关 RDF 的文章? 语义搜索并不一定意味着需要 RDF,它可能是您实际上想要进行自然语言搜索。

我的意思是,您可能希望能够搜索“史密斯医生的患者”之类的内容,并且您的搜索引擎应该能够将其解释为搜索医生字段对应于史密斯医生的患者。

同样,我也可能是错的,您确实可能正在尝试构建一些听起来非常像 TimBL 在 2001 年《科学美国人》语义网文章中的示例的东西。

编辑

因此,当您确实想要进行正确的 RDF 搜索时,我建议您将数据放入 Triple Store 而不是数据库中,并且最好使用提供 SPARQL 查询的 Triple Store,以便您可以将将查询表单上的输入输入到 SPARQL 查询中,并用它来查询 Triple 存储。

也许看看 Talis http://www.talis.com 或 Virtuoso http://www.openlinksw.com/virtuoso/

如果您决定使用 SemWeb,那么您可以使用它所提供的 Triple Store提供。

Doing an RDF and URI based search is going to be dependent on whether your data is in RDF in the first place. If it's not you've either got to convert it from its current form into RDF on the fly or permanently. To do it on the fly you could use a technology like D2R which maps relational databases to RDF http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/

There's some other Semantic Web C# stuff about like Rowlex http://rowlex.nc3a.nato.int/ which is more OWL based or there's my own dotNetRDF library http://www.dotnetrdf.org but that's only just about to be a first Alpha release so I wouldn't recommend it for any production systems yet. SemWeb as Alex mentions is pretty good and scales particularly well - only disadvantage is that it's .Net 2.0 so you need a separate library if you want to do LINQ with it

A question about your question...

Your question is unclear about what you mean by semantic search, are you sure you're actually meaning to do an RDF search or did someone just specify "semantic search" in the spec and you googled it and got articles about RDF? Semantic search doesn't necessarily imply a need for RDF, it could be that you actually want to do natural language search.

By this I mean that it could be that you want the ability to search for things like "patients of Dr Smith" and that your search engine should be able to interpret this as a search for patients where the doctor field corresponds to Dr Smith.

Equally I could be wrong and you could indeed be attempting to build something that sounds very like TimBL's example from his 2001 Scientific American article on the Semantic Web.

Edit

So as you do want to do proper RDF search then I would advise that you put your data into a Triple Store rather than a database and preferably use a Triple Store that provides SPARQL query so you can convert the inputs on your query form into a SPARQL query and query the Triple store with that.

Maybe take a look at Talis http://www.talis.com or Virtuoso http://www.openlinksw.com/virtuoso/

If you decide to use SemWeb then you could just use the Triple Store that it provides.

乜一 2024-08-04 00:04:55

您也许可以使用 LinqToRdf 执行您需要的操作。 LinqToRdf 公开了两个 LINQ 查询提供程序(即您需要 .NET 3.5+),其中一个提供程序符合标准 SPARQL 查询。

这是一个典型的 LinqToRdf 查询,如果您熟悉 LINQ to SQL,那么它应该是完全自然的:

MusicDataContext ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx");
var q = (from t in ctx.Tracks
     where t.Year == "2006" &&
           t.GenreName == "History 5 | Fall 2006 | UC Berkeley"
     orderby t.FileLocation
     select new {t.Title, t.FileLocation}).Skip(10).Take(5);

foreach (var track in q)
{
   Console.WriteLine(track.Title + ": " + track.FileLocation);
} 

You may be able to do what you need using LinqToRdf. LinqToRdf exposes two LINQ query providers (i.e. you will need .NET 3.5+) including one that produces standards compliant SPARQL queries.

Here's a typical LinqToRdf Query, which if you're familiar with LINQ to SQL, should be totally natural:

MusicDataContext ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx");
var q = (from t in ctx.Tracks
     where t.Year == "2006" &&
           t.GenreName == "History 5 | Fall 2006 | UC Berkeley"
     orderby t.FileLocation
     select new {t.Title, t.FileLocation}).Skip(10).Take(5);

foreach (var track in q)
{
   Console.WriteLine(track.Title + ": " + track.FileLocation);
} 
沫尐诺 2024-08-04 00:04:55

我建议您尝试RDFSharp (http://rdfsharp.codeplex.com/)因为,据我从您的问题中了解到,您可能需要快速设置一个 RDF 应用程序,该应用程序能够执行基于三元组的基本搜索,例如 SUBJECT="xxx";PREDICATE=NULL;OBJECT="yyy"。
随意尝试一下,当然还有更强大的工具,但对于您的场景,我相信它是最简单的应用。

I suggest you try RDFSharp (http://rdfsharp.codeplex.com/) because, as far as I can understand from your question, you probably need to quickly setup an RDF application capable of performing elementary triple-based searches like SUBJECT="xxx";PREDICATE=NULL;OBJECT="yyy".
Feel free to try it, of course there exist more powerful tools but for your scenario I believe it is the most simple to apply.

尸血腥色 2024-08-04 00:04:55

对于您所描述的场景使用语义网络技术是多余的。 但是,如果您对用于在 .NET 和 SQL 中使用语义 Web 标准的成熟 .NET 库感兴趣,请务必查看 Intellidimension 的产品

Using semantic web technologies for the scenario you describe is overkill. However, if you are interested in a mature .NET library for working with Semantic Web standards in .NET and SQL definitely take a look at Intellidimension's offerings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文