我正在尝试从w3c规范到Haskell类型系统。作为Haskell的新手,我有点卡住了。有人能帮忙吗?
我有一个名为Atom
的数据类型,其定义为
data Atom = Atom {
atomValue :: String
, atomType :: String
, atomDataType :: Maybe String
, atomLanguage :: Maybe String
} deriving (Show)
我希望IRI类型在Atom
中强制atomType = "iri"
,在atomType = "bnode"
中强制bnode
,等等
An RDF triple consists of three components:
the subject, which is an IRI or a blank node
the predicate, which is an IRI
the object, which is an IRI, a literal or a blank node
An RDF triple is conventionally written in the order subject, predicate, object.
The set of nodes of an RDF graph is the set of subjects and objects of triples in the graph. It is possible for a predicate IRI to also occur as a node in the same graph.
IRIs, literals and blank nodes are collectively known as RDF terms.
1条答案
按热度按时间pftdvrlh1#
我对w3规范没有任何概念,但是阅读定义,initial 方法将是
通常,使用
String
存储类型是一个坏主意,因为您不会从类型系统中获得任何好处。