[Fencommits] fenfire-hs: use dcterms:created for sorting
Benja Fallenstein
benja.fallenstein at gmail.com
Fri Mar 2 15:10:46 EET 2007
Fri Mar 2 15:10:25 EET 2007 Benja Fallenstein <benja.fallenstein at gmail.com>
* use dcterms:created for sorting
diff -rN -u old-fenfire-hs/Darcs2RDF.fhs new-fenfire-hs/Darcs2RDF.fhs
--- old-fenfire-hs/Darcs2RDF.fhs 2007-03-02 15:10:46.000000000 +0200
+++ new-fenfire-hs/Darcs2RDF.fhs 2007-03-02 15:10:46.000000000 +0200
@@ -28,7 +28,7 @@
(if not $ null authorName
then authorURI++" <foaf:name> "++show authorName ++ ".\n" else "") ++
authorURI++" <foaf:mbox> <mailto:"++authorMail ++ ">.\n" ++
- uri++ " <dc:date> \""++date'++ "\"^^<xsd:dateTime>.\n"
+ uri++ " <"++dc_date++"> \""++date'++ "\"^^<xsd:dateTime>.\n"
where uri = "<darcs:"++hash++">"
-- the following uses HaRP patterns
[/ (/ authorName*, ' '*, '<', authorMail*, '>' /)
@@ -40,6 +40,7 @@
day = "ex:patches:" ++ take 10 date' ++ ":" ++ repo
seeAlso = "http://www.w3.org/2000/01/rdf-schema#seeAlso"
label = "http://www.w3.org/2000/01/rdf-schema#label"
+ dc_date = "http://purl.org/dc/elements/1.1/date"
elems :: [Content] -> [Element]
elems (CElem e : cs) = e : elems cs
@@ -76,4 +77,5 @@
main = do [repo] <- getArgs
xml <- getContents
+ putStr "@prefix dc: <http://purl.org/dc/elements/1.1/>.\n"
putStr $ concatMap (triples repo) $ patches $ xmlParse "stdin" xml
diff -rN -u old-fenfire-hs/Fenfire.fhs new-fenfire-hs/Fenfire.fhs
--- old-fenfire-hs/Fenfire.fhs 2007-03-02 15:10:46.000000000 +0200
+++ new-fenfire-hs/Fenfire.fhs 2007-03-02 15:10:46.000000000 +0200
@@ -76,7 +76,8 @@
connsCache :: Cache.Cache (StableName Graph, (Node, Dir)) [Path]
connsCache = Cache.newCache 10000
-dc_date = URI "dc:date"
+dc_date = URI "http://purl.org/dc/elements/1.1/date"
+dcterms_created = URI "http://purl.org/dc/terms/created"
conns :: (?vs :: ViewSettings, ?graph :: Graph) => Node -> Dir -> [Path]
conns node dir = Cache.cached (Cache.byAddress ?graph, (node,dir))
@@ -85,8 +86,10 @@
sorted = List.sortBy cmp' list
list = [(p,n) | (p,s) <- Map.toList $ getConns ?graph node dir,
not (p `elem` hiddenProps ?vs), n <- Set.toList s]
- cmp n1 n2 | p n1 && p n2 = compare (f n1) (f n2) where
- p n = hasConn ?graph n dc_date Pos; f n = getOne ?graph n dc_date Pos
+ cmp n1 n2 | d1 <- f n1, d2 <- f n2 = compare d1 d2 where
+ f n = msum [g dc_date n, g dcterms_created n]
+ g prop n = if hasConn ?graph n prop Pos
+ then Just $ getOne ?graph n prop Pos else Nothing
cmp n1 n2 = compare (getText n1) (getText n2)
cmp' (p1,n1) (p2,n2) = catOrds (cmp p1 p2) (cmp n1 n2)
catOrds EQ o = o; catOrds o _ = o
More information about the Fencommits
mailing list