Haskell SKOS数据结构(语义网) [英] Haskell data structure for SKOS (semantic web)

查看:150
本文介绍了Haskell SKOS数据结构(语义网)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在为haskell编写语义Web应用程序。



使用hsparql http://hackage.haskell.org/package/hsparql 我可以访问我的Tripple商店。目前我使用 http://4store.org/ (主要是因为安装很简单)。我使用snap http://snapframework.com/ 来进行servlet编程(Yesod非常酷!)。



目前我使用SKOS代表RDF中的书签类别。



SKOS上的链接:





基本上,Skos概念是一个类别。它有一个URL(类型为ID)
和一个标签。进一步的Skos Concepts可以有一些子概念,用更广泛的
和更窄来定义。

例如,在我的书签中,SKOS的概念是所有书签,子概念
haskell书签。这两个概念都有一个URL(例如ID)和一个标签。
此外,haskell书签与更广泛的概念是所有书签有关系。

我的问题



我需要一个haskell for SKOS的数据结构。



我现在的是:

   - 输入别名。 

类型Url =字符串
类型标签=字符串


- 日期结构。

data SkosConcept = SkosConcept {
url :: Url
,label :: Label
,subConcepts :: [SkosConcept]
}派生(显示)

我认为这不是一个好方法,但我不知道更好的方法。



此外,在将来,数据结构需要扩展到多个标签,
和存储相关概念的方法,...


另外一些概念可能没有任何子概念。



任何关于如何改进数据结构或做对的指针? p>

=====编辑:======



问题是skos概念可能有多个更广泛的skos概念。
所以我的haskell书签可以有两个更广泛的skos概念(例如类别),称为编程书签和我的重要书签。

唯一的解决方案我现在可以考虑使用:




  • skos概念的更广泛关系的有向图

  • 二元关系更广泛(但我不知道是否有良好的haskell支持)
  • 没有中间数据结构,所有函数都查询RDF Tripple Store


解决方案

与其尝试直接存储双向结构,为什么不使用标准Graph方法,并存储一个包含这两个概念集合并包含概念之间关系集合的元组?

cf: http://hackage.haskell.org/package/fgl


Introduction

I am programming a semantic web application in haskell.

With hsparql http://hackage.haskell.org/package/hsparql I can access my Tripple Store. Currently I use http://4store.org/ (mainly because it was easy to install). I use snap http://snapframework.com/ to do the servlet programming (Yesod is very cool too!!).

Currently I use SKOS to represent bookmarks categories in RDF.

Links on SKOS:

Basically, a Skos Concept is a category. It has a URL (as kind of ID) and a Label. Further Skos Concepts can have sub concepts, defined with "broader" and "narrower".

For example in my bookmarks there is the SKOS concept "all bookmarks", with a sub concept "haskell bookmarks". And both concepts have a URL (e.g. as ID) and a Label. Also "haskell bookmarks" has a relation that the broader concept is "all bookmarks".

My Problem

I need a data structure in haskell for SKOS.

My current one is:

-- Type Aliases.

type Url = String
type Label = String


-- Date Structure.

data SkosConcept = SkosConcept {
      url :: Url
    , label :: Label
    , subConcepts :: [SkosConcept]
    } deriving (Show)

I think it's not a good way, but I don't know a better one.

Further, in the future the data structure needs to be extended to multiple labels, and means to store related concepts, ...

Also some concepts may not have any sub concepts.

Any pointers on how to improve the data structure or 'do it right'?

===== EDIT: ======

The problem is that a skos concept may have multiple broader skos concepts. So my "haskell bookmarks" can have two broader skos concepts (e.g. categories) named "programming bookmarks" and "my important bookmarks".

The only solutions I can think of at the moment is using:

  • a directed graph for the "broader" relation of skos concepts
  • a binary relation "broader" (but I don't know if there is good haskell support)
  • no intermediate data structures and all my functions query the RDF Tripple Store

解决方案

Rather than trying to store a bidirectional structure directly, why not use the standard Graph approach, and store a tuple containing both the set of concepts, and containing the set of relations between concepts?

cf: http://hackage.haskell.org/package/fgl

这篇关于Haskell SKOS数据结构(语义网)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆