Print.hs revision 8dd62da91d8ac7cfa80cfaff34dc87bb4c2c855b
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann{- |
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannModule : $Header$
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannCopyright : (c) Felix Gabriel Mance
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannLicense : GPLv2 or higher, see LICENSE.txt
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannMaintainer : f.mance@jacobs-university.de
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannStability : provisional
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannPortability : portable
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannPrinter for N-triples
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann-}
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannmodule RDF.Print where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport OWL2.Print ()
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport Common.AS_Annotation
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport Common.Doc
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport Common.DocUtils
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport RDF.AS
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport RDF.Symbols
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport RDF.Sign
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannimport RDF.Morphism
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann-- | RDF signature printing
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintRDFBasicTheory :: (Sign, [Named Axiom]) -> Doc
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintRDFBasicTheory (_, l) = vsep (map (pretty . sentence) l)
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty Sign where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann pretty = printSign
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintSign :: Sign -> Doc
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintSign s = pretty (subjects s) <+> pretty (predicates s)
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann <+> pretty (objects s)
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty Axiom where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann pretty = printAxiom
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintAxiom :: Axiom -> Doc
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintAxiom (Axiom sub pre obj)
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann = pretty sub <+> pretty pre <+> printObject obj <+> text "."
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintObject :: Object -> Doc
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintObject obj = case obj of
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann Left iri -> pretty iri
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann Right lit -> pretty lit
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty RDFGraph where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann pretty = printGraph
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintGraph :: RDFGraph -> Doc
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannprintGraph (RDFGraph sl) = vcat $ map pretty sl
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty SymbItems where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty SymbMapItems where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty RDFMorphism where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty RDFEntity where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmanninstance Pretty RawSymb where
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann