-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A semantic web toolkit.
--   
--   Swish is a framework, written in the purely functional programming
--   language Haskell, for performing deductions in RDF data using a
--   variety of techniques. Swish is conceived as a toolkit for
--   experimenting with RDF inference, and for implementing stand-alone RDF
--   file processors (usable in similar style to CWM, but with a view to
--   being extensible in declarative style through added Haskell function
--   and data value declarations). It explores Haskell as "a scripting
--   language for the Semantic Web".
--   
--   Swish is a work-in-progress, and currently incorporates:
--   
--   
--   
- Turtle, Notation3 and NTriples input and output. The N3 support is
--   incomplete (no handling of @forAll).
--   
- RDF graph isomorphism testing and merging.
--   
- Display of differences between RDF graphs.
--   
- Inference operations in forward chaining, backward chaining and
--   proof-checking modes.
--   
- Simple Horn-style rule implementations, extendable through
--   variable binding modifiers and filters.
--   
- Class restriction rule implementation, primarily for datatype
--   inferences.
--   
- RDF formal semantics entailment rule implementation.
--   
- Complete, ready-to-run, command-line and script-driven
--   programs.
--   
--   
--   Changes in version 0.9.0.7:
--   
--   
--   
- Minor documentation fix for Swish.RDF.Graph.quote.
--   
--   
--   Changes in version 0.9.0.6:
--   
--   
--   
- Turtle/N3 output: \f characters in literals are converted
--   to \u000C to work around some interoperability issues.
--   
- Changed the test handling to use test-framework.
--   
--   
--   Changes in version 0.9.0.5:
--   
--   
--   
- Turtle/N3 output: more changes for string literals containing
--   double-quote characters.
--   
- N3 Parser: parsing of string literals within three quote marks has
--   been updated to match the Turtle parser.
--   
- Turtle Parser: a few more error messages have been added.
--   
--   
--   Changes in version 0.9.0.4:
--   
--   
--   
- Turtle parser: updated to the Candidate Recommendation (19
--   February 2013) specification; added minor improvements to error
--   messages when given invalid syntax. As part of the upgrade, there is
--   no longer a default namespace set up for the empty prefix and numeric
--   literals are no-longer converted into a canonical form.
--   
- Turtle/N3 output: improved string formatting (better handling of
--   string literals with three or more consecutive " characters);
--   blank node handling has been improved but the output may not be as
--   elegant.
--   
- NTriples parser: now accepts upper-case language tags such as
--   en-UK (case is preserved).
--   
- Swish.QName.LName names can now contain #,
--   : and / characters.
--   
- Added tests for the Turtle parser and formatter.
--   
- The new w3ctests flag will build the runw3ctests
--   executable, which will run the W3C Turtle tests (if downloaded from
--   http://www.w3.org/2013/TurtleTests/).
--   
- Minor fixes and additions to the documentation.
--   
--   
--   Changes in version 0.9.0.3:
--   
--   
--   
- Minor Haddock fix to
--   Swish.RDF.Parser.Utils.appendURIs.
--   
--   
--   Changes in version 0.9.0.2:
--   
--   
--   
- Updated the upper bound on the polyparse dependency.
--   
--   
--   Changes in version 0.9.0.1:
--   
--   
--   
- Updated the upper bound on the semigroup dependency (thanks to
--   Leif Warner).
--   
--   
--   Changes in version 0.9.0.0:
--   
--   
--   
- Updated to support hashable-1.2 series; although this
--   should *not* change the API from the 0.8 series, I have
--   decided to bump up the version to 0.9 just in case.
--   
- Fix failing test on 64-bit GHC (no change to the library).
--   
--   
--   Changes in previous versions can be found at
--   https://bitbucket.org/doug_burke/swish/src/tip/CHANGES.
--   
--   References:
--   
--   
--   
- http://www.ninebynine.org/RDFNotes/Swish/Intro.html
--   
- http://www.ninebynine.org/Software/swish-0.2.1.html
--   
- CWM: http://www.w3.org/2000/10/swap/doc/cwm.html
--   
@package swish
@version 0.9.0.7

module Swish.Utils.ListHelpers

-- | Apply list of functions to some value, returning list of results. It's
--   kind of like an converse map.
--   
--   This is similar to the ap function in the Monad library.
flist :: [a -> b] -> a -> [b]

-- | This module defines a Labelled Directed Graph and Label classes, and
--   the Arc datatype.
module Swish.GraphClass

-- | Labelled Directed Graph class.
--   
--   Minimum required implementation: emptyGraph, setArcs,
--   and getArcs.
class LDGraph lg lb where extract sel = update (filter sel) addGraphs addg = update (union (getArcs addg)) delete g1 g2 = setArcs g2 (getArcs g2 `difference` getArcs g1) labels = getComponents arcLabels . getArcs nodes = getComponents arcNodes . getArcs update f g = setArcs g (f (getArcs g))
emptyGraph :: LDGraph lg lb => lg lb
setArcs :: LDGraph lg lb => lg lb -> ArcSet lb -> lg lb
getArcs :: LDGraph lg lb => lg lb -> ArcSet lb
extract :: (LDGraph lg lb, Ord lb) => Selector lb -> lg lb -> lg lb
addGraphs :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb
delete :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb
labels :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb
nodes :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb
update :: LDGraph lg lb => (ArcSet lb -> ArcSet lb) -> lg lb -> lg lb

-- | Label class.
--   
--   A label may have a fixed binding, which means that the label
--   identifies (is) a particular graph node, and different such labels are
--   always distinct nodes. Alternatively, a label may be unbound
--   (variable), which means that it is a placeholder for an unknown node
--   label. Unbound node labels are used as graph-local identifiers for
--   indicating when the same node appears in several arcs.
--   
--   For the purposes of graph-isomorphism testing, fixed labels are
--   matched when they are the same. Variable labels may be matched with
--   any other variable label. Our definition of isomorphism (for RDF
--   graphs) does not match variable labels with fixed labels.
class (Ord lb, Show lb) => Label lb
labelIsVar :: Label lb => lb -> Bool
labelHash :: Label lb => Int -> lb -> Int
getLocal :: Label lb => lb -> String
makeLabel :: Label lb => String -> lb

-- | Arc type.
--   
--   Prior to 0.7.0.0 you could also use asubj,
--   apred and aobj to access the elements of the arc.
data Arc lb
Arc :: lb -> lb -> lb -> Arc lb

-- | The subject of the arc.
arcSubj :: Arc lb -> lb

-- | The predicate (property) of the arc.
arcPred :: Arc lb -> lb

-- | The object of the arc.
arcObj :: Arc lb -> lb

-- | A set - or graph - of arcs.
type ArcSet lb = Set (Arc lb)

-- | Identify arcs.
type Selector lb = Arc lb -> Bool

-- | Create an arc.
arc :: lb -> lb -> lb -> Arc lb

-- | Convert an Arc into a tuple.
arcToTriple :: Arc lb -> (lb, lb, lb)

-- | Create an Arc from a tuple.
arcFromTriple :: (lb, lb, lb) -> Arc lb

-- | Does the arc contain the label in any position (subject, predicate, or
--   object)?
hasLabel :: Eq lb => lb -> Arc lb -> Bool

-- | Return all the labels in an arc.
arcLabels :: Arc lb -> [lb]

-- | Extract components from a set.
getComponents :: (Ord a, Ord b) => (a -> [b]) -> Set a -> Set b
instance Eq lb => Eq (Arc lb)
instance Functor Arc
instance Foldable Arc
instance Traversable Arc
instance Show lb => Show (Arc lb)
instance Ord lb => Ord (Arc lb)
instance Hashable lb => Hashable (Arc lb)

-- | This module contains functions for partitioning a graph into subgraphs
--   that rooted from different subject nodes.
module Swish.GraphPartition

-- | Representation of a graph as a collection of (possibly nested)
--   partitions. Each node in the graph appears at least once as the root
--   value of a GraphPartition value:
--   
--   
--   
- Nodes that are the subject of at least one statement appear as the
--   first value of exactly one PartSub constructor, and may also
--   appear in any number of PartObj constructors.
--   
- Nodes appearing only as objects of statements appear only in
--   PartObj constructors.
--   
data PartitionedGraph lb
PartitionedGraph :: [GraphPartition lb] -> PartitionedGraph lb

-- | Returns all the arcs in the partitioned graph.
getArcs :: PartitionedGraph lb -> [Arc lb]

-- | Returns a list of partitions.
getPartitions :: PartitionedGraph lb -> [GraphPartition lb]

-- | Represent a partition of a graph by a node and (optional) contents.
data GraphPartition lb
PartObj :: lb -> GraphPartition lb
PartSub :: lb -> (NonEmpty (lb, GraphPartition lb)) -> GraphPartition lb

-- | Returns the node for the partition.
node :: GraphPartition lb -> lb

-- | Creates a list of arcs from the partition. The empty list is returned
--   for PartObj.
toArcs :: GraphPartition lb -> [Arc lb]

-- | Turning a partitioned graph into a flat graph is easy. The interesting
--   challenge is to turn a flat graph into a partitioned graph that is
--   more useful for certain purposes. Currently, I'm interested in:
--   
--   
--   
- isolating differences between graphs
--   
- pretty-printing graphs
--   
--   
--   For (1), the goal is to separate subgraphs that are known to be
--   equivalent from subgraphs that are known to be different, such that:
--   
--   
--   
- different sub-graphs are minimized,
--   
- different sub-graphs are placed into 1:1 correspondence (possibly
--   with null subgraphs), and
--   
- only deterministic matching decisions are made.
--   
--   
--   For (2), the goal is to decide when a subgraph is to be treated as
--   nested in another partition, or treated as a new top-level partition.
--   If a subgraph is referenced by exactly one graph partition, it should
--   be nested in that partition, otherwise it should be a new top-level
--   partition.
--   
--   Strategy. Examining just subject and object nodes:
--   
--   
--   
- all non-blank subject nodes are the root of a top-level
--   partition
--   
- blank subject nodes that are not the object of exactly one
--   statement are the root of a top-level partition.
--   
- blank nodes referenced as the object of exactly 1 statement of an
--   existing partition are the root of a sub-partition of the refering
--   partition.
--   
- what remain are circular chains of blank nodes not referenced
--   elsewhere: for each such chain, pick a root node arbitrarily.
--   
partitionGraph :: Label lb => [Arc lb] -> PartitionedGraph lb

-- | Create a list of pairs of corresponding Partitions that are unequal.
comparePartitions :: Label lb => PartitionedGraph lb -> PartitionedGraph lb -> [(Maybe (GraphPartition lb), Maybe (GraphPartition lb))]

-- | Convert a partition into a string with a leading separator string.
partitionShowP :: Label lb => String -> GraphPartition lb -> String
instance Label lb => Eq (PartitionedGraph lb)
instance Label lb => Show (PartitionedGraph lb)
instance Label lb => Show (GraphPartition lb)
instance Label lb => Ord (GraphPartition lb)
instance Label lb => Eq (GraphPartition lb)

-- | This module contains graph-matching logic.
--   
--   The algorithm used is derived from a paper on RDF graph matching by
--   Jeremy Carroll
--   http://www.hpl.hp.com/techreports/2001/HPL-2001-293.html.
module Swish.GraphMatch

-- | Graph matching function accepting two lists of arcs and returning a
--   node map if successful
graphMatch :: Label lb => (lb -> lb -> Bool) -> ArcSet lb -> ArcSet lb -> (Bool, LabelMap (ScopedLabel lb))

-- | A label lookup table specialized to LabelIndex indices.
type LabelMap lb = GenLabelMap lb LabelIndex

-- | Type for label->index lookup table
data (Label lb, Eq lv, Show lv) => GenLabelMap lb lv
LabelMap :: Word32 -> (Map lb lv) -> GenLabelMap lb lv

-- | A label associated with a LabelIndex
type LabelEntry lb = GenLabelEntry lb LabelIndex

-- | A Mapping between a label and a value (e.g. an index value).
data Label lb => GenLabelEntry lb lv
LabelEntry :: lb -> lv -> GenLabelEntry lb lv

-- | This instance of class label adds a graph identifier to each variable
--   label, so that variable labels from different graphs are always seen
--   as distinct values.
--   
--   The essential logic added by this class instance is embodied in the eq
--   and hash functions. Note that variable label hashes depend only on the
--   graph in which they appear, and non-variable label hashes depend only
--   on the variable. Label hash values are used when initializing a label
--   equivalence-class map (and, for non-variable labels, also for
--   resolving hash collisions).
data Label lb => ScopedLabel lb
ScopedLabel :: Int -> lb -> ScopedLabel lb

-- | Create a scoped label given an identifier and label.
makeScopedLabel :: Label lb => Int -> lb -> ScopedLabel lb

-- | Create an arc containining a scoped label with the given identifier.
makeScopedArc :: Label lb => Int -> Arc lb -> Arc (ScopedLabel lb)

-- | LabelIndex is a unique value assigned to each label, such that labels
--   with different values are definitely different values in the graph;
--   e.g. do not map to each other in the graph bijection. The first member
--   is a generation counter that ensures new values are distinct from
--   earlier passes.
type LabelIndex = (Word32, Word32)

-- | Type for equivalence class description (An equivalence class is a
--   collection of labels with the same LabelIndex value.)
type EquivalenceClass lb = (LabelIndex, [lb])

-- | The null, or empty, index value.
nullLabelVal :: LabelIndex

-- | The empty label map table.
emptyMap :: Label lb => LabelMap lb

-- | Does this node have a variable binding?
labelIsVar :: Label lb => lb -> Bool

-- | Calculate the hash of the label using the supplied seed.
labelHash :: Label lb => Int -> lb -> Int

-- | Map a label to its corresponding label index value in the supplied
--   LabelMap.
mapLabelIndex :: Label lb => LabelMap lb -> lb -> LabelIndex

-- | Replace a label and its associated value in a label map with a new
--   value using the supplied hash value and the current LabelMap
--   generation number. If the key is not found, then no change is made to
--   the label map.
setLabelHash :: Label lb => LabelMap lb -> (lb, Word32) -> LabelMap lb

-- | Replace selected values in a label map with new values from the
--   supplied list of labels and new label index values. The generation
--   number is supplied from the current label map. The generation number
--   in the resulting label map is incremented.
newLabelMap :: Label lb => LabelMap lb -> [(lb, Word32)] -> LabelMap lb

-- | Return the set of distinct labels used in the graph.
graphLabels :: Label lb => ArcSet lb -> Set lb

-- | Scan label list, assigning initial label map values, adding new values
--   to the label map supplied.
--   
--   Label map values are assigned on the basis of the label alone, without
--   regard for it's connectivity in the graph. (cf. reclassify).
--   
--   All variable node labels are assigned the same initial value, as they
--   may be matched with each other.
assignLabelMap :: Label lb => Set lb -> LabelMap lb -> LabelMap lb

-- | Increment the generation of the label map.
--   
--   Returns a new label map identical to the supplied value but with an
--   incremented generation number.
newGenerationMap :: Label lb => LabelMap lb -> LabelMap lb

-- | Recursive graph matching function
--   
--   This function assumes that no variable label appears in both graphs.
--   (Function graphMatch, which calls this, ensures that all
--   variable labels are distinct.)
graphMatch1 :: Label lb => Bool -> (lb -> lb -> Bool) -> ArcSet lb -> ArcSet lb -> LabelMap lb -> [(EquivalenceClass lb, EquivalenceClass lb)] -> (Bool, LabelMap lb)

-- | Auxiliary graph matching function
--   
--   This function is called when deterministic decomposition of node
--   mapping equivalence classes has run its course.
--   
--   It picks a pair of equivalence classes in ecpairs, and arbitrarily
--   matches pairs of nodes in those equivalence classes, recursively
--   calling the graph matching function until a suitable node mapping is
--   discovered (success), or until all such pairs have been tried
--   (failure).
--   
--   This function represents a point to which arbitrary choices are
--   backtracked. The list comprehension glp represents the
--   alternative choices at the point of backtracking
--   
--   The selected pair of nodes are placed in a new equivalence class based
--   on their original equivalence class value, but with a new NodeVal
--   generation number.
graphMatch2 :: Label lb => (lb -> lb -> Bool) -> ArcSet lb -> ArcSet lb -> LabelMap lb -> [(EquivalenceClass lb, EquivalenceClass lb)] -> (Bool, LabelMap lb)

-- | Return the equivalence classes of the supplied nodes using the label
--   map.
equivalenceClasses :: Label lb => LabelMap lb -> Set lb -> [EquivalenceClass lb]

-- | Reclassify labels
--   
--   Examines the supplied label equivalence classes (based on the supplied
--   label map), and evaluates new equivalence subclasses based on node
--   values and adjacency (for variable nodes) and rehashing (for
--   non-variable nodes).
--   
--   Note, assumes that all all equivalence classes supplied are
--   non-singletons; i.e. contain more than one label.
reclassify :: Label lb => ArcSet lb -> ArcSet lb -> LabelMap lb -> [(EquivalenceClass lb, EquivalenceClass lb)] -> (LabelMap lb, [(EquivalenceClass lb, EquivalenceClass lb)], Bool, Bool)
instance Label lb => Ord (ScopedLabel lb)
instance Label lb => Show (ScopedLabel lb)
instance Label lb => Eq (ScopedLabel lb)
instance Label lb => Label (ScopedLabel lb)
instance Label lb => Eq (LabelMap lb)
instance Label lb => Show (LabelMap lb)
instance (Label lb, Show lv, Ord lv) => Ord (GenLabelEntry lb lv)
instance (Label lb, Eq lv) => Eq (GenLabelEntry lb lv)
instance (Label lb, Show lv) => Show (GenLabelEntry lb lv)

-- | This module defines a simple memory-based graph instance.
module Swish.GraphMem

-- | Simple memory-based graph type.
data GraphMem lb
GraphMem :: ArcSet lb -> GraphMem lb
arcs :: GraphMem lb -> ArcSet lb

-- | Minimal graph label value - for testing
data LabelMem
LF :: String -> LabelMem
LV :: String -> LabelMem

-- | Replace the existing arcs in the graph.
setArcs :: LDGraph lg lb => lg lb -> ArcSet lb -> lg lb

-- | Extract all the arcs from a graph
getArcs :: LDGraph lg lb => lg lb -> ArcSet lb

-- | Add the two graphs
addGraphs :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Remove those arcs in the first graph from the second graph
delete :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb

-- | Extract those arcs that match the given Selector.
extract :: (LDGraph lg lb, Ord lb) => Selector lb -> lg lb -> lg lb

-- | Enumerate the distinct labels contained in a graph; that is, any label
--   that appears in the subject, predicate or object position of an
--   Arc.
labels :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb

-- | Does this node have a variable binding?
labelIsVar :: Label lb => lb -> Bool

-- | Calculate the hash of the label using the supplied seed.
labelHash :: Label lb => Int -> lb -> Int

-- | GraphMem matching function accepting GraphMem value and returning node
--   map if successful
matchGraphMem :: Label lb => GraphMem lb -> GraphMem lb -> (Bool, LabelMap (ScopedLabel lb))
instance Show LabelMem
instance Ord LabelMem
instance Eq LabelMem
instance Label LabelMem
instance Hashable LabelMem
instance Label lb => Monoid (GraphMem lb)
instance Label lb => Show (GraphMem lb)
instance Label lb => Ord (GraphMem lb)
instance Label lb => Eq (GraphMem lb)
instance Label lb => LDGraph GraphMem lb

-- | Provide an ordering for URIs (that is, an Ord instance for
--   URI).
--   
--   This instance is provided so that URIs can be used as the key of a
--   Map. Case is relevant for the ordering, and no attempt is made
--   to decode percent-encoded values (i.e. the comparison does not
--   use a canonical or normalized form).
--   
--   For network version 2.4.0.0 and higher, this module
--   is a no-op, since URI now defines these instances.
module Network.URI.Ord

-- | This module defines an extension of the Show class for
--   displaying multi-line values. It serves the following purposes:
--   
--   
--   
- provides a method with greater layout control of multiline
--   values,
--   
- provides a possibility to override the default Show
--   behaviour for programs that use the extended ShowLines
--   interface, and
--   
- uses a ShowS intermediate value to avoid unnecessary
--   concatenation of long strings.
--   
module Data.String.ShowLines

-- | ShowLines is a type class for values that may be formatted in
--   multi-line displays.
class Show sh => ShowLines sh where showls _ = shows
showls :: ShowLines sh => String -> sh -> ShowS

-- | This module provides methods to support operations on partially
--   ordered collections. The partial ordering relationship is represented
--   by Maybe Ordering.
--   
--   Thanks to members of the haskell-cafe mailing list - Robert
--   (rvollmert-lists@gmx.net) and Tom Pledger (Tom.Pledger@peace.com) -
--   who suggested key ideas on which some of the code in this module is
--   based.
module Data.Ord.Partial

-- | Partial comparison function.
type PartCompare a = a -> a -> Maybe Ordering

-- | This function finds the minima in a list of partially ordered values,
--   preserving the sequence of retained values from the supplied list.
--   
--   It returns all those values in the supplied list for which there is no
--   smaller element in the list.
minima :: PartCompare a -> [a] -> [a]

-- | This function finds the maxima in a list of partially ordered values,
--   preserving the sequence of retained values from the supplied list.
--   
--   It returns all those values in the supplied list for which there is no
--   larger element in the list.
maxima :: PartCompare a -> [a] -> [a]

-- | Partial ordering for Eq values
partCompareEq :: Eq a => PartCompare a

-- | Part-ordering comparison on pairs of values, where each has a
--   part-ordering relationship
partComparePair :: PartCompare a -> PartCompare b -> (a, b) -> (a, b) -> Maybe Ordering

-- | Part-ordering comparison on lists of Maybe values.
partCompareListMaybe :: Eq a => [Maybe a] -> [Maybe a] -> Maybe Ordering

-- | Part-ordering comparison on lists based on subset relationship
partCompareListSubset :: Eq a => [a] -> [a] -> Maybe Ordering

-- | Support interning URIs.
module Data.Interned.URI

-- | An interned URI. The hashing is based on the reversed URI (as a
--   string).
data InternedURI
instance Eq (Description InternedURI)
instance Hashable (Description InternedURI)
instance Uninternable InternedURI
instance Interned InternedURI
instance Show InternedURI
instance Ord InternedURI
instance Eq InternedURI
instance IsString InternedURI

-- | This module defines an algebraic datatype for qualified names
--   (QNames), which represents a URI as the combination of a
--   namespace URI and a local component (LName), which can
--   be empty.
--   
--   Although RDF supports using IRIs, the use of URI here precludes
--   this, which means that, for instance, LName only accepts a
--   subset of valid characters. There is currently no attempt to convert
--   from an IRI into a URI.
module Swish.QName

-- | A qualified name, consisting of a namespace URI and the local part of
--   the identifier, which can be empty. The serialisation of a QName is
--   formed by concatanating the two components.
--   
--   
--   Prelude> :set prompt "swish> "
--   swish> :set -XOverloadedStrings
--   swish> :m + Swish.QName
--   swish> let qn1 = "http://example.com/" :: QName
--   swish> let qn2 = "http://example.com/bob" :: QName
--   swish> let qn3 = "http://example.com/bob/fred" :: QName
--   swish> let qn4 = "http://example.com/bob/fred#x" :: QName
--   swish> let qn5 = "http://example.com/bob/fred:joe" :: QName
--   swish> map getLocalName [qn1, qn2, qn3, qn4, qn5]
--   ["","bob","fred","x","fred:joe"]
--   swish> getNamespace qn1
--   http://example.com/
--   swish> getNamespace qn2
--   http://example.com/
--   swish> getNamespace qn3
--   http://example.com/bob/
--   swish> getNamespace qn4
--   http://example.com/bob/fred#
--   
data QName

-- | A local name, which can be empty.
--   
--   At present, the local name can not contain a space character and can
--   only contain ascii characters (those that match isAscii).
--   
--   In version 0.9.0.3 and earlier, the following characters were
--   not allowed in local names: '#', ':', or '/' characters.
--   
--   This is all rather experimental.
data LName

-- | The empty local name.
emptyLName :: LName

-- | Create a local name.
newLName :: Text -> Maybe LName

-- | Extract the local name.
getLName :: LName -> Text

-- | Create a new qualified name with an explicit local component.
newQName :: URI -> LName -> QName

-- | Create a new qualified name.
qnameFromURI :: URI -> Maybe QName

-- | Return the URI of the namespace stored in the QName. This does not
--   contain the local component.
getNamespace :: QName -> URI

-- | Return the local component of the QName.
getLocalName :: QName -> LName

-- | Returns the full URI of the QName (ie the combination of the namespace
--   and local components).
getQNameURI :: QName -> URI

-- | Convert a filepath to a file: URI stored in a QName. If the input file
--   path is relative then the current working directory is used to convert
--   it into an absolute path.
--   
--   If the input represents a directory then it *must* end in the
--   directory separator - so for Posix systems use "/foo/bar/"
--   rather than "/foo/bar".
--   
--   This has not been tested on Windows.
qnameFromFilePath :: FilePath -> IO QName
instance Eq LName
instance Ord LName
instance Show QName
instance Ord QName
instance Eq QName
instance IsString QName
instance IsString LName
instance Show LName

-- | This module defines algebraic datatypes for namespaces and scoped
--   names.
--   
--   For these purposes, a namespace is a prefix and URI used to identify a
--   namespace (cf. XML namespaces), and a scoped name is a name that is
--   scoped by a specified namespace.
module Swish.Namespace

-- | A NameSpace value consists of an optional prefix and a corresponding
--   URI.
data Namespace

-- | Create a name space from a URI and an optional prefix label.
makeNamespace :: Maybe Text -> URI -> Namespace

-- | Create a qualified name by combining the URI from the name space with
--   a local component.
makeNamespaceQName :: Namespace -> LName -> QName

-- | Returns the prefix stored in the name space.
getNamespacePrefix :: Namespace -> Maybe Text

-- | Returns the URI stored in the name space.
getNamespaceURI :: Namespace -> URI

-- | Convert the name space to a (prefix, URI) tuple.
getNamespaceTuple :: Namespace -> (Maybe Text, URI)

-- | A full ScopedName value has a QName prefix, namespace URI and a local
--   part. ScopedName values may omit the prefix (see Namespace) or
--   the local part.
--   
--   Some applications may handle null namespace URIs as meaning the local
--   part is relative to some base URI.
data ScopedName

-- | Returns the namespace.
getScopeNamespace :: ScopedName -> Namespace

-- | Returns the local part.
getScopeLocal :: ScopedName -> LName

-- | Returns the prefix of the namespace, if set.
getScopePrefix :: ScopedName -> Maybe Text

-- | Returns the URI of the namespace.
getScopeURI :: ScopedName -> URI

-- | Get the QName corresponding to a scoped name.
getQName :: ScopedName -> QName

-- | Get URI corresponding to a scoped name (using RDF conventions).
getScopedNameURI :: ScopedName -> URI

-- | Test if supplied string matches the display form of a scoped name.
matchName :: String -> ScopedName -> Bool

-- | Construct a ScopedName.
makeScopedName :: Maybe Text -> URI -> LName -> ScopedName

-- | Construct a ScopedName from a QName.
makeQNameScopedName :: Maybe Text -> QName -> ScopedName

-- | Construct a ScopedName for a bare URI (the label is set to "").
makeURIScopedName :: URI -> ScopedName

-- | Construct a ScopedName.
makeNSScopedName :: Namespace -> LName -> ScopedName

-- | This should never appear as a valid name
nullScopedName :: ScopedName

-- | Utility routine to create a @prefix line (matching N3/Turtle) grammar
--   for this namespace.
namespaceToBuilder :: Namespace -> Builder
instance Show ScopedName
instance Ord ScopedName
instance Eq ScopedName
instance IsString ScopedName
instance Show Namespace
instance Ord Namespace
instance Eq Namespace

-- | This module defines a framework for defining inference rules over some
--   expression form. It is intended to be used with RDF graphs, but the
--   structures aim to be quite generic with respect to the expression
--   forms allowed.
module Swish.Rule

-- | Expression is a type class for values over which proofs may be
--   constructed.
class Eq ex => Expression ex
isValid :: Expression ex => ex -> Bool

-- | A Formula is a named expression.
data Formula ex
Formula :: ScopedName -> ex -> Formula ex

-- | Name used for formula in proof chain
formName :: Formula ex -> ScopedName

-- | Named formula value
formExpr :: Formula ex -> ex

-- | Rule is a data type for inference rules that can be used to construct
--   a step in a proof.
data Rule ex
Rule :: ScopedName -> ([ex] -> [ex]) -> (ex -> [[ex]]) -> ([ex] -> ex -> Bool) -> Rule ex

-- | Name of rule, for use when displaying a proof
ruleName :: Rule ex -> ScopedName

-- | Forward application of a rule, takes a list of expressions and returns
--   a list (possibly empty) of forward applications of the rule to
--   combinations of the antecedent expressions. Note that all of the
--   results returned can be assumed to be (simultaneously) true, given the
--   antecedents provided.
fwdApply :: Rule ex -> [ex] -> [ex]

-- | Backward application of a rule, takes an expression and returns a list
--   of alternative antecedents, each of which is a list of expressions
--   that jointly yield the given consequence through application of the
--   inference rule. An empty list is returned if no antecedents will allow
--   the consequence to be inferred.
bwdApply :: Rule ex -> ex -> [[ex]]

-- | Inference check. Takes a list of antecedent expressions and a
--   consequent expression, returning True if the consequence can be
--   obtained from the antecedents by application of the rule. When the
--   antecedents and consequent are both given, this is generally more
--   efficient that using either forward or backward chaining. Also, a
--   particular rule may not fully support either forward or backward
--   chaining, but all rules are required to fully support this function.
--   
--   A default implementation based on forward chaining is given below.
checkInference :: Rule ex -> [ex] -> ex -> Bool

-- | A set of rules labelled with their name.
type RuleMap ex = Map ScopedName (Rule ex)

-- | The namespace http://id.ninebynine.org/2003/Ruleset/null with
--   the prefix null:.
nullScope :: Namespace

-- | Create a scoped name with the null namespace.
nullSN :: LName -> ScopedName

-- | The null formula.
nullFormula :: Formula ex

-- | The null rule.
nullRule :: Rule ex

-- | Checks that consequence is a result of applying the rule to the
--   antecedants.
fwdCheckInference :: Eq ex => Rule ex -> [ex] -> ex -> Bool

-- | Checks that the antecedants are all required to create the consequence
--   using the given rule.
bwdCheckInference :: Eq ex => Rule ex -> [ex] -> ex -> Bool

-- | Create a displayable form of a labelled formula
showsFormula :: ShowLines ex => String -> Formula ex -> ShowS

-- | Return a displayable form of a list of labelled formulae
showsFormulae :: ShowLines ex => String -> [Formula ex] -> String -> ShowS

-- | Show a string left justified in a field of at least the specified
--   number of characters width.
showsWidth :: Int -> String -> ShowS
instance Show ex => Show (Formula ex)
instance Show (Rule ex)
instance Ord (Rule ex)
instance Eq (Rule ex)
instance Ord (Formula ex)
instance Eq (Formula ex)

-- | This module defines a ruleset data type, used to collect information
--   about a ruleset that may contribute torwards inferences in RDF; e.g.
--   RDF and RDFS are rulesets.
--   
--   A Ruleset consists of a namespace, a collection of axioms, and
--   a collection of rules.
module Swish.Ruleset

-- | A Rule set.
data Ruleset ex
Ruleset :: Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex

-- | Namespace.
rsNamespace :: Ruleset ex -> Namespace

-- | Axioms.
rsAxioms :: Ruleset ex -> [Formula ex]

-- | Rules.
rsRules :: Ruleset ex -> [Rule ex]

-- | A set of Rulesets labelled by their Namespace.
type RulesetMap ex = Map Namespace (Ruleset ex)

-- | Create a ruleset.
makeRuleset :: Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex

-- | Extract the namespace of a ruleset.
getRulesetNamespace :: Ruleset ex -> Namespace

-- | Extract the axioms from a ruleset.
getRulesetAxioms :: Ruleset ex -> [Formula ex]

-- | Extract the rules from a ruleset.
getRulesetRules :: Ruleset ex -> [Rule ex]

-- | Find a named axiom in a ruleset.
getRulesetAxiom :: ScopedName -> Ruleset ex -> Maybe (Formula ex)

-- | Find a named rule in a ruleset.
getRulesetRule :: ScopedName -> Ruleset ex -> Maybe (Rule ex)

-- | Find a named axiom in a proof context.
getContextAxiom :: ScopedName -> Formula ex -> [Ruleset ex] -> Formula ex

-- | Find a named axiom in a proof context.
getMaybeContextAxiom :: ScopedName -> [Ruleset ex] -> Maybe (Formula ex)

-- | Find a named rule in a proof context.
getContextRule :: ScopedName -> Rule ex -> [Ruleset ex] -> Rule ex

-- | Find a named rule in a proof context.
getMaybeContextRule :: ScopedName -> [Ruleset ex] -> Maybe (Rule ex)
instance Eq (Ruleset ex)

-- | This module defines a framework for constructing proofs over some
--   expression form. It is intended to be used with RDF graphs, but the
--   structures aim to be quite generic with respect to the expression
--   forms allowed.
--   
--   It does not define any proof-finding strategy.
module Swish.Proof

-- | Proof is a structure that presents a chain of rule applications that
--   yield a result expression from a given expression
data Proof ex
Proof :: [Ruleset ex] -> Formula ex -> Formula ex -> [Step ex] -> Proof ex

-- | Proof context: list of rulesets, each of which provides a number of
--   axioms and rules.
proofContext :: Proof ex -> [Ruleset ex]

-- | Given expression
proofInput :: Proof ex -> Formula ex

-- | Result expression
proofResult :: Proof ex -> Formula ex

-- | Chain of inference rule applications progressing from input to result
proofChain :: Proof ex -> [Step ex]

-- | Step in proof chain
--   
--   The display name for a proof step comes from the display name of its
--   consequence formula.
data Step ex
Step :: Rule ex -> [Formula ex] -> Formula ex -> Step ex

-- | Inference rule used
stepRule :: Step ex -> Rule ex

-- | Antecedents of inference rule
stepAnt :: Step ex -> [Formula ex]

-- | Named consequence of inference rule
stepCon :: Step ex -> Formula ex

-- | Check consistency of given proof. The supplied rules and axioms are
--   assumed to be correct.
checkProof :: (Expression ex, Ord ex) => Proof ex -> Bool

-- | Check proof. If there is an error then return information about the
--   failing step.
explainProof :: (Expression ex, Ord ex) => Proof ex -> Maybe String

-- | A proof step is valid if rule is in list of rules and the antecedents
--   are sufficient to obtain the conclusion and the antecedents are in the
--   list of formulae already proven.
--   
--   Note: this function depends on the ruleName of any rule being unique
--   among all rules. In particular the name of the step rule being in
--   correspondence with the name of one of the indicated valid rules of
--   inference.
checkStep :: (Expression ex, Ord ex) => [Rule ex] -> [ex] -> Step ex -> Bool

-- | Returns a simple string representation of a proof.
showProof :: ShowLines ex => String -> Proof ex -> String

-- | Create a displayable form of a proof, returned as a ShowS
--   value.
--   
--   This function is intended to allow the calling function some control
--   of multiline displays by providing:
--   
--   
--   
- the first line of the proof is not preceded by any text, so it may
--   be appended to some preceding text on the same line,
--   
- the supplied newline string is used to separate lines of the
--   formatted text, and may include any desired indentation, and
--   
- no newline is output following the final line of text.
--   
showsProof :: ShowLines ex => String -> Proof ex -> ShowS

-- | Create a displayable form of a labelled formula
showsFormula :: ShowLines ex => String -> Formula ex -> ShowS
instance Show ex => Show (Step ex)

-- | This module defines some commonly used vocabulary terms from the RDF
--   (http://www.w3.org/TR/rdf-syntax-grammar/) and RDF Schema
--   (http://www.w3.org/TR/rdf-schema/) documents.
module Swish.RDF.Vocabulary.RDF

-- | Maps rdf to
--   http://www.w3.org/1999/02/22-rdf-syntax-ns#.
namespaceRDF :: Namespace

-- | Maps rdfs to http://www.w3.org/2000/01/rdf-schema#.
namespaceRDFS :: Namespace

-- | rdf:RDF.
rdfRDF :: ScopedName

-- | rdf:Description.
rdfDescription :: ScopedName

-- | rdf:ID.
rdfID :: ScopedName

-- | rdf:about.
rdfAbout :: ScopedName

-- | rdf:parseType.
rdfParseType :: ScopedName

-- | rdf:resource.
rdfResource :: ScopedName

-- | rdf:li.
rdfLi :: ScopedName

-- | rdf:nodeID.
rdfNodeID :: ScopedName

-- | rdf:datatype.
rdfDatatype :: ScopedName

-- | rdf:_1.
rdf1 :: ScopedName

-- | rdf:_2.
rdf2 :: ScopedName

-- | Create a rdf:_n entity.
--   
--   There is no check that the argument is not 0, so it is possible to
--   create the un-defined label rdf:_0.
rdfn :: Word32 -> ScopedName

-- | rdfs:Resource from
--   http://www.w3.org/TR/rdf-schema/#ch_resource.
rdfsResource :: ScopedName

-- | rdfs:Class from
--   http://www.w3.org/TR/rdf-schema/#ch_class.
rdfsClass :: ScopedName

-- | rdfs:Literal from
--   http://www.w3.org/TR/rdf-schema/#ch_literal.
rdfsLiteral :: ScopedName

-- | rdfs:Datatype from
--   http://www.w3.org/TR/rdf-schema/#ch_datatype.
rdfsDatatype :: ScopedName

-- | rdf:XMLLiteral from
--   http://www.w3.org/TR/rdf-schema/#ch_xmlliteral.
rdfXMLLiteral :: ScopedName

-- | rdf:Property from
--   http://www.w3.org/TR/rdf-schema/#ch_property.
rdfProperty :: ScopedName

-- | rdfs:range from
--   http://www.w3.org/TR/rdf-schema/#ch_range.
rdfsRange :: ScopedName

-- | rdfs:domain from
--   http://www.w3.org/TR/rdf-schema/#ch_domain.
rdfsDomain :: ScopedName

-- | rdf:type from
--   http://www.w3.org/TR/rdf-schema/#ch_type.
rdfType :: ScopedName

-- | rdfs:subClassOf from
--   http://www.w3.org/TR/rdf-schema/#ch_subclassof.
rdfsSubClassOf :: ScopedName

-- | rdfs:subPropertyOf from
--   http://www.w3.org/TR/rdf-schema/#ch_subpropertyof.
rdfsSubPropertyOf :: ScopedName

-- | rdfs:label from
--   http://www.w3.org/TR/rdf-schema/#ch_label.
rdfsLabel :: ScopedName

-- | rdfs:comment from
--   http://www.w3.org/TR/rdf-schema/#ch_comment.
rdfsComment :: ScopedName

-- | rdfs:Container from
--   http://www.w3.org/TR/rdf-schema/#ch_container.
rdfsContainer :: ScopedName

-- | rdf:Bag from http://www.w3.org/TR/rdf-schema/#ch_bag.
rdfBag :: ScopedName

-- | rdf:Seq from http://www.w3.org/TR/rdf-schema/#ch_seq.
rdfSeq :: ScopedName

-- | rdf:Alt from http://www.w3.org/TR/rdf-schema/#ch_alt.
rdfAlt :: ScopedName

-- | rdfs:ContainerMembershipProperty from
--   http://www.w3.org/TR/rdf-schema/#ch_containermembershipproperty.
rdfsContainerMembershipProperty :: ScopedName

-- | rdfs:member from
--   http://www.w3.org/TR/rdf-schema/#ch_member.
rdfsMember :: ScopedName

-- | rdf:List from
--   http://www.w3.org/TR/rdf-schema/#ch_list.
rdfList :: ScopedName

-- | rdf:first from
--   http://www.w3.org/TR/rdf-schema/#ch_first.
rdfFirst :: ScopedName

-- | rdf:rest from
--   http://www.w3.org/TR/rdf-schema/#ch_rest.
rdfRest :: ScopedName

-- | rdf:nil from http://www.w3.org/TR/rdf-schema/#ch_nil.
rdfNil :: ScopedName

-- | rdf:Statement from
--   http://www.w3.org/TR/rdf-schema/#ch_statement.
rdfStatement :: ScopedName

-- | rdf:subject from
--   http://www.w3.org/TR/rdf-schema/#ch_subject.
rdfSubject :: ScopedName

-- | rdf:predicate from
--   http://www.w3.org/TR/rdf-schema/#ch_predicate.
rdfPredicate :: ScopedName

-- | rdf:object from
--   http://www.w3.org/TR/rdf-schema/#ch_object.
rdfObject :: ScopedName

-- | rdfs:seeAlso from
--   http://www.w3.org/TR/rdf-schema/#ch_seealso.
rdfsSeeAlso :: ScopedName

-- | rdfs:isDefinedBy from
--   http://www.w3.org/TR/rdf-schema/#ch_isdefinedby.
rdfsIsDefinedBy :: ScopedName

-- | rdf:value from
--   http://www.w3.org/TR/rdf-schema/#ch_value.
rdfValue :: ScopedName

-- | This module defines vocabulary terms from the OWL vocabulary. Note
--   that there is an unfortunate mixture of styles for property names -
--   e.g. owlSameAs and owlequivalentClass. At present there
--   is no systematic attempt to include terms from the vocabulary.
module Swish.RDF.Vocabulary.OWL

-- | Maps owl to http://www.w3.org/2002/07/owl#.
namespaceOWL :: Namespace

-- | owl:Ontology.
owlOntology :: ScopedName

-- | owl:imports.
owlimports :: ScopedName

-- | owl:versionInfo.
owlversionInfo :: ScopedName

-- | owl:deprecated.
owldeprecated :: ScopedName

-- | owl:priorVersion.
owlpriorVersion :: ScopedName

-- | owl:backwartCompatibleWith.
owlbackwardCompatibleWith :: ScopedName

-- | owl:incompatibleWith.
owlincompatibleWith :: ScopedName

-- | owl:Class.
owlClass :: ScopedName

-- | owl:Thing.
owlThing :: ScopedName

-- | owl:Thing.
owlNothing :: ScopedName

-- | owl:NamedIndividual.
owlNamedIndividual :: ScopedName

-- | owl:sameAs.
owlSameAs :: ScopedName

-- | owl:equivalentClass.
owlequivalentClass :: ScopedName

-- | owl:equivalentProperty.
owlequivalentProperty :: ScopedName

-- | owl:ObjectProperty.
owlObjectProperty :: ScopedName

-- | owl:DatatypeProperty.
owlDatatypeProperty :: ScopedName

-- | owl:AnnotationProperty.
owlAnnotationProperty :: ScopedName

-- | owl:rational.
owlrational :: ScopedName

-- | owl:real.
owlreal :: ScopedName

-- | This module defines vocabulary terms from the XSD document.
module Swish.RDF.Vocabulary.XSD

-- | Maps xsd to http://www.w3.org/2001/XMLSchema#.
namespaceXSD :: Namespace

-- | Create a scoped name for an XSD datatype with the given name.
xsdType :: LName -> ScopedName

-- | xsd:string from
--   http://www.w3.org/TR/xmlschema-2/#string.
xsdString :: ScopedName

-- | xsd:boolean from
--   http://www.w3.org/TR/xmlschema-2/#boolean.
xsdBoolean :: ScopedName

-- | xsd:decimal from
--   http://www.w3.org/TR/xmlschema-2/#decimal.
xsdDecimal :: ScopedName

-- | xsd:float from
--   http://www.w3.org/TR/xmlschema-2/#float.
xsdFloat :: ScopedName

-- | xsd:double from
--   http://www.w3.org/TR/xmlschema-2/#double.
xsdDouble :: ScopedName

-- | xsd:dateTime from
--   http://www.w3.org/TR/xmlschema-2/#dateTime.
xsdDateTime :: ScopedName

-- | xsd:time from http://www.w3.org/TR/xmlschema-2/#time.
xsdTime :: ScopedName

-- | xsd:date from http://www.w3.org/TR/xmlschema-2/#date.
xsdDate :: ScopedName

-- | xsd:anyURI from
--   http://www.w3.org/TR/xmlschema-2/#anyURI.
xsdAnyURI :: ScopedName

-- | xsd:integer from
--   http://www.w3.org/TR/xmlschema-2/#integer.
xsdInteger :: ScopedName

-- | xsd:nonPositiveInteger from
--   http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger.
xsdNonPosInteger :: ScopedName

-- | xsd:negativeInteger from
--   http://www.w3.org/TR/xmlschema-2/#negativeInteger.
xsdNegInteger :: ScopedName

-- | xsd:long from http://www.w3.org/TR/xmlschema-2/#long.
xsdLong :: ScopedName

-- | xsd:int from http://www.w3.org/TR/xmlschema-2/#int.
xsdInt :: ScopedName

-- | xsd:short from
--   http://www.w3.org/TR/xmlschema-2/#short.
xsdShort :: ScopedName

-- | xsd:byte from http://www.w3.org/TR/xmlschema-2/#byte.
xsdByte :: ScopedName

-- | xsd:nonNegativeInteger from
--   http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger.
xsdNonNegInteger :: ScopedName

-- | xsd:unsignedLong from
--   http://www.w3.org/TR/xmlschema-2/#unsignedLong.
xsdUnsignedLong :: ScopedName

-- | xsd:unsignedInt from
--   http://www.w3.org/TR/xmlschema-2/#unsignedInt.
xsdUnsignedInt :: ScopedName

-- | xsd:unsignedShort from
--   http://www.w3.org/TR/xmlschema-2/#unsignedShort.
xsdUnsignedShort :: ScopedName

-- | xsd:unsignedByte from
--   http://www.w3.org/TR/xmlschema-2/#unsignedByte.
xsdUnsignedByte :: ScopedName

-- | xsd:positiveInteger from
--   http://www.w3.org/TR/xmlschema-2/#positiveInteger.
xsdPosInteger :: ScopedName

-- | This module defines some commonly used vocabulary terms, using the
--   Namespace and ScopedName data types. Additional
--   vocabularies are available in the set of
--   Swish.RDF.Vocabulary.* modules, parts of which are
--   re-exported by this module
module Swish.RDF.Vocabulary

-- | Maps rdfd to
--   http://id.ninebynine.org/2003/rdfext/rdfd#.
namespaceRDFD :: Namespace

-- | Create a namespace for the datatype family schema used by Swish.
namespaceXsdType :: LName -> Namespace

-- | Maps math to http://www.w3.org/2000/10/swap/math#.
namespaceMATH :: Namespace

-- | Maps log to http://www.w3.org/2000/10/swap/log#.
namespaceLOG :: Namespace

-- | Maps daml to http://www.daml.org/2000/10/daml-ont#.
namespaceDAML :: Namespace

-- | Maps default to http://id.ninebynine.org/default/.
namespaceDefault :: Namespace

-- | Maps swish to http://id.ninebynine.org/2003/Swish/.
namespaceSwish :: Namespace

-- | Maps rs_rdf to
--   http://id.ninebynine.org/2003/Ruleset/rdf#.
scopeRDF :: Namespace

-- | Maps rs_rdfs to
--   http://id.ninebynine.org/2003/Ruleset/rdfs#.
scopeRDFS :: Namespace

-- | Maps rs_rdfd to
--   http://id.ninebynine.org/2003/Ruleset/rdfd#.
scopeRDFD :: Namespace

-- | Represent the language tag for a literal string, following RFC 3066
--   http://www.ietf.org/rfc/rfc3066.txt.
--   
--   Use toLangTag to create a tag and fromLangTag to convert
--   back. The case is preserved for the tag, although comparison (both the
--   Eq instance and compareLangTag) is done using the
--   lower-case form of the tags.
--   
--   As an example:
--   
--   
--   Prelude> :set prompt "swish> "
--   swish> :set -XOverloadedStrings
--   swish> :m + Swish.RDF.Vocabulary
--   swish> let en = "en" :: LanguageTag
--   swish> let us = "en-us" :: LanguageTag
--   swish> let gb = "en-GB" :: LanguageTag
--   swish> gb
--   en-GB
--   swish> gb == "en-gb"
--   True
--   swish> en == us
--   False
--   swish> en `isBaseLang` us
--   True
--   swish> us `isBaseLang` en
--   False
--   swish> us `isBaseLang` gb
--   False
--   
data LanguageTag

-- | Create a LanguageTag element from the label.
--   
--   Valid tags follow the ABNF from RCF 3066, which is
--   
--   
--   Language-Tag = Primary-subtag *( "-" Subtag )
--   Primary-subtag = 1*8ALPHA
--   Subtag = 1*8(ALPHA / DIGIT)
--   
--   
--   There are no checks that the primary or secondary sub tag values are
--   defined in any standard, such as ISO 639, or obey any other
--   syntactical restriction than given above.
toLangTag :: Text -> Maybe LanguageTag

-- | Convert a language tag back into text form.
fromLangTag :: LanguageTag -> Text

-- | Compare language tags using the Language-range specification in
--   section 2.5 of RFC 3066.
--   
--   True is returned if the comparison tag is the same as, or
--   matches a prefix of, the base tag (where the match must be over
--   complete sub tags).
--   
--   Note that
--   
--   
--   l1 `isBaseLang` l2 == l2 `isBaseLang` l1
--   
--   
--   only when
--   
--   
--   l1 == l2
--   
isBaseLang :: LanguageTag -> LanguageTag -> Bool

-- | Convert a local name to a scoped name in the swish namespace
--   (namespaceSwish).
swishName :: LName -> ScopedName

-- | rdfd:GeneralRestriction.
rdfdGeneralRestriction :: ScopedName

-- | rdfd:onProperties.
rdfdOnProperties :: ScopedName

-- | rdfd:constraint.
rdfdConstraint :: ScopedName

-- | rdfd:maxCardinality.
rdfdMaxCardinality :: ScopedName

-- | log:implies.
logImplies :: ScopedName

-- | default:base.
defaultBase :: ScopedName
instance Ord LanguageTag
instance Eq LanguageTag
instance IsString LanguageTag
instance Show LanguageTag

-- | This module defines a memory-based RDF graph instance. At present only
--   RDF 1.0 is explicitly supported; I have not gone through the RDF 1.1
--   changes to see how the code needs to be updated. This means that you
--   can have untyped strings in your graph that do not match the same
--   content but with an explicit xsd:string datatype.
--   
--   Note that the identifiers for blank nodes may not be propogated
--   when a graph is written out using one of the formatters, such as
--   Turtle. There is limited support for generating new blank nodes
--   from an existing set of triples; e.g. newNode and
--   newNodes.
module Swish.RDF.Graph

-- | RDF graph node values
--   
--   cf. http://www.w3.org/TR/rdf-concepts/#section-Graph-syntax
--   version 1.0
--   
--   This is extended from the RDF abstract graph syntax in the following
--   ways:
--   
--   (a) a graph can be part of a resource node or blank node (cf.
--   Notation3 formulae)
--   
--   (b) a "variable" node option is distinguished from a blank node. I
--   have found this useful for encoding and handling queries, even though
--   query variables can be expressed as blank nodes.
--   
--   (c) a "NoNode" option is defined. This might otherwise be handled by
--   Maybe (RDFLabel g).
--   
--   Prior to version 0.7.0.0, literals were represented by a
--   single constructor, Lit, with an optional argument. Language
--   codes for literals was also stored as a ScopedName rather than
--   as a LanguageTag.
data RDFLabel

-- | resource
Res :: ScopedName -> RDFLabel

-- | plain literal
--   (http://www.w3.org/TR/rdf-concepts/#dfn-plain-literal)
Lit :: Text -> RDFLabel

-- | plain literal
LangLit :: Text -> LanguageTag -> RDFLabel

-- | typed literal
--   (http://www.w3.org/TR/rdf-concepts/#dfn-typed-literal)
TypedLit :: Text -> ScopedName -> RDFLabel

-- | blank node
Blank :: String -> RDFLabel

-- | variable (not used in ordinary graphs)
Var :: String -> RDFLabel

-- | no node (not used in ordinary graphs)
NoNode :: RDFLabel

-- | A type that can be converted to a RDF Label.
--   
--   The String instance converts to an untyped literal (so no language tag
--   is assumed).
--   
--   The UTCTime and Day instances assume values are in UTC.
--   
--   The conversion for XSD types attempts to use the canonical form
--   described in section 2.3.1 of
--   http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#lexical-space.
--   
--   Note that this is similar to toRDFLabel; the code should
--   probably be combined at some point.
class ToRDFLabel a
toRDFLabel :: ToRDFLabel a => a -> RDFLabel

-- | A type that can be converted from a RDF Label, with the possibility of
--   failure.
--   
--   The String instance converts from an untyped literal (so it can not be
--   used with a string with a language tag).
--   
--   The following conversions are supported for common XSD types
--   (out-of-band values result in Nothing):
--   
--   
--   
- xsd:boolean to Bool
--   
- xsd:integer to Int and Integer
--   
- xsd:float to Float
--   
- xsd:double to Double
--   
- xsd:dateTime to UTCTime
--   
- xsd:date to Day
--   
--   
--   Note that this is similar to fromRDFLabel; the code should
--   probably be combined at some point.
class FromRDFLabel a
fromRDFLabel :: FromRDFLabel a => RDFLabel -> Maybe a

-- | Test if supplied labal is a literal node (Lit, LangLit,
--   or TypedLit).
isLiteral :: RDFLabel -> Bool

-- | Test if supplied labal is an untyped literal node (either Lit
--   or LangLit).
isUntypedLiteral :: RDFLabel -> Bool

-- | Test if supplied labal is a typed literal node (TypedLit).
isTypedLiteral :: RDFLabel -> Bool

-- | Test if supplied labal is a XML literal node
isXMLLiteral :: RDFLabel -> Bool

-- | Test if supplied label is a typed literal node of a given datatype
isDatatyped :: ScopedName -> RDFLabel -> Bool

-- | Test if supplied label is a container membership property
--   
--   Check for namespace is RDF namespace and first character of local name
--   is '_' and remaining characters of local name are all digits
isMemberProp :: RDFLabel -> Bool

-- | Test if supplied labal is a URI resource node
isUri :: RDFLabel -> Bool

-- | Test if supplied labal is a blank node
isBlank :: RDFLabel -> Bool

-- | Test if supplied labal is a query variable
isQueryVar :: RDFLabel -> Bool

-- | Extract text value from a literal node (including the Language and
--   Typed variants). The empty string is returned for other nodes.
getLiteralText :: RDFLabel -> Text

-- | Extract the ScopedName value from a resource node
--   (nullScopedName is returned for non-resource nodes).
getScopedName :: RDFLabel -> ScopedName

-- | Make a blank node from a supplied query variable, or return the
--   supplied label unchanged. (Use this in when substituting an
--   existential for an unsubstituted query variable.)
makeBlank :: RDFLabel -> RDFLabel

-- | Turtle-style quoting rules for a string.
--   
--   At present the choice is between using one or three double quote
--   (") characters to surround the string; i.e. using single
--   quote (') characters is not supported.
--   
--   As of Swish 0.9.0.6, the \f character is converted to
--   \u000C rather than left as is to aid interoperability with
--   some other tools.
quote :: Bool -> String -> String

-- | See quote.
quoteT :: Bool -> Text -> Text

-- | A set of RDF triples.
type RDFArcSet = ArcSet RDFLabel

-- | RDF Triple (statement)
--   
--   At present there is no check or type-level constraint that stops the
--   subject or predicate of the triple from being a literal.
type RDFTriple = Arc RDFLabel

-- | Convert 3 RDF labels to a RDF triple.
--   
--   See also Swish.RDF.GraphClass.arcFromTriple.
toRDFTriple :: (ToRDFLabel s, ToRDFLabel p, ToRDFLabel o) => s -> p -> o -> RDFTriple

-- | Extract the contents of a RDF triple.
--   
--   See also Swish.RDF.GraphClass.arcToTriple.
fromRDFTriple :: (FromRDFLabel s, FromRDFLabel p, FromRDFLabel o) => RDFTriple -> Maybe (s, p, o)

-- | Memory-based graph with namespaces and subgraphs.
--   
--   The primary means for adding arcs to an existing graph are:
--   
--   
--   
- setArcs from the LDGraph instance, which replaces
--   the existing set of arcs and does not change the namespace map.
--   
- addArc which checks that the arc is unknown before adding
--   it but does not change the namespace map or re-label any blank nodes
--   in the arc.
--   
data NSGraph lb
NSGraph :: NamespaceMap -> FormulaMap lb -> ArcSet lb -> NSGraph lb

-- | the namespaces to use
namespaces :: NSGraph lb -> NamespaceMap

-- | any associated formulae (a.k.a. sub- or named- graps)
formulae :: NSGraph lb -> FormulaMap lb

-- | the statements in the graph
statements :: NSGraph lb -> ArcSet lb

-- | Memory-based RDF graph type
type RDFGraph = NSGraph RDFLabel

-- | Create a new RDF graph from a supplied set of arcs.
--   
--   This version will attempt to fill up the namespace map of the graph
--   based on the input labels (including datatypes on literals). For
--   faster creation of a graph you can use:
--   
--   
--   emptyRDFGraph { statements = arcs }
--   
--   
--   which is how this routine was defined in version 0.3.1.1 and
--   earlier.
toRDFGraph :: RDFArcSet -> RDFGraph

-- | Create a new, empty RDF graph (it is just mempty).
emptyRDFGraph :: RDFGraph

-- | Namespace prefix list entry
--   
--   A map for name spaces (key is the prefix).
type NamespaceMap = Map (Maybe Text) URI

-- | Create an empty namespace map.
emptyNamespaceMap :: NamespaceMap

-- | Graph formula entry
data LookupFormula lb gr
Formula :: lb -> gr -> LookupFormula lb gr

-- | The label for the formula
formLabel :: LookupFormula lb gr -> lb

-- | The contents of the formula
formGraph :: LookupFormula lb gr -> gr

-- | A named formula.
type Formula lb = LookupFormula lb (NSGraph lb)

-- | A map for named formulae.
type FormulaMap lb = Map lb (NSGraph lb)

-- | Create an empty formula map.
emptyFormulaMap :: FormulaMap RDFLabel

-- | Add an arc to the graph. It does not relabel any blank nodes in the
--   input arc, nor does it change the namespace map, but it does ensure
--   that the arc is unknown before adding it.
addArc :: Label lb => Arc lb -> NSGraph lb -> NSGraph lb

-- | Merge RDF graphs, renaming blank and query variable nodes as needed to
--   neep variable nodes from the two graphs distinct in the resulting
--   graph.
--   
--   Currently formulae are not guaranteed to be preserved across a merge.
merge :: Label lb => NSGraph lb -> NSGraph lb -> NSGraph lb

-- | Return list of all labels (including properties) in the graph
--   satisfying a supplied filter predicate. This routine includes the
--   labels in any formulae.
allLabels :: Label lb => (lb -> Bool) -> NSGraph lb -> Set lb

-- | Return list of all subjects and objects in the graph satisfying a
--   supplied filter predicate.
allNodes :: Label lb => (lb -> Bool) -> NSGraph lb -> Set lb

-- | Remap selected nodes in graph.
--   
--   This is the node renaming operation that prevents graph-scoped
--   variable nodes from being merged when two graphs are merged.
remapLabels :: Label lb => [lb] -> [lb] -> (lb -> lb) -> NSGraph lb -> NSGraph lb

-- | Externally callable function to construct a list of (old,new) values
--   to be used for graph label remapping.
remapLabelList :: Label lb => [lb] -> [lb] -> [(lb, lb)]

-- | Given a node and a list of existing nodes, find a new node for the
--   supplied node that does not clash with any existing node. (Generates
--   an non-terminating list of possible replacements, and picks the first
--   one that isn't already in use.)
newNode :: Label lb => lb -> [lb] -> lb

-- | Given a node and a list of existing nodes, generate a list of new
--   nodes for the supplied node that do not clash with any existing node.
newNodes :: Label lb => lb -> [lb] -> [lb]

-- | Replace the namespace information in the graph.
setNamespaces :: NamespaceMap -> NSGraph lb -> NSGraph lb

-- | Retrieve the namespace map in the graph.
getNamespaces :: NSGraph lb -> NamespaceMap

-- | Replace the formulae in the graph.
setFormulae :: FormulaMap lb -> NSGraph lb -> NSGraph lb

-- | Retrieve the formulae in the graph.
getFormulae :: NSGraph lb -> FormulaMap lb

-- | Add (or replace) a formula.
setFormula :: Label lb => Formula lb -> NSGraph lb -> NSGraph lb

-- | Find a formula in the graph, if it exists.
getFormula :: Label lb => NSGraph lb -> lb -> Maybe (NSGraph lb)

-- | fmap for NSGraph instances.
fmapNSGraph :: Ord lb => (lb -> lb) -> NSGraph lb -> NSGraph lb

-- | traverse for NSGraph instances.
traverseNSGraph :: (Applicative f, Ord a) => (a -> f a) -> NSGraph a -> f (NSGraph a)

-- | Labelled Directed Graph class.
--   
--   Minimum required implementation: emptyGraph, setArcs,
--   and getArcs.
class LDGraph lg lb where extract sel = update (filter sel) addGraphs addg = update (union (getArcs addg)) delete g1 g2 = setArcs g2 (getArcs g2 `difference` getArcs g1) labels = getComponents arcLabels . getArcs nodes = getComponents arcNodes . getArcs update f g = setArcs g (f (getArcs g))
emptyGraph :: LDGraph lg lb => lg lb
setArcs :: LDGraph lg lb => lg lb -> ArcSet lb -> lg lb
getArcs :: LDGraph lg lb => lg lb -> ArcSet lb
extract :: (LDGraph lg lb, Ord lb) => Selector lb -> lg lb -> lg lb
addGraphs :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb
delete :: (LDGraph lg lb, Ord lb) => lg lb -> lg lb -> lg lb
labels :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb
nodes :: (LDGraph lg lb, Ord lb) => lg lb -> Set lb
update :: LDGraph lg lb => (ArcSet lb -> ArcSet lb) -> lg lb -> lg lb

-- | Label class.
--   
--   A label may have a fixed binding, which means that the label
--   identifies (is) a particular graph node, and different such labels are
--   always distinct nodes. Alternatively, a label may be unbound
--   (variable), which means that it is a placeholder for an unknown node
--   label. Unbound node labels are used as graph-local identifiers for
--   indicating when the same node appears in several arcs.
--   
--   For the purposes of graph-isomorphism testing, fixed labels are
--   matched when they are the same. Variable labels may be matched with
--   any other variable label. Our definition of isomorphism (for RDF
--   graphs) does not match variable labels with fixed labels.
class (Ord lb, Show lb) => Label lb
labelIsVar :: Label lb => lb -> Bool
labelHash :: Label lb => Int -> lb -> Int
getLocal :: Label lb => lb -> String
makeLabel :: Label lb => String -> lb

-- | Arc type.
--   
--   Prior to 0.7.0.0 you could also use asubj,
--   apred and aobj to access the elements of the arc.
data Arc lb
Arc :: lb -> lb -> lb -> Arc lb

-- | The subject of the arc.
arcSubj :: Arc lb -> lb

-- | The predicate (property) of the arc.
arcPred :: Arc lb -> lb

-- | The object of the arc.
arcObj :: Arc lb -> lb

-- | Create an arc.
arc :: lb -> lb -> lb -> Arc lb

-- | Identify arcs.
type Selector lb = Arc lb -> Bool

-- | rdf:RDF.
resRdfRDF :: RDFLabel

-- | rdf:Description.
resRdfDescription :: RDFLabel

-- | rdf:ID.
resRdfID :: RDFLabel

-- | rdf:about.
resRdfAbout :: RDFLabel

-- | rdf:parseType.
resRdfParseType :: RDFLabel

-- | rdf:resource.
resRdfResource :: RDFLabel

-- | rdf:li.
resRdfLi :: RDFLabel

-- | rdf:nodeID.
resRdfNodeID :: RDFLabel

-- | rdf:datatype.
resRdfDatatype :: RDFLabel

-- | rdf:_1.
resRdf1 :: RDFLabel

-- | rdf:_2.
resRdf2 :: RDFLabel

-- | Create a rdf:_n entity.
--   
--   There is no check that the argument is not 0.
resRdfn :: Word32 -> RDFLabel

-- | rdfs:Resource from
--   http://www.w3.org/TR/rdf-schema/#ch_resource.
resRdfsResource :: RDFLabel

-- | rdfs:Class from
--   http://www.w3.org/TR/rdf-schema/#ch_class.
resRdfsClass :: RDFLabel

-- | rdfs:Literal from
--   http://www.w3.org/TR/rdf-schema/#ch_literal.
resRdfsLiteral :: RDFLabel

-- | rdfs:Datatype from
--   http://www.w3.org/TR/rdf-schema/#ch_datatype.
resRdfsDatatype :: RDFLabel

-- | rdf:XMLLiteral from
--   http://www.w3.org/TR/rdf-schema/#ch_xmlliteral.
resRdfXMLLiteral :: RDFLabel

-- | rdf:Property from
--   http://www.w3.org/TR/rdf-schema/#ch_property.
resRdfProperty :: RDFLabel

-- | rdfs:range from
--   http://www.w3.org/TR/rdf-schema/#ch_range.
resRdfsRange :: RDFLabel

-- | rdfs:domain from
--   http://www.w3.org/TR/rdf-schema/#ch_domain.
resRdfsDomain :: RDFLabel

-- | rdf:type from
--   http://www.w3.org/TR/rdf-schema/#ch_type.
resRdfType :: RDFLabel

-- | rdfs:subClassOf from
--   http://www.w3.org/TR/rdf-schema/#ch_subclassof.
resRdfsSubClassOf :: RDFLabel

-- | rdfs:subPropertyOf from
--   http://www.w3.org/TR/rdf-schema/#ch_subpropertyof.
resRdfsSubPropertyOf :: RDFLabel

-- | rdfs:label from
--   http://www.w3.org/TR/rdf-schema/#ch_label.
resRdfsLabel :: RDFLabel

-- | rdfs:comment from
--   http://www.w3.org/TR/rdf-schema/#ch_comment.
resRdfsComment :: RDFLabel

-- | rdfs:Container from
--   http://www.w3.org/TR/rdf-schema/#ch_container.
resRdfsContainer :: RDFLabel

-- | rdf:Bag from http://www.w3.org/TR/rdf-schema/#ch_bag.
resRdfBag :: RDFLabel

-- | rdf:Seq from http://www.w3.org/TR/rdf-schema/#ch_seq.
resRdfSeq :: RDFLabel

-- | rdf:Alt from http://www.w3.org/TR/rdf-schema/#ch_alt.
resRdfAlt :: RDFLabel

-- | rdfs:ContainerMembershipProperty from
--   http://www.w3.org/TR/rdf-schema/#ch_containermembershipproperty.
resRdfsContainerMembershipProperty :: RDFLabel

-- | rdfs:member from
--   http://www.w3.org/TR/rdf-schema/#ch_member.
resRdfsMember :: RDFLabel

-- | rdf:List from
--   http://www.w3.org/TR/rdf-schema/#ch_list.
resRdfList :: RDFLabel

-- | rdf:first from
--   http://www.w3.org/TR/rdf-schema/#ch_first.
resRdfFirst :: RDFLabel

-- | rdf:rest from
--   http://www.w3.org/TR/rdf-schema/#ch_rest.
resRdfRest :: RDFLabel

-- | rdf:nil from http://www.w3.org/TR/rdf-schema/#ch_nil.
resRdfNil :: RDFLabel

-- | rdf:Statement from
--   http://www.w3.org/TR/rdf-schema/#ch_statement.
resRdfStatement :: RDFLabel

-- | rdf:subject from
--   http://www.w3.org/TR/rdf-schema/#ch_subject.
resRdfSubject :: RDFLabel

-- | rdf:predicate from
--   http://www.w3.org/TR/rdf-schema/#ch_predicate.
resRdfPredicate :: RDFLabel

-- | rdf:object from
--   http://www.w3.org/TR/rdf-schema/#ch_object.
resRdfObject :: RDFLabel

-- | rdfs:seeAlso from
--   http://www.w3.org/TR/rdf-schema/#ch_seealso.
resRdfsSeeAlso :: RDFLabel

-- | rdfs:isDefinedBy from
--   http://www.w3.org/TR/rdf-schema/#ch_isdefinedby.
resRdfsIsDefinedBy :: RDFLabel

-- | rdf:value from
--   http://www.w3.org/TR/rdf-schema/#ch_value.
resRdfValue :: RDFLabel

-- | owl:sameAs.
resOwlSameAs :: RDFLabel

-- | rdfd:GeneralRestriction.
resRdfdGeneralRestriction :: RDFLabel

-- | rdfd:onProperties.
resRdfdOnProperties :: RDFLabel

-- | rdfd:constraint.
resRdfdConstraint :: RDFLabel

-- | rdfd:maxCardinality.
resRdfdMaxCardinality :: RDFLabel

-- | log:implies.
resLogImplies :: RDFLabel

-- | Match graphs, returning True if they are equivalent, with a map
--   of labels to equivalence class identifiers (see graphMatch for
--   further details).
grMatchMap :: Label lb => NSGraph lb -> NSGraph lb -> (Bool, LabelMap (ScopedLabel lb))

-- | Graph equality.
grEq :: Label lb => NSGraph lb -> NSGraph lb -> Bool

-- | Remap a single graph node.
--   
--   If the node is not one of those to be remapped, the supplied value is
--   returned unchanged.
mapnode :: Label lb => [lb] -> [lb] -> (lb -> lb) -> lb -> lb

-- | Construct a list of (oldnode,newnode) values to be used for graph
--   label remapping. The function operates recursively, adding new nodes
--   generated to the accumulator and also to the list of nodes to be
--   avoided.
maplist :: Label lb => [lb] -> [lb] -> (lb -> lb) -> [(lb, lb)] -> [(lb, lb)]
instance Label lb => Show (NSGraph lb)
instance Label lb => Ord (NSGraph lb)
instance Label lb => Eq (NSGraph lb)
instance Label lb => Monoid (NSGraph lb)
instance Label lb => LDGraph NSGraph lb
instance Label lb => Show (Formula lb)
instance (Ord lb, Ord gr) => Ord (LookupFormula lb gr)
instance (Eq lb, Eq gr) => Eq (LookupFormula lb gr)
instance FromRDFLabel URI
instance ToRDFLabel URI
instance FromRDFLabel QName
instance ToRDFLabel QName
instance FromRDFLabel ScopedName
instance ToRDFLabel ScopedName
instance FromRDFLabel Day
instance ToRDFLabel Day
instance FromRDFLabel UTCTime
instance ToRDFLabel UTCTime
instance FromRDFLabel Integer
instance ToRDFLabel Integer
instance FromRDFLabel Int
instance ToRDFLabel Int
instance FromRDFLabel Double
instance ToRDFLabel Double
instance FromRDFLabel Float
instance ToRDFLabel Float
instance FromRDFLabel Bool
instance ToRDFLabel Bool
instance FromRDFLabel String
instance ToRDFLabel String
instance FromRDFLabel Char
instance ToRDFLabel Char
instance FromRDFLabel RDFLabel
instance ToRDFLabel RDFLabel
instance IsString RDFLabel
instance Label RDFLabel
instance Ord RDFLabel
instance Show RDFLabel
instance Eq RDFLabel

-- | This module provides an in-memory RDF Graph (it re-exports
--   Swish.RDF.Graph).
module Swish.RDF

-- | Support for the RDF Parsing modules.
module Swish.RDF.Parser.Utils

-- | Type for special name lookup table
type SpecialMap = Map String ScopedName

-- | Define default table of namespaces
prefixTable :: [Namespace]

-- | Define default special-URI table.
specialTable :: Maybe ScopedName -> [(String, ScopedName)]

-- | Run the parser and return the successful parse or an error message
--   which consists of the standard Polyparse error plus a fragment of the
--   unparsed input to provide context.
runParserWithError :: Parser a b -> a -> Text -> Either String b

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Run the parser and ignore the result.
ignore :: Applicative f => f a -> f ()

-- | Match the character.
char :: Char -> Parser s Char

-- | Match the character, ignoring the result.
ichar :: Char -> Parser s ()

-- | Match the text.
string :: String -> Parser s String

-- | Match the text.
stringT :: Text -> Parser s Text

-- | Match the given string and any trailing whiteSpace.
symbol :: String -> Parser s String

-- | As symbol but ignoring the result.
isymbol :: String -> Parser s ()

-- | Convert a parser into one that also matches, and ignores, trailing
--   whiteSpace.
lexeme :: Parser s a -> Parser s a

-- | Succeed if the next character does not match the given function.
notFollowedBy :: (Char -> Bool) -> Parser s ()

-- | Match white space: a space or a comment (# character and
--   anything following it up to to a new line).
whiteSpace :: Parser s ()

-- | Run the parser many times and ignore the result.
skipMany :: Parser s a -> Parser s ()

-- | Run the parser many1 times and ignore the result.
skipMany1 :: Parser s a -> Parser s ()

-- | Match zero or more occurences of parser followed by separator.
endBy :: Parser s a -> Parser s b -> Parser s [a]

-- | Match zero or more occurences of the parser followed by the separator.
sepEndBy :: Parser s a -> Parser s b -> Parser s [a]

-- | Accept one or more occurences of the parser separated by the
--   separator. Unlike endBy the last separator is optional.
sepEndBy1 :: Parser s a -> Parser s b -> Parser s [a]

-- | Accept zero or more runs of the parser ending with the delimiter.
manyTill :: Parser s a -> Parser s b -> Parser s [a]

-- | Accept any character that is not a member of the given string.
noneOf :: String -> Parser s Char

-- | Match the end-of-line sequence (\n,
--   \r, or \r\n).
eoln :: Parser s ()

-- | Matches ..
fullStop :: Parser s ()

-- | A four-digit hex value (e.g. 1a34 or 03F1).
hex4 :: Parser a Char

-- | An eight-digit hex value that has a maximum of 0010FFFF.
hex8 :: Parser a Char

-- | Append the two URIs. Given the change in signature of
--   relativeTo in versino 2.4.0.0 of network, it
--   is not clear that this function is necessary. At the very lease, it
--   will be changed to just return a URI.
appendURIs :: URI -> URI -> Either String URI

-- | This Module implements a NTriples parser, returning a new
--   RDFGraph consisting of triples and namespace information parsed
--   from the supplied NTriples input string, or an error indication.
--   
--   REFERENCES:
--   
--   
--   
- "RDF Test Cases", W3C Recommendation 10 February 2004,
--   http://www.w3.org/TR/rdf-testcases/#ntriples
--   
--   
--   NOTES:
--   
--   
--   
- If the URI is actually an IRI (Internationalized Resource
--   Identifiers) then the parser will fail since parseURI
--   fails.
--   
- The case of language tags is retained.
--   
- Update to the document "N-Triples. A line-based syntax for an RDF
--   graph" W3C Working Group Note 09 April 2013,
--   http://www.w3.org/TR/2013/NOTE-n-triples-20130409/
--   
module Swish.RDF.Parser.NTriples

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Parse a string.
parseNT :: Text -> ParseResult

-- | This module defines functions for representing and manipulating query
--   binding variable sets. This is the key data that mediates between
--   query and back substitution when performing inferences. A framework of
--   query variable modifiers is provided that can be used to implement
--   richer inferences, such as filtering of query results, or replacing
--   values based on known relationships.
module Swish.VarBinding

-- | VarBinding is the type of an arbitrary variable bindings value, where
--   the type of the bound values is not specified.
data VarBinding a b
VarBinding :: (a -> Maybe b) -> Set (a, b) -> Bool -> VarBinding a b
vbMap :: VarBinding a b -> a -> Maybe b
vbEnum :: VarBinding a b -> Set (a, b)
vbNull :: VarBinding a b -> Bool

-- | The null, or empry, binding maps no query variables. This is the
--   mempty instance of the Monoid.
nullVarBinding :: VarBinding a b

-- | Return a list of the variables bound by a supplied variable binding
boundVars :: (Ord a, Ord b) => VarBinding a b -> Set a

-- | VarBinding subset function, tests to see if one query binding is a
--   subset of another; i.e. every query variable mapping defined by one is
--   also defined by the other.
subBinding :: (Ord a, Ord b) => VarBinding a b -> VarBinding a b -> Bool

-- | Function to make a variable binding from a list of pairs of variable
--   and corresponding assigned value.
makeVarBinding :: (Ord a, Ord b) => [(a, b)] -> VarBinding a b

-- | Apply query binding to a supplied value, returning the value unchanged
--   if no binding is defined
applyVarBinding :: VarBinding a a -> a -> a

-- | Join a pair of query bindings, returning a new binding that maps all
--   variables recognized by either of the input bindings. If the bindings
--   should overlap, such overlap is not detected and the value from the
--   first binding provided is used.
joinVarBindings :: (Ord a, Ord b) => VarBinding a b -> VarBinding a b -> VarBinding a b

-- | Add a single new value to a variable binding and return the resulting
--   new variable binding.
addVarBinding :: (Ord a, Ord b) => a -> b -> VarBinding a b -> VarBinding a b

-- | Define the type of a function to modify variable bindings in forward
--   chaining based on rule antecedent matches. This function is used to
--   implement the "allocated to" logic described in Appendix B of the RDF
--   semantics document, in which a specific blank node is associated with
--   all matches of some specific value by applications of the rule on a
--   given graph. Use id if no modification of the variable bindings
--   is required.
--   
--   This datatype consists of the modifier function itself, which operates
--   on a list of variable bindings rather than a single variable binding
--   (because some modifications share context across a set of bindings),
--   and some additional descriptive information that allows possible usage
--   patterns to be analyzed.
--   
--   Some usage patterns (see vbmUsage for more details):
--   
--   
--   
- filter all variables are input variables, and the effect of
--   the modifier function is to drop variable bindings that don't satisfy
--   some criterion. Identifiable by an empty element in
--   vbmUsage.
--   
- source all variables are output variables: a raw query
--   could be viewed as a source of variable bindings. Identifiable by an
--   element of vbmUsage equal to vbmVocab.
--   
- modifier for each supplied variable binding, one or more
--   new variable bindings may be created that contain the input variables
--   bound as supplied plus some additional variables. Identifiable by an
--   element of vbmUsage some subset of vbmVocab.
--   
--   
--   A variety of variable usage patterns may be supported by a given
--   modifier: a modifier may be used to define new variable bindings from
--   existing bindings in a number of ways, or simply to check that some
--   required relationship between bindings is satisfied. (Example, for
--   a + b = c, any one variable can be deduced from the other
--   two, or all three may be supplied to check that the relationship does
--   indeed hold.)
data VarBindingModify a b
VarBindingModify :: ScopedName -> ([VarBinding a b] -> [VarBinding a b]) -> [a] -> [[a]] -> VarBindingModify a b

-- | Name used to identify this variable binding modifier when building
--   inference rules.
vbmName :: VarBindingModify a b -> ScopedName

-- | Apply variable binding modifier to a list of variable bindings,
--   returning a new list. The result list is not necessarily the same
--   length as the supplied list.
vbmApply :: VarBindingModify a b -> [VarBinding a b] -> [VarBinding a b]

-- | List of variables used by this modifier. All results of applying this
--   modifier contain bindings for these variables.
vbmVocab :: VarBindingModify a b -> [a]

-- | List of binding modifier usage patterns supported. Each pattern is
--   characterized as a list of variables for which new bindings may be
--   created by some application of this modifier, assuming that bindings
--   for all other variables in vbmVocab are supplied.
vbmUsage :: VarBindingModify a b -> [[a]]

-- | Type for variable binding modifier that has yet to be instantiated
--   with respect to the variables that it operates upon.
type OpenVarBindingModify lb vn = [lb] -> VarBindingModify lb vn

-- | Extract variable binding name from OpenVarBindingModify value
--   
--   (Because only the name is required, the application to an undefined
--   list of variable labels should never be evaluated, as long as the name
--   is not dependent on the variable names in any way.)
--   
--   NOT QUITE... some of the functions that create
--   OpenVarBindingModify instances also pattern-match the number
--   of labels provided, forcing evaluation of the labels parameter, even
--   though it's not used.
openVbmName :: OpenVarBindingModify lb vn -> ScopedName

-- | Variable binding modifier compatibility test.
--   
--   Given a list of bound variables and a variable binding modifier,
--   return a list of new variables that may be bound, or Nothing.
--   
--   Note: if the usage pattern component is well-formed (i.e. all elements
--   different) then at most one element can be compatible with a given
--   input variable set.
vbmCompatibility :: Eq a => VarBindingModify a b -> [a] -> Maybe [a]

-- | Compose variable binding modifiers.
--   
--   Returns Just a new variable binding modifier that corresponds
--   to applying the first supplied modifier and then applying the second
--   one, or Nothing if the two modifiers cannot be compatibly
--   composed.
--   
--   NOTE: this function does not, in general, commute.
--   
--   NOTE: if there are different ways to achieve the same usage, that
--   usage is currently repeated in the result returned.
vbmCompose :: Eq a => VarBindingModify a b -> VarBindingModify a b -> Maybe (VarBindingModify a b)

-- | Compose sequence of variable binding modifiers.
composeSequence :: Eq a => [VarBindingModify a b] -> Maybe (VarBindingModify a b)

-- | Find all compatible compositions of a list of variable binding
--   modifiers for a given set of supplied bound variables.
findCompositions :: Eq a => [VarBindingModify a b] -> [a] -> [VarBindingModify a b]

-- | Return Just a compatible composition of variable binding
--   modifiers for a given set of supplied bound variables, or
--   Nothing if there is no compatible composition
findComposition :: Eq a => [VarBindingModify a b] -> [a] -> Maybe (VarBindingModify a b)

-- | VarBindingFilter is a function type that tests to see if a query
--   binding satisfies some criterion.
--   
--   Queries often want to apply some kind of filter or condition to the
--   variable bindings that are processed. In inference rules, it sometimes
--   seems desirable to stipulate additional conditions on the things that
--   are matched.
--   
--   This function type is used to perform such tests. A number of simple
--   implementations are included below.
data VarBindingFilter a b
VarBindingFilter :: ScopedName -> [a] -> (VarBinding a b -> Bool) -> VarBindingFilter a b
vbfName :: VarBindingFilter a b -> ScopedName
vbfVocab :: VarBindingFilter a b -> [a]
vbfTest :: VarBindingFilter a b -> VarBinding a b -> Bool

-- | Make a variable binding modifier from a variable binding filter value.
makeVarFilterModify :: VarBindingFilter a b -> VarBindingModify a b

-- | Make a variable test filter for a named variable using a supplied
--   value testing function.
makeVarTestFilter :: ScopedName -> (b -> Bool) -> a -> VarBindingFilter a b

-- | Make a variable comparison filter for named variables using a supplied
--   value comparison function.
makeVarCompareFilter :: ScopedName -> (b -> b -> Bool) -> a -> a -> VarBindingFilter a b

-- | Variable binding modifier that returns exactly those variable bindings
--   presented.
varBindingId :: VarBindingModify a b

-- | Null variable binding modifier
--   
--   This is like varBindingId except parameterized by some labels.
--   I think this is redundant, and should be eliminated.
nullVarBindingModify :: OpenVarBindingModify a b

-- | This function composes a number of query binding filters into a
--   composite filter that accepts any query binding that satisfies at
--   least one of the component values.
varFilterDisjunction :: Eq a => [VarBindingFilter a b] -> VarBindingFilter a b

-- | This function composes a number of query binding filters into a
--   composite filter that accepts any query binding that satisfies all of
--   the component values.
--   
--   The same function could be achieved by composing the component
--   filter-based modifiers, but this function is more convenient as it
--   avoids the need to check for modifier compatibility.
varFilterConjunction :: Eq a => [VarBindingFilter a b] -> VarBindingFilter a b

-- | This function generates a query binding filter that ensures that two
--   indicated query variables are mapped to the same value.
varFilterEQ :: Eq b => a -> a -> VarBindingFilter a b

-- | This function generates a query binding filter that ensures that two
--   indicated query variables are mapped to different values.
varFilterNE :: Eq b => a -> a -> VarBindingFilter a b
instance Show (OpenVarBindingModify a b)
instance (Show a, Show b) => Show (VarBinding a b)
instance (Ord a, Ord b) => Monoid (VarBinding a b)
instance (Ord a, Ord b) => Ord (VarBinding a b)
instance (Ord a, Ord b) => Eq (VarBinding a b)

-- | This module defines the structures used to represent and manipulate
--   datatypes. It is designed as a basis for handling datatyped RDF
--   literals, but the functions in this module are more generic.
module Swish.Datatype

-- | Datatype wraps a DatatypeVal value, hiding the value type that
--   is used only in implementations of the datatype. Users see just the
--   datatype name and associated ruleset.
data Datatype ex lb vn
Datatype :: (DatatypeVal ex vt lb vn) -> Datatype ex lb vn

-- | Get type name from Datatype value
typeName :: Datatype ex lb vn -> ScopedName

-- | Get static rules from Datatype value
typeRules :: Datatype ex lb vn -> Ruleset ex

-- | Make rules for Datatype value based on supplied expression
typeMkRules :: Datatype ex lb vn -> ex -> [Rule ex]

-- | Make variable binding modifiers based on values supplied
typeMkModifiers :: Datatype ex lb vn -> [OpenVarBindingModify lb vn]

-- | Get the canonical form of a datatype value.
typeMkCanonicalForm :: Datatype ex lb vn -> Text -> Maybe Text

-- | Get the named axiom from a Datatype value.
getTypeAxiom :: ScopedName -> Datatype ex lb vn -> Maybe (Formula ex)

-- | Get the named rule from a Datatype value.
getTypeRule :: ScopedName -> Datatype ex lb vn -> Maybe (Rule ex)

-- | DatatypeVal is a structure that defines a number of functions and
--   values that characterize the behaviour of a datatype.
--   
--   A datatype is specified with respect to (polymophic in) a given type
--   of (syntactic) expression with which it may be used, and a value type
--   (whose existence is hidden as an existential type within
--   DatatypeMap).
--   
--   (I tried hiding the value type with an internal existential
--   declaration, but that wouldn't wash. Hence this two-part structure
--   with Datatype in which the internal detail of the value type is
--   hidden from users of the Datatype class.)
--   
--   The datatype characteristic functions have two goals:
--   
--   
--   
- to support the general datatype entailment rules defined by the
--   RDF semantics specification, and
--   
- to define additional datatype-specific inference patterns by means
--   of which provide additional base functionality to applications based
--   on RDF inference.
--   
--   
--   Datatype-specific inferences are provided using the DatatypeRel
--   structure for a datatype, which allows a number of named relations to
--   be defined on datatype values, and provides mechanisms to calculate
--   missing values in a partially-specified member of a relation.
--   
--   Note that rules and variable binding modifiers that deal with combined
--   values of more than one datatype may be defined separately.
--   Definitions in this module are generally applicable only when using a
--   single datatype.
--   
--   An alternative model for datatype value calculations is inspired by
--   that introduced by CWM for arithmetic operations, e.g.
--   
--   
--   (1 2 3) math:sum ?x => ?x rdf:value 6
--   
--   
--   (where the bare integer n here is shorthand for
--   "n"^^xsd:integer).
--   
--   Datatype-specific inference patterns are provided in two ways:
--   
--   
--   
- by variable binding modifiers that can be combined with the query
--   results during forward- for backward-chaining of inference rules,
--   and
--   
- by the definition of inference rulesets that involve datatype
--   values.
--   
--   
--   I believe the first method to be more flexible than the second, in
--   that it more readily supports forward and backward chaining, but can
--   be used only through the definition of new rules.
--   
--   Type parameters:
--   
--   
--   
- ex is the type of expression with which the
--   datatype may be used.
--   
- vt is the internal value type with which the
--   labels are associated.
--   
- lb is the type of label that may be used as a
--   variable in an expression or rule.
--   
- vn is the type of node that may be used to carry a
--   value in an expression or rule.
--   
data DatatypeVal ex vt lb vn
DatatypeVal :: ScopedName -> Ruleset ex -> (ex -> [Rule ex]) -> [OpenVarBindingModify lb vn] -> DatatypeMap vt -> [DatatypeRel vt] -> [DatatypeMod vt lb vn] -> DatatypeVal ex vt lb vn

-- | Identifies the datatype, and also its value space class.
tvalName :: DatatypeVal ex vt lb vn -> ScopedName

-- | A set of named expressions and rules that are valid in in any theory
--   that recognizes the current datatype.
tvalRules :: DatatypeVal ex vt lb vn -> Ruleset ex

-- | A function that accepts an expression and devives some
--   datatype-dependent rules from it. This is provided as a hook for
--   creating datatyped class restriction rules.
tvalMkRules :: DatatypeVal ex vt lb vn -> ex -> [Rule ex]

-- | Constructs a list of open variable binding modifiers based on tvalMod,
--   but hiding the actual value type.
tvalMkMods :: DatatypeVal ex vt lb vn -> [OpenVarBindingModify lb vn]

-- | Lexical to value mapping, where vt is a datatype used within
--   a Haskell program to represent and manipulate values in the datatype's
--   value space
tvalMap :: DatatypeVal ex vt lb vn -> DatatypeMap vt

-- | A set of named relations on datatype values. Each relation accepts a
--   list of Maybe vt, and computes any unspecified values that
--   are in the relation with values supplied.
tvalRel :: DatatypeVal ex vt lb vn -> [DatatypeRel vt]

-- | A list of named values that are used to construct variable binding
--   modifiers, which in turn may be used by a rule definition.
--   
--   TODO: In due course, this value may be calculated automatically from
--   the supplied value for tvalRel.
tvalMod :: DatatypeVal ex vt lb vn -> [DatatypeMod vt lb vn]

-- | Return the named datatype value modifier, if it exists.
getDTMod :: ScopedName -> DatatypeVal ex vt lb vn -> Maybe (DatatypeMod vt lb vn)

-- | Return the named datatype relation, if it exists.
getDTRel :: ScopedName -> DatatypeVal ex vt lb vn -> Maybe (DatatypeRel vt)

-- | Get the canonical form of a datatype value, or Nothing.
tvalMkCanonicalForm :: DatatypeVal ex vt lb vn -> Text -> Maybe Text

-- | DatatypeMap consists of methods that perform lexical-to-value and
--   value-to-canonical-lexical mappings for a datatype.
--   
--   The datatype mappings apply to string lexical forms which are stored
--   as Text.
data DatatypeMap vt
DatatypeMap :: (Text -> Maybe vt) -> (vt -> Maybe Text) -> DatatypeMap vt

-- | Function to map a lexical string to the datatype value. This
--   effectively defines the lexical space of the datatype to be all
--   strings for which yield a value other than Nothing.
mapL2V :: DatatypeMap vt -> Text -> Maybe vt

-- | Function to map a value to its canonical lexical form, if it has such.
mapV2L :: DatatypeMap vt -> vt -> Maybe Text

-- | Datatype for a named relation on values of a datatype.
data DatatypeRel vt
DatatypeRel :: ScopedName -> DatatypeRelFn vt -> DatatypeRel vt
dtRelName :: DatatypeRel vt -> ScopedName
dtRelFunc :: DatatypeRel vt -> DatatypeRelFn vt

-- | Type for a datatype relation inference function.
--   
--   A datatype relation defines tuples of values that satisfy some
--   relation. A datatype relation inference function calculates values
--   that complete a relation with values supplied.
--   
--   The function accepts a list of Maybe vt, where vt is the
--   datatype value type. It returns one of:
--   
--   
--   
- Just a list of lists, where each inner list returned is a complete
--   set of values, including the values supplied, that are in the
--   relation.
--   
- Just an empty list is returned if the supplied values are
--   insufficient to compute any complete sets of values in the
--   relation.
--   
- Nothing if the supplied values are not consistent with the
--   relation.
--   
type DatatypeRelFn vt = [Maybe vt] -> Maybe [[vt]]

-- | Type for datatype relation predicate: accepts a list of values and
--   determines whether or not they satisfy the relation.
type DatatypeRelPr vt = [vt] -> Bool

-- | Given a list of argument values and a list of functions for
--   calculating new values from supplied values, return a list of argument
--   values, or Nothing if the supplied values are inconsistent
--   with the calculations specified.
--   
--   Each list of values returned corresponds to a set of values that
--   satisfy the relation, consistent with the values supplied.
--   
--   Functions are described as tuple consisting of:
--   
--   (a) a predicate that the argument is required to satisfy
--   
--   (b) a function to apply,
--   
--   (c) a function to apply function (b) to a list of arguments
--   
--   (d) argument list index values to which the function is applied.
--   
--   Each supplied argument is of the form Maybe a, where the
--   argument has value type a. Nothing indicates arguments of
--   unknown value.
--   
--   The basic idea is that, for each argument position in the relation, a
--   function may be supplied to calculate that argument's possible values
--   from some combination of the other arguments. The results calculated
--   in this way are compared with the original arguments provided: if the
--   values conflict then the relation is presumed to be unsatisfiable with
--   the supplied values, and Nothing is returned; if there are
--   any calculated values for arguments supplied without any values, then
--   tbe calculated values are used. If there are any arguments for which
--   no values are supplied or calculated, then the relation is presumed to
--   be underdetermined, and Just [] is returned.
altArgs :: Eq vt => DatatypeRelPr vt -> [(vt -> Bool, [b])] -> ((vt -> Bool) -> b -> [Maybe vt] -> Maybe [vt]) -> DatatypeRelFn vt

-- | altArgs support for unary functions: function descriptor type
type UnaryFnDescr a = (a -> a, Int)

-- | altArgs support for unary functions: function descriptor table
--   type
type UnaryFnTable a = [(a -> Bool, [UnaryFnDescr a])]

-- | altArgs support for unary functions: function applicator type
type UnaryFnApply a = (a -> Bool) -> UnaryFnDescr a -> [Maybe a] -> Maybe [a]

-- | altArgs support for unary functions: function applicator
unaryFnApp :: UnaryFnApply a

-- | altArgs support for binary functions: function descriptor type
type BinaryFnDescr a = (a -> a -> a, Int, Int)

-- | altArgs support for binary functions: function descriptor table
--   type
type BinaryFnTable a = [(a -> Bool, [BinaryFnDescr a])]

-- | altArgs support for binary functions: function applicator type
type BinaryFnApply a = (a -> Bool) -> BinaryFnDescr a -> [Maybe a] -> Maybe [a]

-- | altArgs support for binary functions: function applicator
binaryFnApp :: BinaryFnApply a

-- | altArgs support for binary function with provision for
--   indicating inconsistent supplied values: function descriptor type
type BinMaybeFnDescr a = (a -> a -> Maybe [a], Int, Int)

-- | altArgs support for binary function with provision for
--   indicating inconsistent supplied values: function descriptor table
--   type
type BinMaybeFnTable a = [(a -> Bool, [BinMaybeFnDescr a])]

-- | altArgs support for binary function with provision for
--   indicating inconsistent supplied values: function applicator type
type BinMaybeFnApply a = (a -> Bool) -> BinMaybeFnDescr a -> [Maybe a] -> Maybe [a]

-- | altArgs support for binary function with provision for
--   indicating inconsistent supplied values: function applicator
binMaybeFnApp :: BinMaybeFnApply a

-- | altArgs support for list functions (e.g. sum over list of
--   args), where first element of list is a fold over the rest of the
--   list, and remaining elements of list can be calculated in terms of the
--   result of the fold and the remaining elements
--   
--   List function descriptor is
--   
--   (a) list-fold function, f (e.g. (+)
--   
--   (b) list-fold identity, z (e.g. 0)
--   
--   (c) list-fold-function inverse, g (e.g. (-))
--   
--   (d) index of element to evaluate
--   
--   such that:
--   
--   
--   (a `f` z) == (z `f` a) == a
--   (a `g` c) == b <=> a == b `f` c
--   (a `g` z) == a
--   (a `g` a) == z
--   
--   
--   and the result of the folded function does not depend on the order
--   that the list elements are processed.
--   
--   NOTE: the list of ListFnDescr values supplied to altArgs
--   must be at least as long as the argument list. In many cases, Haskell
--   lazy evaluation can be used to supply an arbitrarily long list. See
--   test cases in spike-altargs.hs for an example.
--   
--   Function descriptor type
type ListFnDescr a = (a -> a -> a, a, a -> a -> a, Int)

-- | Function table type
type ListFnTable a = [(a -> Bool, [ListFnDescr a])]

-- | altArgs support for list functions: function applicator type
type ListFnApply a = (a -> Bool) -> ListFnDescr a -> [Maybe a] -> Maybe [a]

-- | altArgs support for list functions: function applicator
listFnApp :: ListFnApply a

-- | Wrapper for data type variable binding modifier included in a datatype
--   value.
data DatatypeMod vt lb vn
DatatypeMod :: ScopedName -> [ModifierFn vt] -> ApplyModifier lb vn -> DatatypeMod vt lb vn
dmName :: DatatypeMod vt lb vn -> ScopedName
dmModf :: DatatypeMod vt lb vn -> [ModifierFn vt]
dmAppf :: DatatypeMod vt lb vn -> ApplyModifier lb vn

-- | Datatype value modifier functions type
--   
--   Each function accepts a list of values and returns a list of values.
--   The exact significance of the different values supplied and returned
--   depends on the variable binding pattern used (cf.
--   ApplyModifier), but in all cases an empty list returned means
--   that the corresponding inputs are not consistent with the function and
--   cannot be used.
type ModifierFn vn = [vn] -> [vn]

-- | Type of function used to apply a data value modifier to specified
--   variables in a supplied variable binding. It also accepts the name of
--   the datatype modifier and carries it into the resulting variable
--   binding modifier.
--   
--   (Note that vn is not necessarily the same as vt, the
--   datatype value type: the modifier functions may be lifted or otherwise
--   adapted to operate on some other type from which the raw data values
--   are extracted.)
type ApplyModifier lb vn = ScopedName -> [ModifierFn vn] -> OpenVarBindingModify lb vn

-- | Null datatype value modifier
nullDatatypeMod :: DatatypeMod vt lb vn

-- | ApplyModifier function for use with DatatypeMod in cases
--   when the value mapping is a 1->1 function and inverse,
--   such as negate.
--   
--   
--   
- nam is the name from the DatatypeMod value
--   that is carried into the resulting variable binding modifier.
--   
- fns are functions used to implement details of the
--   variable binding modifier:
--   
--   
--   
--   
- is [x,y] -> [?], used as a filter (i.e. not creating
--   any new variable bindings), returning a non-empty list if x
--   and y are in the appropriate relationship.
--   
- is [y] -> [x], used to perform the calculation in a
--   forward direction.
--   
- is [x] -> [y], used to perform the calculation in a
--   backward direction. This may be the same as (2) (e.g. for negation) or
--   may be different (e.g. increment).
--   
--   
--   
--   
- lbs is a list of specific label values for which a
--   variable binding modifier will be generated. (The intent is that a
--   variable-free value can be generated as a Curried function, and
--   instantiated for particular variables as required.)
--   
--   
--   Note: an irrefutable pattern match for lbs is used so that a
--   name for the VarBindingModify value can be extracted using an
--   undefined label value.
makeVmod11inv :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | ApplyModifier function for use with DatatypeMod in cases
--   when the value mapping is a non-invertable 1->1 injection,
--   such as absolute value.
--   
--   
--   
- nam is the name from the DatatypeMod value
--   that is carried into the resulting variable binding modifier.
--   
- fns are functions used to implement details of the
--   variable binding modifier:
--   
--   
--   
--   
- is [x,y] -> [?], used as a filter (i.e. not creating
--   any new variable bindings), returning a non-empty list if x
--   and y are in the appropriate relationship.
--   
- is [x] -> [y], used to perform the
--   calculation.
--   
--   
--   
--   
- lbs is a list of specific label values for which a
--   variable binding modifier will be generated.
--   
--   
--   Note: an irrefutable pattern match for lbs is used so that a
--   name for the VarBindingModify value can be extracted using an
--   undefined label value.
makeVmod11 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | ApplyModifier function for use with DatatypeMod in cases
--   when the value mapping is a 2->1 invertable function, such
--   as addition or subtraction.
--   
--   
--   
- nam is the name from the DatatypeMod value
--   that is carried into the resulting variable binding modifier.
--   
- fns are functions used to implement details of the
--   variable binding modifier:
--   
--   
--   
--   
- is [x,y,z] -> [?], used as a filter (i.e. not creating
--   any new variable bindings), returning a non-empty list if x,
--   y and z are in the appropriate relationship.
--   
- is [y,z] -> [x], used to perform the calculation in a
--   forward direction.
--   
- is [x,z] -> [y], used to run the calculation backwards
--   to determine the first input argument
--   
- is [x,y] -> [z], used to run the calculation backwards
--   to determine the second input argument
--   
--   
--   
--   
- lbs is a list of specific label values for which a
--   variable binding modifier will be generated.
--   
--   
--   Note: an irrefutable pattern match for lbs is used so that a
--   name for the VarBindingModify value can be extracted using an
--   undefined label value.
makeVmod21inv :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | ApplyModifier function for use with DatatypeMod in cases
--   when the value mapping is a 2->1 non-invertable function,
--   such as logical AND or OR.
--   
--   
--   
- nam is the name from the DatatypeMod value
--   that is carried into the resulting variable binding modifier.
--   
- fns are functions used to implement details of the
--   variable binding modifier:
--   
--   
--   
--   
- is [x,y,z] -> [?], used as a filter (i.e. not creating
--   any new variable bindings), returning a non-empty list if x,
--   y and z are in the appropriate relationship.
--   
- is [y,z] -> [x], used to perform the calculation in a
--   forward direction.
--   
--   
--   
--   
- lbs is a list of specific label values for which a
--   variable binding modifier will be generated.
--   
--   
--   Note: an irrefutable pattern match for lbs is used so that a
--   name for the VarBindingModify value can be extracted using an
--   undefined label value.
makeVmod21 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | ApplyModifier function for use with DatatypeMod in cases
--   when the value mapping is a simple comparson of two values.
--   
--   
--   
- nam is the name from the DatatypeMod value
--   that is carried into the resulting variable binding modifier.
--   
- fns are functions used to implement details of the
--   variable binding modifier:
--   
--   
--   
--   
- is [x,y] -> [?], used as a filter (i.e. not creating
--   any new variable bindings), returning a non-empty list if x
--   and y are in the appropriate relationship.
--   
--   
--   
--   
- lbs is a list of specific label values for which a
--   variable binding modifier will be generated.
--   
--   
--   Note: an irrefutable pattern match for lbs is used so that a
--   name for the VarBindingModify value can be extracted using an
--   undefined label value.
makeVmod20 :: (Eq lb, Show lb, Eq vn, Show vn) => ApplyModifier lb vn

-- | ApplyModifier function for use with DatatypeMod in cases
--   when the value mapping is a 2->2 non-invertable function,
--   such as quotient/remainder
--   
--   
--   
- nam is the name from the DatatypeMod value
--   that is carried into the resulting variable binding modifier.
--   
- fns are functions used to implement details of the
--   variable binding modifier:
--   
--   
--   
--   
- is [w,x,y,z] -> [?], used as a filter (i.e. not
--   creating any new variable bindings), returning a non-empty list if
--   w, x, y and z are in the
--   appropriate relationship.
--   
- is [y,z] -> [w,x], used to perform the calculation
--   given two input values.
--   
--   
--   
--   
- lbs is a list of specific label values for which a
--   variable binding modifier will be generated.
--   
--   
--   Note: an irrefutable pattern match for lbs is used so that a
--   name for the VarBindingModify value can be extracted using an
--   undefined label value.
--   
--   NOTE: this might be generalized to allow one of w or
--   x to be specified, and return null if it doesn't match the
--   calculated value.
makeVmod22 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | ApplyModifier function for use with DatatypeMod in cases
--   when the value mapping is a N->1 function, such as Sigma
--   (sum) of a vector.
--   
--   
--   
- nam is the name from the DatatypeMod value
--   that is carried into the resulting variable binding modifier.
--   
- fns are functions used to implement details of the
--   variable binding modifier:
--   
--   
--   
--   
- is [x,y...] -> [?], used as a filter (i.e. not
--   creating any new variable bindings), returning a non-empty list if
--   x and y... are in the appropriate relationship.
--   
- is [y...] -> [x], used to perform the
--   calculation.
--   
--   
--   
--   
- lbs is a list of specific label values for which a
--   variable binding modifier will be generated.
--   
--   
--   Note: an irrefutable pattern match for lbs is used so that a
--   name for the VarBindingModify value can be extracted using an
--   undefined label value.
makeVmodN1 :: (Ord lb, Ord vn) => ApplyModifier lb vn

-- | Describe a subtype/supertype relationship between a pair of datatypes.
--   
--   Originally, I had this as a supertype field of the DatatypeVal
--   structure, but that suffered from some problems:
--   
--   
--   
- supertypes may be introduced retrospectively,
--   
- the relationship expressed with respect to a single datatype
--   cannot indicate how to do injections/restrictions between the
--   underlying value types.
--   
--   
--   
--   
- ex is the type of expression with which the
--   datatype may be used.
--   
- lb is the type of the variable labels used.
--   
- vn is the type of value node used to contain a
--   datatyped value
--   
- supvt is the internal value type of the
--   super-datatype
--   
- subvt is the internal value type of the
--   sub-datatype
--   
data DatatypeSub ex lb vn supvt subvt
DatatypeSub :: DatatypeVal ex supvt lb vn -> DatatypeVal ex subvt lb vn -> (subvt -> supvt) -> (supvt -> Maybe subvt) -> DatatypeSub ex lb vn supvt subvt

-- | Datatype that is a supertype of trelSub, having value space
--   supvt.
trelSup :: DatatypeSub ex lb vn supvt subvt -> DatatypeVal ex supvt lb vn

-- | Datatype that is a subtype of trelSup, having value space
--   supvt.
trelSub :: DatatypeSub ex lb vn supvt subvt -> DatatypeVal ex subvt lb vn

-- | Function that maps subtype value to corresponding supertype value.
trelToSup :: DatatypeSub ex lb vn supvt subvt -> subvt -> supvt

-- | Function that maps supertype value to corresponding subtype value, if
--   there is such a value.
trelToSub :: DatatypeSub ex lb vn supvt subvt -> supvt -> Maybe subvt

-- | This module defines the datatytpe mapping and relation values used for
--   RDF dataype xsd:decimal.
module Swish.RDF.Datatype.XSD.MapDecimal

-- | Functions that perform lexical-to-value and value-to-canonical-lexical
--   mappings for xsd:decimal values.
mapXsdDecimal :: DatatypeMap Double

-- | This module defines the datatytpe mapping and relation values used for
--   RDF dataype xsd:integer.
module Swish.RDF.Datatype.XSD.MapInteger

-- | Functions that perform lexical-to-value and value-to-canonical-lexical
--   mappings for xsd:integer values.
mapXsdInteger :: DatatypeMap Integer

-- | This module instantiates the VarBinding types and methods for
--   use with RDF graph labels.
module Swish.RDF.VarBinding

-- | RDFVarBinding is the specific type type of a variable binding
--   value used with RDF graph queries.
type RDFVarBinding = VarBinding RDFLabel RDFLabel

-- | Define type of query binding modifier for RDF graph inference
type RDFVarBindingModify = VarBindingModify RDFLabel RDFLabel

-- | Open variable binding modifier that operates on RDFLabel values
type RDFOpenVarBindingModify = OpenVarBindingModify RDFLabel RDFLabel

-- | Define type for lookup map of open query binding modifiers
type RDFOpenVarBindingModifyMap = Map ScopedName RDFOpenVarBindingModify

-- | RDFVarBindingFilter is a function type that tests to see if a
--   query binding satisfies some criterion, and is used to create a
--   variable binding modifier that simply filers given variable bindings.
--   
--   Queries often want to apply some kind of filter or condition to the
--   variable bindings that are processed. In inference rules, it sometimes
--   seems desirable to stipulate additional conditions on the things that
--   are matched.
--   
--   This function type is used to perform such tests. A number of simple
--   implementations are included.
type RDFVarBindingFilter = VarBindingFilter RDFLabel RDFLabel

-- | maps no query variables.
nullRDFVarBinding :: RDFVarBinding

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a URI reference.
rdfVarBindingUriRef :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a blank node.
rdfVarBindingBlank :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a literal value.
rdfVarBindingLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to an untyped literal value.
rdfVarBindingUntypedLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a typed literal value.
rdfVarBindingTypedLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to an XML literal value.
rdfVarBindingXMLLiteral :: RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to a literal value with a datatype whose
--   URI is bound to another node
rdfVarBindingDatatyped :: RDFLabel -> RDFLabel -> RDFVarBindingFilter

-- | This function generates a query binding filter that ensures an
--   indicated variable is bound to container membership property.
rdfVarBindingMemberProp :: RDFLabel -> RDFVarBindingFilter

-- | This module defines the structures used by Swish to represent and
--   manipulate RDF datatypes.
module Swish.RDF.Datatype

-- | RDF datatype wrapper used with RDF graph values
type RDFDatatype = Datatype RDFGraph RDFLabel RDFLabel

-- | RDF datatype value used with RDF graph values
type RDFDatatypeVal vt = DatatypeVal RDFGraph vt RDFLabel RDFLabel

-- | RDF datatype modifier used with RDF graph values
type RDFDatatypeMod vt = DatatypeMod vt RDFLabel RDFLabel

-- | RDF value modifier function type
--   
--   This indicates a modifier function that operates on RDFLabel
--   values.
type RDFModifierFn = ModifierFn RDFLabel

-- | RDF value modifier application function type
--   
--   This indicates a function that applies RDFModifierFn functions.
type RDFApplyModifier = ApplyModifier RDFLabel RDFLabel

-- | Create an RDFOpenVarBindingModify value.
--   
--   The key purpose of this function is to lift the supplied variable
--   constraint functions from operating on data values directly to a
--   corresponding list of functions that operate on values contained in
--   RDF graph labels (i.e. RDF literal nodes). It also applies node type
--   checking, such that if the actual RDF nodes supplied do not contain
--   appropriate values then the variable binding is not accepted.
makeRdfDtOpenVarBindingModify :: RDFDatatypeVal vt -> RDFDatatypeMod vt -> RDFOpenVarBindingModify

-- | Create all RDFOpenVarBindingModify values for a given datatype value.
--   See makeRdfDtOpenVarBindingModify.
makeRdfDtOpenVarBindingModifiers :: RDFDatatypeVal vt -> [RDFOpenVarBindingModify]

-- | Apply a datatype modifier using supplied RDF labels to a supplied RDF
--   variable binding.
applyRDFDatatypeMod :: RDFDatatypeVal vt -> RDFDatatypeMod vt -> [RDFLabel] -> [RDFVarBinding] -> [RDFVarBinding]

-- | Describe a subtype/supertype relationship between a pair of RDF
--   datatypes.
type RDFDatatypeSub supvt subvt = DatatypeSub RDFGraph RDFLabel RDFLabel supvt subvt

-- | Convert from a typed literal to a Haskell value, with the possibility
--   of failure.
fromRDFLabel :: RDFDatatypeVal vt -> RDFLabel -> Maybe vt

-- | Convert a Haskell value to a typed literal (label), with the
--   possibility of failure.
toRDFLabel :: RDFDatatypeVal vt -> vt -> Maybe RDFLabel

-- | Create a typed literal. No conversion is made to the string
--   representation.
makeDatatypedLiteral :: ScopedName -> Text -> RDFLabel

-- | This Module implements a Turtle parser, returning a new
--   RDFGraph consisting of triples and namespace information parsed
--   from the supplied input string, or an error indication.
--   
--   REFERENCES:
--   
--   
--   
- "Turtle, Terse RDF Triple Language", W3C Candidate Recommendation
--   19 February 2013
--   (<http:www.w3.orgTR2013CR-turtle-20130219L),
--   http://www.w3.org/TR/turtle/
--   
--   
--   NOTES:
--   
--   
--   
- Prior to version 0.9.0.4, the parser followed the W3C
--   Working Draft 09 August 2011
--   (http://www.w3.org/TR/2011/WD-turtle-20110809/)
--   
- Strings with no language tag are converted to a LitTag
--   not a TypedLitTag with a type of xsd:string (e.g.
--   see http://www.w3.org/TR/2011/WD-turtle-20110809/#terms).
--   
- If the URI is actually an IRI (Internationalized Resource
--   Identifiers) then the parser will fail since parseURI
--   fails.
--   
- The current (August 2013) Turtle test suite from
--   http://www.w3.org/2013/TurtleTests/ passes except for the four
--   tests with non-ASCII local names, namely:
--   localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries,
--   localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries,
--   localName_with_nfc_PN_CHARS_BASE_character_boundaries, and
--   localName_with_non_leading_extras.
--   
module Swish.RDF.Parser.Turtle

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Parse a string with an optional base URI.
--   
--   Unlike parseN3 we treat the base URI as a URI and not a
--   QName.
parseTurtle :: Text -> Maybe URI -> ParseResult

-- | Parse as Turtle (with no real base URI).
--   
--   See parseTurtle if you need to provide a base URI.
parseTurtlefromText :: Text -> ParseResult
instance Show TurtleState

-- | This Module implements a Notation 3 parser, returning a new
--   RDFGraph consisting of triples and namespace information parsed
--   from the supplied N3 input string, or an error indication.
--   
--   REFERENCES:
--   
--   
--   
- "Notation3 (N3): A readable RDF syntax", W3C Team Submission 14
--   January 2008,
--   http://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/
--   
- Tim Berners-Lee's design issues series notes and description,
--   http://www.w3.org/DesignIssues/Notation3.html
--   
- Notation 3 Primer by Sean Palmer,
--   http://www.w3.org/2000/10/swap/Primer.html
--   
--   
--   NOTES:
--   
--   
--   
- The parser needs to be updated to the latest version ("W3C Team
--   Submission 28 March 2011",
--   http://www.w3.org/TeamSubmission/2011/SUBM-n3-20110328/)
--   
- UTF-8 handling is not really tested.
--   
- No performance testing has been applied.
--   
- Not all N3 grammar elements are supported, including:
--   
- @forSome (we read it in but ignore the arguments)
--   
- @forAll (this causes a parse error)
--   
- formulae are lightly tested
--   
- string support is incomplete (e.g. unrecognized escape characters
--   such as \q are probably handled incorrectly)
--   
module Swish.RDF.Parser.N3

-- | The result of a parse, which is either an error message or a graph.
type ParseResult = Either String RDFGraph

-- | Parse a string with an optional base URI.
--   
--   See also parseN3fromString.
parseN3 :: Text -> Maybe QName -> ParseResult

-- | Parse a string as N3 (with no real base URI).
--   
--   See parseN3 if you need to provide a base URI.
parseN3fromText :: Text -> ParseResult

-- | Function to supply initial context and parse supplied term.
parseAnyfromText :: N3Parser a -> Maybe QName -> Text -> Either String a

-- | Used in testing.
parseTextFromText :: String -> Text -> Either String String

-- | Used in testing.
parseAltFromText :: String -> String -> Text -> Either String String

-- | Used in testing.
parseNameFromText :: Text -> Either String String

-- | Used in testing.
parseAbsURIrefFromText :: Text -> Either String URI

-- | Used in testing.
parseLexURIrefFromText :: Text -> Either String URI

-- | Used in testing.
parseURIref2FromText :: Text -> Either String ScopedName

-- | The N3 parser.
type N3Parser a = Parser N3State a

-- | N3 parser state
data N3State
N3State :: RDFGraph -> RDFLabel -> NamespaceMap -> SpecialMap -> Word32 -> [Text] -> Bool -> N3State
graphState :: N3State -> RDFGraph
thisNode :: N3State -> RDFLabel
prefixUris :: N3State -> NamespaceMap
syntaxUris :: N3State -> SpecialMap
nodeGen :: N3State -> Word32
keywordsList :: N3State -> [Text]
allowLocalNames :: N3State -> Bool

-- | Type for special name lookup table
type SpecialMap = Map String ScopedName

-- | Process the remainder of an @prefix line (after this has been
--   processed). The prefix value and URI are added to the parser state.
getPrefix :: N3Parser ()

-- | Match a N3 symbol (an explicit URI or a QName) and convert it to a
--   ScopedName.
n3symbol :: N3Parser ScopedName

-- | Match ?name.
quickVariable :: N3Parser RDFLabel

-- | An explicitly given URI followed by white space.
lexUriRef :: N3Parser URI

-- | Process a N3 document, returning a graph.
document :: N3Parser RDFGraph

-- | Process a sub graph and assign it to the given label.
subgraph :: RDFLabel -> N3Parser RDFGraph

-- | Create a new blank node.
newBlankNode :: N3Parser RDFLabel

-- | This module defines functions for querying an RDF graph to obtain a
--   set of variable substitutions, and to apply a set of variable
--   substitutions to a query pattern to obtain a new graph.
--   
--   It also defines a few primitive graph access functions.
--   
--   A minimal example is shown below, where we query a very simple graph:
--   
--   
--   >>> :m + Swish.RDF Swish.RDF.Parser.N3 Swish.RDF.Query
--   
--   >>> :set -XOverloadedStrings
--   
--   >>> let qparse = either error id . parseN3fromText
--   
--   >>> let igr = qparse "@prefix a: <http://example.com/>. a:a a a:A ; a:foo a:bar. a:b a a:B ; a:foo a:bar."
--   
--   >>> let qgr = qparse "?node a ?type."
--   
--   >>> rdfQueryFind qgr igr
--   [[(?type,a:B),(?node,a:b)],[(?type,a:A),(?node,a:a)]]
--   
--   >>> let bn = (toRDFLabel . Data.Maybe.fromJust . Network.URI.parseURI) "http://example.com/B"
--   
--   >>> rdfFindArcs (rdfObjEq bn) igr
--   [(a:b,rdf:type,a:B)]
--   
--   >>> Data.Maybe.mapMaybe (flip Swish.RDF.VarBinding.vbMap (Var "type")) $ rdfQueryFind qgr igr
--   [a:B,a:A]
--   
module Swish.RDF.Query

-- | Basic graph-query function.
--   
--   The triples of the query graph are matched sequentially against the
--   target graph, each taking account of any variable bindings that have
--   already been determined, and adding new variable bindings as triples
--   containing query variables are matched against the graph.
rdfQueryFind :: RDFGraph -> RDFGraph -> [RDFVarBinding]

-- | RDF query filter.
--   
--   This function applies a supplied query binding filter to the result
--   from a call of rdfQueryFind.
--   
--   If none of the query bindings found satisfy the filter, a null list is
--   returned (which is what rdfQueryFind returns if the query
--   cannot be satisfied).
--   
--   (Because of lazy evaluation, this should be as efficient as applying
--   the filter as the search proceeds. I started to build the filter logic
--   into the query function itself, with consequent increase in
--   complexity, until I remembered lazy evaluation lets me keep things
--   separate.)
rdfQueryFilter :: RDFVarBindingFilter -> [RDFVarBinding] -> [RDFVarBinding]

-- | Reverse graph-query function.
--   
--   Similar to rdfQueryFind, but with different success criteria.
--   The query graph is matched against the supplied graph, but not every
--   triple of the query is required to be matched. Rather, every triple of
--   the target graph must be matched, and substitutions for just the
--   variables thus bound are returned. In effect, these are subsitutions
--   in the query that entail the target graph (where rdfQueryFind
--   returns substitutions that are entailed by the target graph).
--   
--   Multiple substitutions may be used together, so the result returned is
--   a list of lists of query bindings. Each inner list contains several
--   variable bindings that must all be applied separately to the closure
--   antecendents to obtain a collection of expressions that together are
--   antecedent to the supplied conclusion. A null list of bindings
--   returned means the conclusion can be inferred without any antecedents.
--   
--   Note: in back-chaining, the conditions required to prove each target
--   triple are derived independently, using the inference rule for each
--   such triple, so there are no requirements to check consistency with
--   previously determined variable bindings, as there are when doing
--   forward chaining. A result of this is that there may be redundant
--   triples generated by the back-chaining process. Any process using
--   back-chaining should deal with the results returned accordingly.
--   
--   An empty outer list is returned if no combination of substitutions can
--   infer the supplied target.
rdfQueryBack :: RDFGraph -> RDFGraph -> [[RDFVarBinding]]

-- | RDF back-chaining query filter. This function applies a supplied query
--   binding filter to the result from a call of rdfQueryBack.
--   
--   Each inner list contains bindings that must all be used to satisfy the
--   backchain query, so if any query binding does not satisfy the filter,
--   the entire corresponding row is removed
rdfQueryBackFilter :: RDFVarBindingFilter -> [[RDFVarBinding]] -> [[RDFVarBinding]]

-- | RDF back-chaining query modifier. This function applies a supplied
--   query binding modifier to the result from a call of
--   rdfQueryBack.
--   
--   Each inner list contains bindings that must all be used to satisfy a
--   backchaining query, so if any query binding does not satisfy the
--   filter, the entire corresponding row is removed
rdfQueryBackModify :: VarBindingModify a b -> [[VarBinding a b]] -> [[VarBinding a b]]

-- | Simple entailment (instance) graph query.
--   
--   This function queries a graph to find instances of the query graph in
--   the target graph. It is very similar to the normal forward chaining
--   query rdfQueryFind, except that blank nodes rather than query
--   variable nodes in the query graph are matched against nodes in the
--   target graph. Neither graph should contain query variables.
--   
--   An instance is defined by the RDF semantics specification, per
--   http://www.w3.org/TR/rdf-mt/, and is obtained by replacing
--   blank nodes with URIs, literals or other blank nodes. RDF simple
--   entailment can be determined in terms of instances. This function
--   looks for a subgraph of the target graph that is an instance of the
--   query graph, which is a necessary and sufficient condition for RDF
--   entailment (see the Interpolation Lemma in RDF Semantics, section
--   1.2).
--   
--   It is anticipated that this query function can be used in conjunction
--   with backward chaining to determine when the search for sufficient
--   antecendents to determine some goal has been concluded.
rdfQueryInstance :: RDFGraph -> RDFGraph -> [RDFVarBinding]

-- | Graph substitution function.
--   
--   Uses the supplied variable bindings to substitute variables in a
--   supplied graph, returning a list of result graphs corresponding to
--   each set of variable bindings applied to the input graph. This
--   function is used for formward chaining substitutions, and returns only
--   those result graphs for which all query variables are bound.
rdfQuerySubs :: [RDFVarBinding] -> RDFGraph -> [RDFGraph]

-- | Graph back-substitution function.
--   
--   Uses the supplied variable bindings from rdfQueryBack to
--   perform a series of variable substitutions in a supplied graph,
--   returning a list of lists of result graphs corresponding to each set
--   of variable bindings applied to the input graphs.
--   
--   The outer list of the result contains alternative antecedent lists
--   that satisfy the query goal. Each inner list contains graphs that must
--   all be inferred to satisfy the query goal.
rdfQueryBackSubs :: [[RDFVarBinding]] -> RDFGraph -> [[(RDFGraph, [RDFLabel])]]

-- | Graph substitution function.
--   
--   This function performs the substitutions and returns a list of result
--   graphs each paired with a list unbound variables in each.
rdfQuerySubsAll :: [RDFVarBinding] -> RDFGraph -> [(RDFGraph, [RDFLabel])]

-- | Graph substitution function.
--   
--   This function performs each of the substitutions in vars, and
--   replaces any nodes corresponding to unbound query variables with new
--   blank nodes.
rdfQuerySubsBlank :: [RDFVarBinding] -> RDFGraph -> [RDFGraph]

-- | Graph back-substitution function, replacing variables with bnodes.
--   
--   Uses the supplied variable bindings from rdfQueryBack to
--   perform a series of variable substitutions in a supplied graph,
--   returning a list of lists of result graphs corresponding to each set
--   of variable bindings applied to the input graphs.
--   
--   The outer list of the result contains alternative antecedent lists
--   that satisfy the query goal. Each inner list contains graphs that must
--   all be inferred to satisfy the query goal.
rdfQueryBackSubsBlank :: [[RDFVarBinding]] -> RDFGraph -> [[RDFGraph]]

-- | Take a predicate on an RDF statement and a graph, and returns all
--   statements in the graph satisfying that predicate.
--   
--   Use combinations of these as follows:
--   
--   
--   
- find all statements with given subject: rdfFindArcs (rdfSubjEq
--   s)
--   
- find all statements with given property: rdfFindArcs
--   (rdfPredEq p)
--   
- find all statements with given object: rdfFindArcs (rdfObjEq
--   o)
--   
- find all statements matching conjunction of these conditions:
--   rdfFindArcs (allp [...])
--   
- find all statements matching disjunction of these conditions:
--   rdfFindArcs (anyp [...])
--   
--   
--   Custom predicates can also be used.
rdfFindArcs :: (RDFTriple -> Bool) -> RDFGraph -> [RDFTriple]

-- | Test if statement has given subject
rdfSubjEq :: RDFLabel -> RDFTriple -> Bool

-- | Test if statement has given predicate
rdfPredEq :: RDFLabel -> RDFTriple -> Bool

-- | Test if statement has given object
rdfObjEq :: RDFLabel -> RDFTriple -> Bool

-- | Find values of given predicate for a given subject
rdfFindPredVal :: RDFLabel -> RDFLabel -> RDFGraph -> [RDFLabel]

-- | Find integer values of a given predicate for a given subject
rdfFindPredInt :: RDFLabel -> RDFLabel -> RDFGraph -> [Integer]

-- | Find all subjects that match (subject, predicate, object) in the
--   graph.
rdfFindValSubj :: RDFLabel -> RDFLabel -> RDFGraph -> [RDFLabel]

-- | Return a list of nodes that comprise an rdf:collection value, given
--   the head element of the collection. If the list is ill-formed then an
--   arbitrary value is returned.
rdfFindList :: RDFGraph -> RDFLabel -> [RDFLabel]

-- | Test if a value satisfies all predicates in a list
allp :: [a -> Bool] -> a -> Bool

-- | Test if a value satisfies any predicate in a list
anyp :: [a -> Bool] -> a -> Bool

-- | This function applies a substitution for a single set of variable
--   bindings, returning the result and a list of unbound variables. It
--   uses a state transformer monad to collect the list of unbound
--   variables.
--   
--   Adding an empty graph forces elimination of duplicate arcs.
rdfQuerySubs2 :: RDFVarBinding -> RDFGraph -> (RDFGraph, [RDFLabel])

-- | This module defines some datatypes and functions that are used to
--   define rules and rulesets over RDF graphs.
--   
--   For the routines that accept a graph in N3 format, the following
--   namespaces are pre-defined for use by the graph: rdf: and
--   rdfs:.
module Swish.RDF.Ruleset

-- | A named formula expressed as a RDF Graph.
type RDFFormula = Formula RDFGraph

-- | A named inference rule expressed in RDF.
type RDFRule = Rule RDFGraph

-- | A map for RDFRule rules.
type RDFRuleMap = RuleMap RDFGraph

-- | A GraphClosure for RDF statements.
type RDFClosure = GraphClosure RDFLabel

-- | A Ruleset for RDF.
type RDFRuleset = Ruleset RDFGraph

-- | A map for RDFRuleset.
type RDFRulesetMap = RulesetMap RDFGraph

-- | The null RDF formula.
nullRDFFormula :: Formula RDFGraph

-- | Datatype for constructing a graph closure rule
data GraphClosure lb
GraphClosure :: ScopedName -> ArcSet lb -> ArcSet lb -> VarBindingModify lb lb -> GraphClosure lb

-- | Name of rule for proof display
nameGraphRule :: GraphClosure lb -> ScopedName

-- | Antecedent triples pattern (may include variable nodes)
ruleAnt :: GraphClosure lb -> ArcSet lb

-- | Consequent triples pattern (may include variable nodes)
ruleCon :: GraphClosure lb -> ArcSet lb

-- | Structure that defines additional constraints and/or variable bindings
--   based on other matched query variables. Matching the antecedents. Use
--   varBindingId if no additional variable constraints or bindings
--   are added beyond those arising from graph queries.
ruleModify :: GraphClosure lb -> VarBindingModify lb lb

-- | Define a value of type Rule based on an RDFClosure value.
makeGraphClosureRule :: GraphClosure RDFLabel -> Rule RDFGraph

-- | Helper function to parse a string containing Notation3 and return the
--   corresponding RDFGraph value.
makeRDFGraphFromN3Builder :: Builder -> RDFGraph

-- | Create an RDF formula.
makeRDFFormula :: Namespace -> LName -> Builder -> RDFFormula

-- | Constructs an RDF graph closure rule. That is, a rule that given some
--   set of antecedent statements returns new statements that may be added
--   to the graph.
makeRDFClosureRule :: ScopedName -> [RDFGraph] -> RDFGraph -> RDFVarBindingModify -> RDFRule

-- | Constructs an RDF graph closure rule. That is, a rule that given some
--   set of antecedent statements returns new statements that may be added
--   to the graph. This is the basis for implementation of most of the
--   inference rules given in the RDF formal semantics document.
makeN3ClosureRule :: Namespace -> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule

-- | Construct a simple RDF graph closure rule without additional node
--   allocations or variable binding constraints.
makeN3ClosureSimpleRule :: Namespace -> LName -> Builder -> Builder -> RDFRule

-- | Constructs an RDF graph closure rule that incorporates a variable
--   binding filter and a variable binding modifier.
makeN3ClosureModifyRule :: Namespace -> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFVarBindingModify -> RDFRule

-- | Construct an RDF graph closure rule with a bnode allocator.
--   
--   This function is rather like makeN3ClosureModifyRule, except
--   that the variable binding modifier is a function from the variables in
--   the variables and bnodes contained in the antecedent graph.
makeN3ClosureAllocatorRule :: Namespace -> LName -> Builder -> Builder -> RDFVarBindingModify -> ([RDFLabel] -> RDFVarBindingModify) -> RDFRule

-- | This function defines a variable binding modifier that allocates a new
--   blank node for each value bound to a query variable, and binds it to
--   another variable in each query binding.
--   
--   This provides a single binding for query variables that would
--   otherwise be unbound by a query. For example, consider the inference
--   pattern:
--   
--   
--   ?a hasUncle ?c => ?a hasFather ?b . ?b hasBrother ?c .
--   
--   
--   For a given ?a and ?c, there is insufficient
--   information here to instantiate a value for variable ?b.
--   Using this function as part of a graph instance closure rule allows
--   forward chaining to allocate a single bnode for each occurrence of
--   ?a, so that given:
--   
--   
--   Jimmy hasUncle Fred .
--   Jimmy hasUncle Bob .
--   
--   
--   leads to exactly one bnode inference of:
--   
--   
--   Jimmy hasFather _:f .
--   
--   
--   giving:
--   
--   
--   Jimmy hasFather _:f .
--   _:f   hasBrother Fred .
--   _:f   hasBrother Bob .
--   
--   
--   rather than:
--   
--   
--   Jimmy hasFather _:f1 .
--   _:f1  hasBrother Fred .
--   Jimmy hasFather _:f2 .
--   _:f2  hasBrother Bob .
--   
--   
--   This form of constrained allocation of bnodes is also required for
--   some of the inference patterns described by the RDF formal semantics,
--   particularly those where bnodes are substituted for URIs or literals.
makeNodeAllocTo :: RDFLabel -> RDFLabel -> [RDFLabel] -> RDFVarBindingModify

-- | Forward chaining function based on RDF graph closure description
--   
--   Note: antecedents here are presumed to share bnodes.
graphClosureFwdApply :: GraphClosure RDFLabel -> [RDFGraph] -> [RDFGraph]

-- | Backward chaining function based on RDF graph closure description
graphClosureBwdApply :: GraphClosure RDFLabel -> RDFGraph -> [[RDFGraph]]
instance Label lb => Show (GraphClosure lb)
instance Label lb => Eq (GraphClosure lb)

-- | This module implements an inference rule based on a restruction on
--   class membership of one or more values.
module Swish.RDF.ClassRestrictionRule

-- | Datatype for named class restriction
data ClassRestriction
ClassRestriction :: ScopedName -> ClassRestrictionFn -> ClassRestriction
crName :: ClassRestriction -> ScopedName
crFunc :: ClassRestriction -> ClassRestrictionFn

-- | Type of function that evaluates missing node values in a restriction
--   from those supplied.
type ClassRestrictionFn = [Maybe RDFLabel] -> Maybe [[RDFLabel]]

-- | Make a class restriction from a datatype relation.
--   
--   This lifts application of the datatype relation to operate on
--   RDFLabel values, which are presumed to contain appropriately
--   datatyped values.
makeDatatypeRestriction :: RDFDatatypeVal vt -> DatatypeRel vt -> ClassRestriction

-- | Make a class restriction function from a datatype relation function.
makeDatatypeRestrictionFn :: RDFDatatypeVal vt -> DatatypeRelFn vt -> ClassRestrictionFn

-- | Make a list of class restriction rules given a list of class
--   restriction values and a graph containing one or more class
--   restriction definitions.
makeRDFClassRestrictionRules :: [ClassRestriction] -> RDFGraph -> [RDFRule]

-- | Make restriction rules from the supplied datatype and graph.
makeRDFDatatypeRestrictionRules :: RDFDatatypeVal vt -> RDFGraph -> [RDFRule]

-- | The graph
--   
--   
--   _:a <http://id.ninebynine.org/2003/rdfext/rdfd#false> _:b .
--   
--   
--   Exported for testing.
falseGraph :: RDFGraph

-- | Exported for testing.
falseGraphStr :: Builder
instance Show ClassRestriction
instance Eq ClassRestriction

-- | This module defines the structures used to represent and manipulate
--   RDF xsd:string datatyped literals.
module Swish.RDF.Datatype.XSD.String

-- | The RDFDatatype value for xsd:string.
rdfDatatypeXsdString :: RDFDatatype

-- | Define Datatype value for xsd:string.
rdfDatatypeValXsdString :: RDFDatatypeVal Text

-- | Type name for xsd:string datatype
typeNameXsdString :: ScopedName

-- | Namespace for xsd:string datatype functions
namespaceXsdString :: Namespace

-- | The axioms for xsd:string, which are
--   
--   
--   xsd:string a rdfs:Datatype .
--   
axiomsXsdString :: [RDFFormula]

-- | The rules for xsd:string.
rulesXsdString :: [RDFRule]

-- | This module defines the structures used to represent and manipulate
--   RDF xsd:integer datatyped literals.
module Swish.RDF.Datatype.XSD.Integer

-- | The RDFDatatype value for xsd:integer.
rdfDatatypeXsdInteger :: RDFDatatype

-- | Define Datatype value for xsd:integer.
--   
--   Members of this datatype are positive or negative integer values.
--   
--   The lexical form consists of an optional + or -
--   followed by a sequence of decimal digits.
--   
--   The canonical lexical form has leading zeros and + sign
--   removed.
rdfDatatypeValXsdInteger :: RDFDatatypeVal Integer

-- | Type name for xsd:integer datatype.
typeNameXsdInteger :: ScopedName

-- | Namespace for xsd:integer datatype functions.
namespaceXsdInteger :: Namespace

-- | The axioms for xsd:integer, which are
--   
--   
--   xsd:integer a rdfs:Datatype .
--   
axiomsXsdInteger :: [RDFFormula]

-- | The rules for xsd:integer.
rulesXsdInteger :: [RDFRule]

-- | This module defines the structures used to represent and manipulate
--   RDF xsd:decimal datatyped literals.
--   
--   Note that in versions 0.6.4 and 0.6.5, this module
--   was a mixture of support for xsd:decimal and
--   xsd:double. In 0.7.0 the module has been changed to
--   xsd:decimal, but this may change.
module Swish.RDF.Datatype.XSD.Decimal

-- | The RDFDatatype value for xsd:decimal.
rdfDatatypeXsdDecimal :: RDFDatatype

-- | Define Datatype value for xsd:decimal.
--   
--   Members of this datatype decimal values.
--   
--   The lexical form consists of an optional + or -
--   followed by a sequence of decimal digits, an optional decimal point
--   and a sequence of decimal digits.
--   
--   The canonical lexical form has leading zeros and + sign
--   removed.
rdfDatatypeValXsdDecimal :: RDFDatatypeVal Double

-- | Type name for xsd:decimal datatype.
typeNameXsdDecimal :: ScopedName

-- | Namespace for xsd:decimal datatype functions.
namespaceXsdDecimal :: Namespace

-- | The axioms for xsd:decimal, which are
--   
--   
--   xsd:decimal a rdfs:Datatype .
--   
axiomsXsdDecimal :: [RDFFormula]

-- | The rules for xsd:decimal.
rulesXsdDecimal :: [RDFRule]

-- | This module collects references and provides access to all of the
--   datatypes built in to Swish.
module Swish.RDF.BuiltIn.Datatypes

-- | Al the data type declarations built into Swish.
allDatatypes :: [RDFDatatype]

-- | Look up a data type declaration.
findRDFDatatype :: ScopedName -> Maybe RDFDatatype

-- | This module instantiates the Proof framework for constructing
--   proofs over RDFGraph expressions. The intent is that this can
--   be used to test some correspondences between the RDF Model theory and
--   corresponding proof theory based on closure rules applied to the
--   graph, per http://www.w3.org/TR/rdf-mt/.
module Swish.RDF.Proof

-- | An RDF proof.
type RDFProof = Proof RDFGraph

-- | A step in an RDF proof.
type RDFProofStep = Step RDFGraph

-- | Make an RDF proof.
makeRDFProof :: [RDFRuleset] -> RDFFormula -> RDFFormula -> [RDFProofStep] -> RDFProof

-- | Make an RDF graph proof step.
makeRDFProofStep :: RDFRule -> [RDFFormula] -> RDFFormula -> RDFProofStep

-- | Make an inference rule dealing with RDF instance entailment; i.e.
--   entailments that are due to replacement of a URI or literal node with
--   a blank node.
--   
--   The part of this rule expected to be useful is checkInference.
--   The fwdApply and bwdApply functions defined here may
--   return rather large results if applied to graphs with many variables
--   or a large vocabulary, and are defined for experimentation.
--   
--   Forward and backward chaining is performed with respect to a specified
--   vocabulary. In the case of backward chaining, it would otherwise be
--   impossible to bound the options thus generated. In the case of forward
--   chaining, it is often not desirable to have the properties
--   generalized. If forward or backward backward chaining will not be
--   used, supply an empty vocabulary. Note: graph method allNodes
--   can be used to obtain a list of all the subjects and objects used in a
--   graph, not counting nested formulae; use a call of the form:
--   
--   
--   allNodes (not . labelIsVar) graph
--   
makeRdfInstanceEntailmentRule :: ScopedName -> [RDFLabel] -> RDFRule

-- | Make an inference rule dealing with RDF subgraph entailment. The part
--   of this rule expected to be useful is checkInference. The
--   fwdApply function defined here may return rather large results.
--   But in the name of completeness and experimentation with the
--   possibilities of lazy evaluation, it has been defined.
--   
--   Backward chaining is not performed, as there is no reasonable way to
--   choose a meaningful supergraph of that supplied.
makeRdfSubgraphEntailmentRule :: ScopedName -> RDFRule

-- | Make an inference rule dealing with RDF simple entailment. The part of
--   this rule expected to be useful is checkInference. The
--   fwdApply and bwdApply functions defined return null
--   results, indicating that they are not useful for the purposes of proof
--   discovery.
makeRdfSimpleEntailmentRule :: ScopedName -> RDFRule
instance (Label lb, LDGraph lg lb, Eq (lg lb)) => Expression (lg lb)

-- | This module contains proof-context declarations based on the RDF,
--   RDFS, and RDF datatyping semantics specifications. These definitions
--   consist of namespaces (for identification in proofs), axioms and
--   inference rules.
module Swish.RDF.ProofContext

-- | Ruleset for RDF inference.
rulesetRDF :: RDFRuleset

-- | Ruleset for RDFS inference.
rulesetRDFS :: RDFRuleset

-- | Ruleset for RDFD (datatyping) inference.
rulesetRDFD :: RDFRuleset

-- | This module collects references and provides access to all of the
--   rulesets, variable binding modifiers and variable binding filters
--   built in to Swish.
module Swish.RDF.BuiltIn.Rules

-- | Find the named open variable binding modifier.
findRDFOpenVarBindingModifier :: ScopedName -> Maybe RDFOpenVarBindingModify

-- | A LookupMap of allRulesets.
rdfRulesetMap :: RDFRulesetMap

-- | All the rule sets known to Swish.
allRulesets :: [RDFRuleset]

-- | The data type rule sets known to Swish.
allDatatypeRulesets :: [RDFRuleset]

-- | This module collects references and provides access to all of the
--   datatypes, variable binding modifiers and variable binding filters
--   built in to Swish.
module Swish.RDF.BuiltIn

-- | Find the named open variable binding modifier.
findRDFOpenVarBindingModifier :: ScopedName -> Maybe RDFOpenVarBindingModify

-- | Look up a data type declaration.
findRDFDatatype :: ScopedName -> Maybe RDFDatatype

-- | A LookupMap of allRulesets.
rdfRulesetMap :: RDFRulesetMap

-- | All the rule sets known to Swish.
allRulesets :: [RDFRuleset]

-- | The data type rule sets known to Swish.
allDatatypeRulesets :: [RDFRuleset]

-- | Composed state and IO monad for Swish
module Swish.Monad

-- | The state monad used in executing Swish programs.
type SwishStateIO a = StateT SwishState IO a

-- | The State for a Swish "program".
data SwishState
SwishState :: SwishFormat -> Maybe QName -> RDFGraph -> NamedGraphMap -> RDFRuleMap -> RDFRulesetMap -> Maybe String -> Maybe String -> SwishStatus -> SwishState

-- | format to use for I/O
format :: SwishState -> SwishFormat

-- | base to use rather than file name
base :: SwishState -> Maybe QName

-- | current graph
graph :: SwishState -> RDFGraph

-- | script processor named graphs
graphs :: SwishState -> NamedGraphMap

-- | script processor named rules
rules :: SwishState -> RDFRuleMap

-- | script processor rulesets
rulesets :: SwishState -> RDFRulesetMap

-- | information message, or Nothing
infomsg :: SwishState -> Maybe String

-- | error message, or Nothing
errormsg :: SwishState -> Maybe String

-- | current status
exitcode :: SwishState -> SwishStatus

-- | Status of the processor
data SwishStatus

-- | successful run
SwishSuccess :: SwishStatus

-- | graphs do not compare
SwishGraphCompareError :: SwishStatus

-- | input data problem (ie format/syntax)
SwishDataInputError :: SwishStatus

-- | data access error
SwishDataAccessError :: SwishStatus

-- | command-line argument error
SwishArgumentError :: SwishStatus

-- | error executing a Swish script
SwishExecutionError :: SwishStatus

-- | The supported input and output formats.
data SwishFormat

-- | Turtle format
Turtle :: SwishFormat

-- | N3 format
N3 :: SwishFormat

-- | NTriples format
NT :: SwishFormat

-- | A LookupMap for the graphs dictionary.
type NamedGraphMap = Map ScopedName [RDFGraph]

-- | The default state for Swish: no loaded graphs or rules, and format set
--   to N3.
emptyState :: SwishState

-- | Change the format.
setFormat :: SwishFormat -> SwishState -> SwishState

-- | Change (or remove) the base URI.
setBase :: Maybe QName -> SwishState -> SwishState

-- | Change the current graph.
setGraph :: RDFGraph -> SwishState -> SwishState

-- | Modify the named graphs.
modGraphs :: (NamedGraphMap -> NamedGraphMap) -> SwishState -> SwishState

-- | Find a named graph.
findGraph :: ScopedName -> SwishState -> Maybe [RDFGraph]

-- | Find a formula. The search is first made in the named graphs and then,
--   if not found, the rulesets.
findFormula :: ScopedName -> SwishState -> Maybe RDFFormula

-- | Modify the named rules.
modRules :: (RDFRuleMap -> RDFRuleMap) -> SwishState -> SwishState

-- | Find a named rule.
findRule :: ScopedName -> SwishState -> Maybe RDFRule

-- | Modify the rule sets.
modRulesets :: (RDFRulesetMap -> RDFRulesetMap) -> SwishState -> SwishState

-- | Find a rule set.
findRuleset :: ScopedName -> SwishState -> Maybe RDFRuleset

-- | Find a modify rule.
findOpenVarModify :: ScopedName -> SwishState -> Maybe RDFOpenVarBindingModify

-- | Find a data type declaration.
findDatatype :: ScopedName -> SwishState -> Maybe RDFDatatype

-- | Set the information message.
setInfo :: String -> SwishState -> SwishState

-- | Clear the information message.
resetInfo :: SwishState -> SwishState

-- | Set the error message.
setError :: String -> SwishState -> SwishState

-- | Clear the error message.
resetError :: SwishState -> SwishState

-- | Set the status.
setStatus :: SwishStatus -> SwishState -> SwishState

-- | Report error and set exit status code
swishError :: String -> SwishStatus -> SwishStateIO ()

-- | Output the text to the standard error stream (a new line is added to
--   the output).
reportLine :: String -> SwishStateIO ()
instance Eq SwishFormat
instance Eq SwishStatus
instance Enum SwishStatus
instance Show SwishStatus
instance Show SwishFormat

-- | This Module implements a Turtle formatter for an RDFGraph
--   value.
--   
--   REFERENCES:
--   
--   
--   
- "Turtle, Terse RDF Triple Language", W3C Working Draft 09 August
--   2011 (http://www.w3.org/TR/2011/WD-turtle-20110809/)
--   http://www.w3.org/TR/turtle/
--   
--   
--   NOTES:
--   
--   
--   
- The formatter needs to be updated to the W3C Candidate
--   Recommendation (19 February 2013,
--   http://www.w3.org/TR/2013/CR-turtle-20130219/).
--   
- Should literal strings (Lit) be written out as
--   xsd:string, or should TypedLit strings with a type
--   of xsd:string be written out with no type? (e.g. see
--   http://www.w3.org/TR/2011/WD-turtle-20110809/#terms).
--   
module Swish.RDF.Formatter.Turtle

-- | Node name generation state information that carries through and is
--   updated by nested formulae.
type NodeGenLookupMap = Map RDFLabel Word32

-- | Convert the graph to text.
formatGraphAsText :: RDFGraph -> Text

-- | Convert the graph to text.
formatGraphAsLazyText :: RDFGraph -> Text

-- | Convert the graph to a Builder.
formatGraphAsBuilder :: RDFGraph -> Builder

-- | Convert the graph to a builder using the given indentation text.
formatGraphIndent :: Builder -> Bool -> RDFGraph -> Builder

-- | Format graph and return additional information.
formatGraphDiag :: Builder -> Bool -> RDFGraph -> (Builder, NodeGenLookupMap, Word32, [String])

-- | This Module implements a Notation 3 formatter for an RDFGraph
--   value.
--   
--   REFERENCES:
--   
--   
--   
- "Notation3 (N3): A readable RDF syntax", W3C Team Submission 14
--   January 2008,
--   http://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/
--   
- Tim Berners-Lee's design issues series notes and description,
--   http://www.w3.org/DesignIssues/Notation3.html
--   
- Notation 3 Primer by Sean Palmer,
--   http://www.w3.org/2000/10/swap/Primer.html
--   
--   
--   TODO:
--   
--   
--   
- Initial prefix list to include nested formulae; then don't need to
--   update prefix list for these.
--   
- correct output of strings containing unsupported escape characters
--   (such as \q)
--   
- more flexible terminator generation for formatted formulae (for
--   inline blank nodes.)
--   
module Swish.RDF.Formatter.N3

-- | Node name generation state information that carries through and is
--   updated by nested formulae.
type NodeGenLookupMap = Map RDFLabel Word32

-- | Convert the graph to text.
formatGraphAsText :: RDFGraph -> Text

-- | Convert the graph to text.
formatGraphAsLazyText :: RDFGraph -> Text

-- | Convert the graph to a Builder.
formatGraphAsBuilder :: RDFGraph -> Builder

-- | Convert the graph to a builder using the given indentation text.
formatGraphIndent :: Builder -> Bool -> RDFGraph -> Builder

-- | Format graph and return additional information
formatGraphDiag :: Builder -> Bool -> RDFGraph -> (Builder, NodeGenLookupMap, Word32, [String])

-- | This module defines a ShowLines class instance for
--   RDFGraph, to be used when displaying RDF Graph values as part
--   of a proof sequence, etc.
module Swish.RDF.GraphShowLines
instance ShowLines RDFGraph

-- | This module implements the Swish script processor: it parses a script
--   from a supplied string, and returns a list of Swish state transformer
--   functions whose effect, when applied to a state value, is to implement
--   the supplied script.
module Swish.Script

-- | Parser for Swish script processor
parseScriptFromText :: Maybe QName -> Text -> Either String [SwishStateIO ()]

-- | This Module implements a NTriples formatter for a RDFGraph.
--   
--   REFERENCES:
--   
--   
--   
- "RDF Test Cases", W3C Recommendation 10 February 2004,
--   http://www.w3.org/TR/rdf-testcases/#ntriples
--   
--   
--   NOTES:
--   
--   
--   
- Update to the document "N-Triples. A line-based syntax for an RDF
--   graph" W3C Working Group Note 09 April 2013,
--   http://www.w3.org/TR/2013/NOTE-n-triples-20130409/
--   
module Swish.RDF.Formatter.NTriples

-- | Convert a RDF graph to NTriples format.
formatGraphAsText :: RDFGraph -> Text

-- | Convert a RDF graph to NTriples format.
formatGraphAsLazyText :: RDFGraph -> Text

-- | Convert a RDF graph to NTriples format.
formatGraphAsBuilder :: RDFGraph -> Builder

-- | Functions to deal with indivudual Swish command options.
module Swish.Commands

-- | Set the file format.
swishFormat :: SwishFormat -> SwishStateIO ()

-- | Set (or clear) the base URI.
swishBase :: Maybe QName -> SwishStateIO ()

-- | Read in a graph and make it the current graph.
swishInput :: Maybe String -> SwishStateIO ()

-- | Write out the current graph.
swishOutput :: Maybe String -> SwishStateIO ()

-- | Read in a graph and merge it with the current graph.
swishMerge :: Maybe String -> SwishStateIO ()

-- | Read in a graph and compare it with the current graph.
swishCompare :: Maybe String -> SwishStateIO ()

-- | Read in a graph and display the differences to the current graph to
--   standard output.
swishGraphDiff :: Maybe String -> SwishStateIO ()

-- | Read in a script and execute it.
swishScript :: Maybe String -> SwishStateIO ()

-- | Swish: Semantic Web Inference Scripting in Haskell
--   
--   This program is a simple skeleton for constructing Semantic Web [1]
--   inference tools in Haskell, using the RDF graph and several RDF
--   parsers (at present Notation 3 and NTriples).
--   
--   It might be viewed as a kind of embroyonic CWM [2] in Haskell, except
--   that the intent is that Haskell will be used as a primary language for
--   defining inferences. As such, Swish is an open-ended toolkit for
--   constructing new special-purpose Semantic Web applications rather than
--   a closed, self-contained general-purpose SW application. As such, it
--   is part of another experiment along the lines described in [3].
--   
--   The script format used by Swish is described in Swish.Script.
--   
--   Users wishing to process RDF data directly may prefer to look at the
--   following modules; Swish.RDF, Swish.RDF.Parser.Turtle,
--   Swish.RDF.Parser.N3, Swish.RDF.Parser.NTriples,
--   Swish.RDF.Formatter.Turtle, Swish.RDF.Formatter.N3 and
--   Swish.RDF.Formatter.NTriples.
--   
--   
--   
- Semantic web: http://www.w3.org/2001/sw/
--   
- CWM: http://www.w3.org/2000/10/swap/doc/cwm.html
--   
- Motivation:
--   http://www.w3.org/2000/10/swap/doc/Motivation.html
--   
- Notation 3:
--   http://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/
--   
- Turtle: http://www.w3.org/TR/turtle/
--   
- RDF: http://www.w3.org/RDF/
--   
--   
--   Notes
--   
--   I anticipate that this module may be used as a starting point for
--   creating new programs rather then as a complete program in its own
--   right. The functionality built into this code is selected with a view
--   to testing the Haskell modules for handling RDF rather than for
--   performing any particular application processing (though development
--   as a tool with some broader utility is not ruled out).
--   
--   With the following in ghci:
--   
--   
--   >>> :m + Swish
--   
--   >>> :set prompt "swish> "
--   
--   
--   then we can run a Swish script (format described in
--   Swish.Script) by saying:
--   
--   
--   >>> runSwish "-s=script.ss"
--   ExitSuccess
--   
--   
--   or convert a file from Turtle to NTriples format with:
--   
--   
--   >>> runSwish "-ttl -i=foo.ttl -nt -o=foo.nt"
--   ExitSuccess
--   
--   
--   You can also use validateCommands by giving it the individual
--   commands, such as
--   
--   
--   >>> let Right cs = validateCommands ["-ttl", "-i=file1.ttl", "-c=file2.ttl"]
--   
--   >>> cs
--   [SwishAction: -ttl,SwishAction: -i=file1.ttl,SwishAction: -c=file2.ttl]
--   
--   >>> st <- runSwishActions cs
--   
--   >>> st
--   The graphs do not compare as equal.
--   
module Swish

-- | Status of the processor
data SwishStatus

-- | successful run
SwishSuccess :: SwishStatus

-- | graphs do not compare
SwishGraphCompareError :: SwishStatus

-- | input data problem (ie format/syntax)
SwishDataInputError :: SwishStatus

-- | data access error
SwishDataAccessError :: SwishStatus

-- | command-line argument error
SwishArgumentError :: SwishStatus

-- | error executing a Swish script
SwishExecutionError :: SwishStatus

-- | Represent a Swish action. At present there is no way to create these
--   actions other than validateCommands.
data SwishAction

-- | Parse and run the given string as if given at the command line. The
--   "quiet", "version" and "help" options are ignored.
runSwish :: String -> IO ExitCode

-- | Execute the given set of actions.
runSwishActions :: [SwishAction] -> IO SwishStatus

-- | Write out the help for Swish
displaySwishHelp :: IO ()

-- | Return any arguments that need processing immediately, namely the
--   "help", "quiet" and "version" options.
splitArguments :: [String] -> ([String], [String])

-- | Given a list of command-line arguments create the list of actions to
--   perform or a string and status value indicating an input error.
validateCommands :: [String] -> Either (String, SwishStatus) [SwishAction]
instance Show SwishAction

-- | This module defines some commonly used vocabulary terms from the
--   Dublin Core vocabularies
--   (http://dublincore.org/documents/dcmi-terms/).
module Swish.RDF.Vocabulary.DublinCore

-- | Maps dcterms to http://purl.org/dc/terms/.
namespaceDCTERMS :: Namespace

-- | Maps dcelem to the legacy namespace
--   http://purl.org/dc/elements/1.1/.
namespaceDCELEM :: Namespace

-- | Maps dcam to http://purl.org/dc/dcam/.
namespaceDCAM :: Namespace

-- | Maps dctype to http://purl.org/dc/dcmitype/.
namespaceDCTYPE :: Namespace

-- | dcterms:Agent from
--   http://dublincore.org/documents/dcmi-terms/#classes-Agent.
dctAgent :: ScopedName

-- | dcterms:AgentClass from
--   http://dublincore.org/documents/dcmi-terms/#classes-AgentClass.
dctAgentClass :: ScopedName

-- | dcterms:BibliographicResource from
--   http://dublincore.org/documents/dcmi-terms/#classes-BibliographicResource.
dctBibliographicResource :: ScopedName

-- | dcterms:FileFormat from
--   http://dublincore.org/documents/dcmi-terms/#classes-FileFormat.
dctFileFormat :: ScopedName

-- | dcterms:Frequency from
--   http://dublincore.org/documents/dcmi-terms/#classes-Frequency.
dctFrequency :: ScopedName

-- | dcterms:Jurisdiction from
--   http://dublincore.org/documents/dcmi-terms/#classes-Jurisdiction.
dctJurisdiction :: ScopedName

-- | dcterms:LicenseDocument from
--   http://dublincore.org/documents/dcmi-terms/#classes-LicenseDocument.
dctLicenseDocument :: ScopedName

-- | dcterms:LinguisticSystem from
--   http://dublincore.org/documents/dcmi-terms/#classes-LinguisticSystem.
dctLinguisticSystem :: ScopedName

-- | dcterms:Location from
--   http://dublincore.org/documents/dcmi-terms/#classes-Location.
dctLocation :: ScopedName

-- | dcterms:LocationPeriodOrJurisdiction from
--   http://dublincore.org/documents/dcmi-terms/#classes-LocationPeriodOrJurisdiction.
dctLocationPeriodOrJurisdiction :: ScopedName

-- | dcterms:MediaType from
--   http://dublincore.org/documents/dcmi-terms/#classes-MediaType.
dctMediaType :: ScopedName

-- | dcterms:MediaTypeOrExtent from
--   http://dublincore.org/documents/dcmi-terms/#classes-MediaTypeOrExtent.
dctMediaTypeOrExtent :: ScopedName

-- | dcterms:MethodOfAccrual from
--   http://dublincore.org/documents/dcmi-terms/#classes-MethodOfAccrual.
dctMethodOfAccrual :: ScopedName

-- | dcterms:MethodOfInstruction from
--   http://dublincore.org/documents/dcmi-terms/#classes-MethodOfInstruction.
dctMethodOfInstruction :: ScopedName

-- | dcterms:PeriodOfTime from
--   http://dublincore.org/documents/dcmi-terms/#classes-PeriodOfTime.
dctPeriodOfTime :: ScopedName

-- | dcterms:PhysicalMedium from
--   http://dublincore.org/documents/dcmi-terms/#classes-PhysicalMedium.
dctPhysicalMedium :: ScopedName

-- | dcterms:PhysicalResource from
--   http://dublincore.org/documents/dcmi-terms/#classes-PhysicalResource.
dctPhysicalResource :: ScopedName

-- | dcterms:Policy from
--   http://dublincore.org/documents/dcmi-terms/#classes-Policy.
dctPolicy :: ScopedName

-- | dcterms:ProvenanceStatement from
--   http://dublincore.org/documents/dcmi-terms/#classes-ProvenanceStatement.
dctProvenanceStatement :: ScopedName

-- | dcterms:RightsStatement from
--   http://dublincore.org/documents/dcmi-terms/#classes-RightsStatement.
dctRightsStatement :: ScopedName

-- | dcterms:SizeOrDuration from
--   http://dublincore.org/documents/dcmi-terms/#classes-SizeOrDuration.
dctSizeOrDuration :: ScopedName

-- | dcterms:Standard from
--   http://dublincore.org/documents/dcmi-terms/#classes-Standard.
dctStandard :: ScopedName

-- | dcterms:abstract from
--   http://dublincore.org/documents/dcmi-terms/#terms-abstract.
dctabstract :: ScopedName

-- | dcterms:accessRights from
--   http://dublincore.org/documents/dcmi-terms/#terms-accessRights.
dctaccessRights :: ScopedName

-- | dcterms:accrualMethod from
--   http://dublincore.org/documents/dcmi-terms/#terms-accrualMethod.
dctaccrualMethod :: ScopedName

-- | dcterms:accrualPeriodicity from
--   http://dublincore.org/documents/dcmi-terms/#terms-accrualPeriodicity.
dctaccrualPeriodicity :: ScopedName

-- | dcterms:accrualPolicy from
--   http://dublincore.org/documents/dcmi-terms/#terms-accrualPolicy.
dctaccrualPolicy :: ScopedName

-- | dcterms:alternative from
--   http://dublincore.org/documents/dcmi-terms/#terms-alternative.
dctalternative :: ScopedName

-- | dcterms:audience from
--   http://dublincore.org/documents/dcmi-terms/#terms-audience.
dctaudience :: ScopedName

-- | dcterms:available from
--   http://dublincore.org/documents/dcmi-terms/#terms-available.
dctavailable :: ScopedName

-- | dcterms:bibliographicCitation from
--   http://dublincore.org/documents/dcmi-terms/#terms-bibliographicCitation.
dctbibliographicCitation :: ScopedName

-- | dcterms:conformsTo from
--   http://dublincore.org/documents/dcmi-terms/#terms-conformsTo.
dctconformsTo :: ScopedName

-- | dcterms:contributor from
--   http://dublincore.org/documents/dcmi-terms/#terms-contributor.
dctcontributor :: ScopedName

-- | dcterms:coverage from
--   http://dublincore.org/documents/dcmi-terms/#terms-coverage.
dctcoverage :: ScopedName

-- | dcterms:created from
--   http://dublincore.org/documents/dcmi-terms/#terms-created.
dctcreated :: ScopedName

-- | dcterms:creator from
--   http://dublincore.org/documents/dcmi-terms/#terms-creator.
dctcreator :: ScopedName

-- | dcterms:date from
--   http://dublincore.org/documents/dcmi-terms/#terms-date.
dctdate :: ScopedName

-- | dcterms:dateAccepted from
--   http://dublincore.org/documents/dcmi-terms/#terms-dateAccepted.
dctdateAccepted :: ScopedName

-- | dcterms:dateCopyrighted from
--   http://dublincore.org/documents/dcmi-terms/#terms-dateCopyrighted.
dctdateCopyrighted :: ScopedName

-- | dcterms:dateSubmitted from
--   http://dublincore.org/documents/dcmi-terms/#terms-dateSubmitted.
dctdateSubmitted :: ScopedName

-- | dcterms:description from
--   http://dublincore.org/documents/dcmi-terms/#terms-description.
dctdescription :: ScopedName

-- | dcterms:educationLevel from
--   http://dublincore.org/documents/dcmi-terms/#terms-educationLevel.
dcteducationLevel :: ScopedName

-- | dcterms:extent from
--   http://dublincore.org/documents/dcmi-terms/#terms-extent.
dctextent :: ScopedName

-- | dcterms:format from
--   http://dublincore.org/documents/dcmi-terms/#terms-format.
dctformat :: ScopedName

-- | dcterms:hasFormat from
--   http://dublincore.org/documents/dcmi-terms/#terms-hasFormat.
dcthasFormat :: ScopedName

-- | dcterms:hasPart from
--   http://dublincore.org/documents/dcmi-terms/#terms-hasPart.
dcthasPart :: ScopedName

-- | dcterms:hasVersion from
--   http://dublincore.org/documents/dcmi-terms/#terms-hasVersion.
dcthasVersion :: ScopedName

-- | dcterms:identifier from
--   http://dublincore.org/documents/dcmi-terms/#terms-identifier.
dctidentifier :: ScopedName

-- | dcterms:instructionalMethod from
--   http://dublincore.org/documents/dcmi-terms/#terms-instructionalMethod.
dctinstructionalMethod :: ScopedName

-- | dcterms:isFormatOf from
--   http://dublincore.org/documents/dcmi-terms/#terms-isFormatOf.
dctisFormatOf :: ScopedName

-- | dcterms:isPartOf from
--   http://dublincore.org/documents/dcmi-terms/#terms-isPartOf.
dctisPartOf :: ScopedName

-- | dcterms:isReferencedBy from
--   http://dublincore.org/documents/dcmi-terms/#terms-isReferencedBy.
dctisReferencedBy :: ScopedName

-- | dcterms:isReplacedBy from
--   http://dublincore.org/documents/dcmi-terms/#terms-isReplacedBy.
dctisReplacedBy :: ScopedName

-- | dcterms:isRequiredBy from
--   http://dublincore.org/documents/dcmi-terms/#terms-isRequiredBy.
dctisRequiredBy :: ScopedName

-- | dcterms:issued from
--   http://dublincore.org/documents/dcmi-terms/#terms-issued.
dctissued :: ScopedName

-- | dcterms:isVersionOf from
--   http://dublincore.org/documents/dcmi-terms/#terms-isVersionOf.
dctisVersionOf :: ScopedName

-- | dcterms:language from
--   http://dublincore.org/documents/dcmi-terms/#terms-language.
dctlanguage :: ScopedName

-- | dcterms:license from
--   http://dublincore.org/documents/dcmi-terms/#terms-license.
dctlicense :: ScopedName

-- | dcterms:mediator from
--   http://dublincore.org/documents/dcmi-terms/#terms-mediator.
dctmediator :: ScopedName

-- | dcterms:medium from
--   http://dublincore.org/documents/dcmi-terms/#terms-medium.
dctmedium :: ScopedName

-- | dcterms:modified from
--   http://dublincore.org/documents/dcmi-terms/#terms-modified.
dctmodified :: ScopedName

-- | dcterms:provenance from
--   http://dublincore.org/documents/dcmi-terms/#terms-provenance.
dctprovenance :: ScopedName

-- | dcterms:publisher from
--   http://dublincore.org/documents/dcmi-terms/#terms-publisher.
dctpublisher :: ScopedName

-- | dcterms:references from
--   http://dublincore.org/documents/dcmi-terms/#terms-references.
dctreferences :: ScopedName

-- | dcterms:relation from
--   http://dublincore.org/documents/dcmi-terms/#terms-relation.
dctrelation :: ScopedName

-- | dcterms:replaces from
--   http://dublincore.org/documents/dcmi-terms/#terms-replaces.
dctreplaces :: ScopedName

-- | dcterms:requires from
--   http://dublincore.org/documents/dcmi-terms/#terms-requires.
dctrequires :: ScopedName

-- | dcterms:rights from
--   http://dublincore.org/documents/dcmi-terms/#terms-rights.
dctrights :: ScopedName

-- | dcterms:rightsHolder from
--   http://dublincore.org/documents/dcmi-terms/#terms-rightsHolder.
dctrightsHolder :: ScopedName

-- | dcterms:source from
--   http://dublincore.org/documents/dcmi-terms/#terms-source.
dctsource :: ScopedName

-- | dcterms:spatial from
--   http://dublincore.org/documents/dcmi-terms/#terms-spatial.
dctspatial :: ScopedName

-- | dcterms:subject from
--   http://dublincore.org/documents/dcmi-terms/#terms-subject.
dctsubject :: ScopedName

-- | dcterms:tableOfContents from
--   http://dublincore.org/documents/dcmi-terms/#terms-tableOfContents.
dcttableOfContents :: ScopedName

-- | dcterms:temporal from
--   http://dublincore.org/documents/dcmi-terms/#terms-temporal.
dcttemporal :: ScopedName

-- | dcterms:title from
--   http://dublincore.org/documents/dcmi-terms/#terms-title.
dcttitle :: ScopedName

-- | dcterms:type from
--   http://dublincore.org/documents/dcmi-terms/#terms-type.
dcttype :: ScopedName

-- | dcterms:valid from
--   http://dublincore.org/documents/dcmi-terms/#terms-valid.
dctvalid :: ScopedName

-- | dcelem:contributor from
--   http://dublincore.org/documents/dcmi-terms/#elements-contributor.
dcelemcontributor :: ScopedName

-- | dcelem:coverage from
--   http://dublincore.org/documents/dcmi-terms/#elements-coverage.
dcelemcoverage :: ScopedName

-- | dcelem:creator from
--   http://dublincore.org/documents/dcmi-terms/#elements-creator.
dcelemcreator :: ScopedName

-- | dcelem:date from
--   http://dublincore.org/documents/dcmi-terms/#elements-date.
dcelemdate :: ScopedName

-- | dcelem:description from
--   http://dublincore.org/documents/dcmi-terms/#elements-description.
dcelemdescription :: ScopedName

-- | dcelem:format from
--   http://dublincore.org/documents/dcmi-terms/#elements-format.
dcelemformat :: ScopedName

-- | dcelem:identifier from
--   http://dublincore.org/documents/dcmi-terms/#elements-identifier.
dcelemidentifier :: ScopedName

-- | dcelem:language from
--   http://dublincore.org/documents/dcmi-terms/#elements-language.
dcelemlanguage :: ScopedName

-- | dcelem:publisher from
--   http://dublincore.org/documents/dcmi-terms/#elements-publisher.
dcelempublisher :: ScopedName

-- | dcelem:relation from
--   http://dublincore.org/documents/dcmi-terms/#elements-relation.
dcelemrelation :: ScopedName

-- | dcelem:rights from
--   http://dublincore.org/documents/dcmi-terms/#elements-rights.
dcelemrights :: ScopedName

-- | dcelem:source from
--   http://dublincore.org/documents/dcmi-terms/#elements-source.
dcelemsource :: ScopedName

-- | dcelem:subject from
--   http://dublincore.org/documents/dcmi-terms/#elements-subject.
dcelemsubject :: ScopedName

-- | dcelem:title from
--   http://dublincore.org/documents/dcmi-terms/#elements-title.
dcelemtitle :: ScopedName

-- | dcelem:type from
--   http://dublincore.org/documents/dcmi-terms/#elements-type.
dcelemtype :: ScopedName

-- | dcterms:LCSH from
--   http://dublincore.org/documents/dcmi-terms/#ves-LCSH.
dctLCSH :: ScopedName

-- | dcterms:MESH from
--   http://dublincore.org/documents/dcmi-terms/#ves-MESH.
dctMESH :: ScopedName

-- | dcterms:DDC from
--   http://dublincore.org/documents/dcmi-terms/#ves-DDC.
dctDDC :: ScopedName

-- | dcterms:LCC from
--   http://dublincore.org/documents/dcmi-terms/#ves-LCC.
dctLCC :: ScopedName

-- | dcterms:UDC from
--   http://dublincore.org/documents/dcmi-terms/#ves-UDC.
dctUDC :: ScopedName

-- | dcterms:DCMIType from
--   http://dublincore.org/documents/dcmi-terms/#ves-DCMIType.
dctDCMIType :: ScopedName

-- | dcterms:IMT from
--   http://dublincore.org/documents/dcmi-terms/#ves-IMT.
dctIMT :: ScopedName

-- | dcterms:TGN from
--   http://dublincore.org/documents/dcmi-terms/#ves-TGN.
dctTGN :: ScopedName

-- | dcterms:NLM from
--   http://dublincore.org/documents/dcmi-terms/#ves-NLM.
dctNLM :: ScopedName

-- | dcterms:Box from
--   http://dublincore.org/documents/dcmi-terms/#ses-Box.
dctBox :: ScopedName

-- | dcterms:ISO3166 from
--   http://dublincore.org/documents/dcmi-terms/#ses-ISO3166.
dctISO3166 :: ScopedName

-- | dcterms:ISO639-2 from
--   http://dublincore.org/documents/dcmi-terms/#ses-ISO639-2.
dctISO639_2 :: ScopedName

-- | dcterms:ISO639-3 from
--   http://dublincore.org/documents/dcmi-terms/#ses-ISO639-3.
dctISO639_3 :: ScopedName

-- | dcterms:Period from
--   http://dublincore.org/documents/dcmi-terms/#ses-Period.
dctPeriod :: ScopedName

-- | dcterms:Point from
--   http://dublincore.org/documents/dcmi-terms/#ses-Point.
dctPoint :: ScopedName

-- | dcterms:RFC1766 from
--   http://dublincore.org/documents/dcmi-terms/#ses-RFC1766.
dctRFC1766 :: ScopedName

-- | dcterms:RFC3066 from
--   http://dublincore.org/documents/dcmi-terms/#ses-RFC3066.
dctRFC3066 :: ScopedName

-- | dcterms:RFC4646 from
--   http://dublincore.org/documents/dcmi-terms/#ses-RFC4646.
dctRFC4646 :: ScopedName

-- | dcterms:RFC5646 from
--   http://dublincore.org/documents/dcmi-terms/#ses-RFC5646.
dctRFC5646 :: ScopedName

-- | dcterms:URI from
--   http://dublincore.org/documents/dcmi-terms/#ses-URI.
dctURI :: ScopedName

-- | dcterms:W3CDTF from
--   http://dublincore.org/documents/dcmi-terms/#ses-W3CDTF.
dctW3CDTF :: ScopedName

-- | dctype:Collection from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Collection.
dctypeCollection :: ScopedName

-- | dctype:Dataset from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Dataset.
dctypeDataset :: ScopedName

-- | dctype:Event from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Event.
dctypeEvent :: ScopedName

-- | dctype:Image from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Image.
dctypeImage :: ScopedName

-- | dctype:InteractiveResource from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-InteractiveResource.
dctypeInteractiveResource :: ScopedName

-- | dctype:Service from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Service.
dctypeService :: ScopedName

-- | dctype:Software from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Software.
dctypeSoftware :: ScopedName

-- | dctype:Sound from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Sound.
dctypeSound :: ScopedName

-- | dctype:Text from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-Text.
dctypeText :: ScopedName

-- | dctype:PhysicalObject from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-PhysicalObject.
dctypePhysicalObject :: ScopedName

-- | dctype:StillImage from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-StillImage.
dctypeStillImage :: ScopedName

-- | dctype:MovingImage from
--   http://dublincore.org/documents/dcmi-terms/#dcmitype-MovingImage.
dctypeMovingImage :: ScopedName

-- | dcam:memberOf from
--   http://dublincore.org/documents/dcmi-terms/#dcam-memberOf.
dcammemberOf :: ScopedName

-- | dcam:memberOf from
--   http://dublincore.org/documents/dcmi-terms/#dcam-memberOf.
dcamVocabularyEncodingScheme :: ScopedName

-- | This module defines some commonly used vocabulary terms from the FOAF
--   vocabulary (http://xmlns.com/foaf/spec/).
--   
--   Note that unlike some of the existing vocabularies in Swish, the FOAF
--   one matches the case and spelling of the RDF terms; so we use
--   foafbased_near rather than foafBasedNear. This is
--   partly because some terms would end up with the same Haskell label if
--   a conversion to camel-case wer used.
module Swish.RDF.Vocabulary.FOAF

-- | Maps foaf to http://xmlns.com/foaf/0.1/.
namespaceFOAF :: Namespace

-- | foaf:Agent from
--   http://xmlns.com/foaf/spec/#term_Agent.
foafAgent :: ScopedName

-- | foaf:Document from
--   http://xmlns.com/foaf/spec/#term_Document.
foafDocument :: ScopedName

-- | foaf:Group from
--   http://xmlns.com/foaf/spec/#term_Group.
foafGroup :: ScopedName

-- | foaf:Image from
--   http://xmlns.com/foaf/spec/#term_Image.
foafImage :: ScopedName

-- | foaf:LabelProperty from
--   http://xmlns.com/foaf/spec/#term_LabelProperty.
foafLabelProperty :: ScopedName

-- | foaf:OnlineAccount from
--   http://xmlns.com/foaf/spec/#term_OnlineAccount.
foafOnlineAccount :: ScopedName

-- | foaf:OnlineChatAccount from
--   http://xmlns.com/foaf/spec/#term_OnlineChatAccount.
foafOnlineChatAccount :: ScopedName

-- | foaf:OnlineEcommerceAccount from
--   http://xmlns.com/foaf/spec/#term_OnlineEcommerceAccount.
foafOnlineEcommerceAccount :: ScopedName

-- | foaf:OnlineGamingAccount from
--   http://xmlns.com/foaf/spec/#term_OnlineGamingAccount.
foafOnlineGamingAccount :: ScopedName

-- | foaf:Organization from
--   http://xmlns.com/foaf/spec/#term_Organization.
foafOrganization :: ScopedName

-- | foaf:Person from
--   http://xmlns.com/foaf/spec/#term_Person.
foafPerson :: ScopedName

-- | foaf:PersonalProfileDocument from
--   http://xmlns.com/foaf/spec/#term_PersonalProfileDocument.
foafPersonalProfileDocument :: ScopedName

-- | foaf:Project from
--   http://xmlns.com/foaf/spec/#term_Project.
foafProject :: ScopedName

-- | foaf:account from
--   http://xmlns.com/foaf/spec/#term_account.
foafaccount :: ScopedName

-- | foaf:accountName from
--   http://xmlns.com/foaf/spec/#term_accountName.
foafaccountName :: ScopedName

-- | foaf:accountServiceHomepage from
--   http://xmlns.com/foaf/spec/#term_accountServiceHomepage.
foafaccountServiceHomepage :: ScopedName

-- | foaf:age from http://xmlns.com/foaf/spec/#term_age.
foafage :: ScopedName

-- | foaf:aimChatID from
--   http://xmlns.com/foaf/spec/#term_aimChatID.
foafaimChatID :: ScopedName

-- | foaf:based_near from
--   http://xmlns.com/foaf/spec/#term_based_near.
foafbased_near :: ScopedName

-- | foaf:birthday from
--   http://xmlns.com/foaf/spec/#term_birthday.
foafbirthday :: ScopedName

-- | foaf:currentProject from
--   http://xmlns.com/foaf/spec/#term_currentProject.
foafcurrentProject :: ScopedName

-- | foaf:depiction from
--   http://xmlns.com/foaf/spec/#term_depiction.
foafdepiction :: ScopedName

-- | foaf:depicts from
--   http://xmlns.com/foaf/spec/#term_depicts.
foafdepicts :: ScopedName

-- | foaf:dnaChecksum from
--   http://xmlns.com/foaf/spec/#term_dnaChecksum.
foafdnaChecksum :: ScopedName

-- | foaf:familyName from
--   http://xmlns.com/foaf/spec/#term_familyName.
foaffamilyName :: ScopedName

-- | foaf:family_name from
--   http://xmlns.com/foaf/spec/#term_family_name.
foaffamily_name :: ScopedName

-- | foaf:firstName from
--   http://xmlns.com/foaf/spec/#term_firstName.
foaffirstName :: ScopedName

-- | foaf:focus from
--   http://xmlns.com/foaf/spec/#term_focus.
foaffocus :: ScopedName

-- | foaf:fundedBy from
--   http://xmlns.com/foaf/spec/#term_fundedBy.
foaffundedBy :: ScopedName

-- | foaf:geekcode from
--   http://xmlns.com/foaf/spec/#term_geekcode.
foafgeekcode :: ScopedName

-- | foaf:gender from
--   http://xmlns.com/foaf/spec/#term_gender.
foafgender :: ScopedName

-- | foaf:givenName from
--   http://xmlns.com/foaf/spec/#term_givenName.
foafgivenName :: ScopedName

-- | foaf:givenname from
--   http://xmlns.com/foaf/spec/#term_givenname.
foafgivenname :: ScopedName

-- | foaf:holdsAccount from
--   http://xmlns.com/foaf/spec/#term_holdsAccount.
foafholdsAccount :: ScopedName

-- | foaf:homepage from
--   http://xmlns.com/foaf/spec/#term_homepage.
foafhomepage :: ScopedName

-- | foaf:icqChatID from
--   http://xmlns.com/foaf/spec/#term_icqChatID.
foaficqChatID :: ScopedName

-- | foaf:img from http://xmlns.com/foaf/spec/#term_img.
foafimg :: ScopedName

-- | foaf:interest from
--   http://xmlns.com/foaf/spec/#term_interest.
foafinterest :: ScopedName

-- | foaf:isPrimaryTopicOf from
--   http://xmlns.com/foaf/spec/#term_isPrimaryTopicOf.
foafisPrimaryTopicOf :: ScopedName

-- | foaf:jabberID from
--   http://xmlns.com/foaf/spec/#term_jabberID.
foafjabberID :: ScopedName

-- | foaf:knows from
--   http://xmlns.com/foaf/spec/#term_knows.
foafknows :: ScopedName

-- | foaf:lastName from
--   http://xmlns.com/foaf/spec/#term_lastName.
foaflastName :: ScopedName

-- | foaf:logo from http://xmlns.com/foaf/spec/#term_logo.
foaflogo :: ScopedName

-- | foaf:made from http://xmlns.com/foaf/spec/#term_made.
foafmade :: ScopedName

-- | foaf:maker from
--   http://xmlns.com/foaf/spec/#term_maker.
foafmaker :: ScopedName

-- | foaf:mbox from http://xmlns.com/foaf/spec/#term_mbox.
foafmbox :: ScopedName

-- | foaf:mbox_sha1sum from
--   http://xmlns.com/foaf/spec/#term_mbox_sha1sum.
foafmbox_sha1sum :: ScopedName

-- | foaf:member from
--   http://xmlns.com/foaf/spec/#term_member.
foafmember :: ScopedName

-- | foaf:membershipClass from
--   http://xmlns.com/foaf/spec/#term_membershipClass.
foafmembershipClass :: ScopedName

-- | foaf:msnChatID from
--   http://xmlns.com/foaf/spec/#term_msnChatID.
foafmsnChatID :: ScopedName

-- | foaf:myersBriggs from
--   http://xmlns.com/foaf/spec/#term_myersBriggs.
foafmyersBriggs :: ScopedName

-- | foaf:name from http://xmlns.com/foaf/spec/#term_name.
foafname :: ScopedName

-- | foaf:nick from http://xmlns.com/foaf/spec/#term_nick.
foafnick :: ScopedName

-- | foaf:openid from
--   http://xmlns.com/foaf/spec/#term_openid.
foafopenid :: ScopedName

-- | foaf:page from http://xmlns.com/foaf/spec/#term_page.
foafpage :: ScopedName

-- | foaf:pastProject from
--   http://xmlns.com/foaf/spec/#term_pastProject.
foafpastProject :: ScopedName

-- | foaf:phone from
--   http://xmlns.com/foaf/spec/#term_phone.
foafphone :: ScopedName

-- | foaf:plan from http://xmlns.com/foaf/spec/#term_plan.
foafplan :: ScopedName

-- | foaf:primaryTopic from
--   http://xmlns.com/foaf/spec/#term_primaryTopic.
foafprimaryTopic :: ScopedName

-- | foaf:publications from
--   http://xmlns.com/foaf/spec/#term_publications.
foafpublications :: ScopedName

-- | foaf:schoolHomepage from
--   http://xmlns.com/foaf/spec/#term_schoolHomepage.
foafschoolHomepage :: ScopedName

-- | foaf:sha1 from http://xmlns.com/foaf/spec/#term_sha1.
foafsha1 :: ScopedName

-- | foaf:skypeID from
--   http://xmlns.com/foaf/spec/#term_skypeID.
foafskypeID :: ScopedName

-- | foaf:status from
--   http://xmlns.com/foaf/spec/#term_status.
foafstatus :: ScopedName

-- | foaf:surname from
--   http://xmlns.com/foaf/spec/#term_surname.
foafsurname :: ScopedName

-- | foaf:theme from
--   http://xmlns.com/foaf/spec/#term_theme.
foaftheme :: ScopedName

-- | foaf:thumbnail from
--   http://xmlns.com/foaf/spec/#term_thumbnail.
foafthumbnail :: ScopedName

-- | foaf:tipjar from
--   http://xmlns.com/foaf/spec/#term_tipjar.
foaftipjar :: ScopedName

-- | foaf:title from
--   http://xmlns.com/foaf/spec/#term_title.
foaftitle :: ScopedName

-- | foaf:topic from
--   http://xmlns.com/foaf/spec/#term_topic.
foaftopic :: ScopedName

-- | foaf:topic_interest from
--   http://xmlns.com/foaf/spec/#term_topic_interest.
foaftopic_interest :: ScopedName

-- | foaf:weblog from
--   http://xmlns.com/foaf/spec/#term_weblog.
foafweblog :: ScopedName

-- | foaf:workInfoHomepage from
--   http://xmlns.com/foaf/spec/#term_workInfoHomepage.
foafworkInfoHomepage :: ScopedName

-- | foaf:workplaceHomepage from
--   http://xmlns.com/foaf/spec/#term_workplaceHomepage.
foafworkplaceHomepage :: ScopedName

-- | foaf:yahooChatID from
--   http://xmlns.com/foaf/spec/#term_yahooChatID.
foafyahooChatID :: ScopedName

-- | This module defines some commonly used vocabulary terms from the Geo
--   vocabulary (http://www.w3.org/2003/01/geo/, WGS84 Geo
--   Positioning: an RDF vocabulary).
--   
--   Note that unlike some of the existing vocabularies in Swish, the Geo
--   one matches the case and spelling of the RDF terms; so we use
--   geolat rather than geoLat.
module Swish.RDF.Vocabulary.Geo

-- | Maps geo to http://www.w3.org/2003/01/geo/wgs84_pos#.
namespaceGEO :: Namespace

-- | geo:SpatialThing.
geoSpatialThing :: ScopedName

-- | geo:Point.
geoPoint :: ScopedName

-- | geo:location.
geolocation :: ScopedName

-- | geo:lat.
geolat :: ScopedName

-- | geo:long.
geolong :: ScopedName

-- | geo:lat_long (it is suggested that this not be used when
--   generating RDF statements).
geolat_long :: ScopedName

-- | This module defines some vocabulary terms from the Provenance Ontology
--   http://www.w3.org/TR/prov-o/ by the W3C Provenance Working
--   Group (http://www.w3.org/2011/prov/wiki/Main_Page/). This is
--   experimental since the Ontology is still a Working Draft.
module Swish.RDF.Vocabulary.Provenance

-- | Maps prov to http://www.w3.org/ns/prov-o/.
namespacePROV :: Namespace

-- | prov:Activity from
--   http://www.w3.org/TR/prov-o/#activity.
provActivity :: ScopedName

-- | prov:Agent from http://www.w3.org/TR/prov-o/#agent.
provAgent :: ScopedName

-- | prov:Control from
--   http://www.w3.org/TR/prov-o/#control.
provControl :: ScopedName

-- | prov:Entity from http://www.w3.org/TR/prov-o/#entity.
provEntity :: ScopedName

-- | prov:Generation from
--   http://www.w3.org/TR/prov-o/#generation.
provGeneration :: ScopedName

-- | prov:Location from
--   http://www.w3.org/TR/prov-o/#location.
provLocation :: ScopedName

-- | prov:Participation from
--   http://www.w3.org/TR/prov-o/#participation.
provParticipation :: ScopedName

-- | prov:ProvenanceContainer from
--   http://www.w3.org/TR/prov-o/#provenancecontainer.
provProvenanceContainer :: ScopedName

-- | prov:QualifiedInvolvement from
--   http://www.w3.org/TR/prov-o/#qualifiedinvolvement.
provQualifiedInvolvement :: ScopedName

-- | prov:Recipe from http://www.w3.org/TR/prov-o/#recipe.
provRecipe :: ScopedName

-- | prov:Role from http://www.w3.org/TR/prov-o/#role.
provRole :: ScopedName

-- | prov:Usage from http://www.w3.org/TR/prov-o/#usage.
provUsage :: ScopedName

-- | prov:dependedOn from
--   http://www.w3.org/TR/prov-o/#dependedon.
provdependedOn :: ScopedName

-- | prov:endedAt from
--   http://www.w3.org/TR/prov-o/#endedat.
provendedAt :: ScopedName

-- | prov:hadLocation from
--   http://www.w3.org/TR/prov-o/#hadlocation.
provhadLocation :: ScopedName

-- | prov:hadOriginalSource from
--   http://www.w3.org/TR/prov-o/#hadoriginalsource.
provhadOriginalSource :: ScopedName

-- | prov:hadParticipant from
--   http://www.w3.org/TR/prov-o/#hadparticipant.
provhadParticipant :: ScopedName

-- | prov:hadQualifiedControl from
--   http://www.w3.org/TR/prov-o/#hadqualifiedcontrol.
provhadQualifiedControl :: ScopedName

-- | prov:hadQualifiedEntity from
--   http://www.w3.org/TR/prov-o/#hadqualifiedentity.
provhadQualifiedEntity :: ScopedName

-- | prov:hadQualifiedGeneration from
--   http://www.w3.org/TR/prov-o/#hadqualifiedgeneration.
provhadQualifiedGeneration :: ScopedName

-- | prov:hadQualifiedParticipation from
--   http://www.w3.org/TR/prov-o/#hadqualifiedparticipation.
provhadQualifiedParticipation :: ScopedName

-- | prov:hadQualifiedUsage from
--   http://www.w3.org/TR/prov-o/#hadqualifiedusage.
provhadQualifiedUsage :: ScopedName

-- | prov:hadRecipe from
--   http://www.w3.org/TR/prov-o/#hadrecipe.
provhadRecipe :: ScopedName

-- | prov:hadRole from
--   http://www.w3.org/TR/prov-o/#hadrole.
provhadRole :: ScopedName

-- | prov:hadTemporalValue from
--   http://www.w3.org/TR/prov-o/#hadtemporalvalue.
provhadTemporalValue :: ScopedName

-- | prov:startedAt from
--   http://www.w3.org/TR/prov-o/#startedat.
provstartedAt :: ScopedName

-- | prov:used from http://www.w3.org/TR/prov-o/#used.
provused :: ScopedName

-- | prov:wasAttributedTo from
--   http://www.w3.org/TR/prov-o/#wasattributedto.
provwasAttributedTo :: ScopedName

-- | prov:wasComplementOf from
--   http://www.w3.org/TR/prov-o/#wascomplementof.
provwasComplementOf :: ScopedName

-- | prov:wasControlledBy from
--   http://www.w3.org/TR/prov-o/#wascontrolledby.
provwasControlledBy :: ScopedName

-- | prov:wasDerivedFrom from
--   http://www.w3.org/TR/prov-o/#wasderivedfrom.
provwasDerivedFrom :: ScopedName

-- | prov:wasEventuallyDerivedFrom from
--   http://www.w3.org/TR/prov-o/#waseventuallyderivedfrom.
provwasEventuallyDerivedFrom :: ScopedName

-- | prov:wasGeneratedAt from
--   http://www.w3.org/TR/prov-o/#wasgeneratedat.
provwasGeneratedAt :: ScopedName

-- | prov:wasGeneratedBy from
--   http://www.w3.org/TR/prov-o/#wasgeneratedby.
provwasGeneratedBy :: ScopedName

-- | prov:wasInformedBy from
--   http://www.w3.org/TR/prov-o/#wasinformedby.
provwasInformedBy :: ScopedName

-- | prov:wasQuoteOf from
--   http://www.w3.org/TR/prov-o/#wasquoteof.
provwasQuoteOf :: ScopedName

-- | prov:wasRevisionOf from
--   http://www.w3.org/TR/prov-o/#wasrevisionof.
provwasRevisionOf :: ScopedName

-- | prov:wasScheduledAfter from
--   http://www.w3.org/TR/prov-o/#wasscheduledafter.
provwasScheduledAfter :: ScopedName

-- | prov:wasSummaryOf from
--   http://www.w3.org/TR/prov-o/#wassummaryof.
provwasSummaryOf :: ScopedName

-- | This module defines some commonly used vocabulary terms from the SIOC
--   project (http://sioc-project.org/).
module Swish.RDF.Vocabulary.SIOC

-- | Maps sioc to http://rdfs.org/sioc/ns#.
namespaceSIOC :: Namespace

-- | sioc:Community from
--   http://rdfs.org/sioc/spec/#term_Community.
siocCommunity :: ScopedName

-- | sioc:Container from
--   http://rdfs.org/sioc/spec/#term_Container.
siocContainer :: ScopedName

-- | sioc:Forum from http://rdfs.org/sioc/spec/#term_Forum.
siocForum :: ScopedName

-- | sioc:Item from http://rdfs.org/sioc/spec/#term_Item.
siocItem :: ScopedName

-- | sioc:Post from http://rdfs.org/sioc/spec/#term_Post.
siocPost :: ScopedName

-- | sioc:Role from http://rdfs.org/sioc/spec/#term_Role.
siocRole :: ScopedName

-- | sioc:Site from http://rdfs.org/sioc/spec/#term_Site.
siocSite :: ScopedName

-- | sioc:Space from http://rdfs.org/sioc/spec/#term_Space.
siocSpace :: ScopedName

-- | sioc:Thread from
--   http://rdfs.org/sioc/spec/#term_Thread.
siocThread :: ScopedName

-- | sioc:UserAccount from
--   http://rdfs.org/sioc/spec/#term_UserAccount.
siocUserAccount :: ScopedName

-- | sioc:Usergroup from
--   http://rdfs.org/sioc/spec/#term_Usergroup.
siocUsergroup :: ScopedName

-- | sioc:about from http://rdfs.org/sioc/spec/#term_about.
siocabout :: ScopedName

-- | sioc:account_of from
--   http://rdfs.org/sioc/spec/#term_account_of.
siocaccount_of :: ScopedName

-- | sioc:addressed_to from
--   http://rdfs.org/sioc/spec/#term_addressed_to.
siocaddressed_to :: ScopedName

-- | sioc:administrator_of from
--   http://rdfs.org/sioc/spec/#term_administrator_of.
siocadministrator_of :: ScopedName

-- | sioc:attachment from
--   http://rdfs.org/sioc/spec/#term_attachment.
siocattachment :: ScopedName

-- | sioc:avatar from
--   http://rdfs.org/sioc/spec/#term_avatar.
siocavatar :: ScopedName

-- | sioc:container_of from
--   http://rdfs.org/sioc/spec/#term_container_of.
sioccontainer_of :: ScopedName

-- | sioc:content from
--   http://rdfs.org/sioc/spec/#term_content.
sioccontent :: ScopedName

-- | sioc:creator_of from
--   http://rdfs.org/sioc/spec/#term_creator_of.
sioccreator_of :: ScopedName

-- | sioc:earlier_version from
--   http://rdfs.org/sioc/spec/#term_earlier_version.
siocearlier_version :: ScopedName

-- | sioc:email from http://rdfs.org/sioc/spec/#term_email.
siocemail :: ScopedName

-- | sioc:email_sha1 from
--   http://rdfs.org/sioc/spec/#term_email_sha1.
siocemail_sha1 :: ScopedName

-- | sioc:embeds_knowledge from
--   http://rdfs.org/sioc/spec/#term_embeds_knowledge.
siocembeds_knowledge :: ScopedName

-- | sioc:feed from http://rdfs.org/sioc/spec/#term_feed.
siocfeed :: ScopedName

-- | sioc:follows from
--   http://rdfs.org/sioc/spec/#term_follows.
siocfollows :: ScopedName

-- | sioc:function_of from
--   http://rdfs.org/sioc/spec/#term_function_of.
siocfunction_of :: ScopedName

-- | sioc:has_administrator from
--   http://rdfs.org/sioc/spec/#term_has_administrator.
siochas_administrator :: ScopedName

-- | sioc:has_container from
--   http://rdfs.org/sioc/spec/#term_has_container.
siochas_container :: ScopedName

-- | sioc:has_creator from
--   http://rdfs.org/sioc/spec/#term_has_creator.
siochas_creator :: ScopedName

-- | sioc:has_discussion from
--   http://rdfs.org/sioc/spec/#term_has_discussion.
siochas_discussion :: ScopedName

-- | sioc:has_function from
--   http://rdfs.org/sioc/spec/#term_has_function.
siochas_function :: ScopedName

-- | sioc:has_host from
--   http://rdfs.org/sioc/spec/#term_has_host.
siochas_host :: ScopedName

-- | sioc:has_member from
--   http://rdfs.org/sioc/spec/#term_has_member.
siochas_member :: ScopedName

-- | sioc:has_moderator from
--   http://rdfs.org/sioc/spec/#term_has_moderator.
siochas_moderator :: ScopedName

-- | sioc:has_modifier from
--   http://rdfs.org/sioc/spec/#term_has_modifier.
siochas_modifier :: ScopedName

-- | sioc:has_owner from
--   http://rdfs.org/sioc/spec/#term_has_owner.
siochas_owner :: ScopedName

-- | sioc:has_parent from
--   http://rdfs.org/sioc/spec/#term_has_parent.
siochas_parent :: ScopedName

-- | sioc:has_reply from
--   http://rdfs.org/sioc/spec/#term_has_reply.
siochas_reply :: ScopedName

-- | sioc:has_scope from
--   http://rdfs.org/sioc/spec/#term_has_scope.
siochas_scope :: ScopedName

-- | sioc:has_space from
--   http://rdfs.org/sioc/spec/#term_has_space.
siochas_space :: ScopedName

-- | sioc:has_subscriber from
--   http://rdfs.org/sioc/spec/#term_has_subscriber.
siochas_subscriber :: ScopedName

-- | sioc:has_usergroup from
--   http://rdfs.org/sioc/spec/#term_has_usergroup.
siochas_usergroup :: ScopedName

-- | sioc:host_of from
--   http://rdfs.org/sioc/spec/#term_host_of.
siochost_of :: ScopedName

-- | sioc:id from http://rdfs.org/sioc/spec/#term_id.
siocid :: ScopedName

-- | sioc:ip_address from
--   http://rdfs.org/sioc/spec/#term_ip_address.
siocip_address :: ScopedName

-- | sioc:last_activity_date from
--   http://rdfs.org/sioc/spec/#term_last_activity_date.
sioclast_activity_date :: ScopedName

-- | sioc:last_item_date from
--   http://rdfs.org/sioc/spec/#term_last_item_date.
sioclast_item_date :: ScopedName

-- | sioc:last_reply_date from
--   http://rdfs.org/sioc/spec/#term_last_reply_date.
sioclast_reply_date :: ScopedName

-- | sioc:later_version from
--   http://rdfs.org/sioc/spec/#term_later_version.
sioclater_version :: ScopedName

-- | sioc:latest_version from
--   http://rdfs.org/sioc/spec/#term_latest_version.
sioclatest_version :: ScopedName

-- | sioc:link from http://rdfs.org/sioc/spec/#term_link.
sioclink :: ScopedName

-- | sioc:links_to from
--   http://rdfs.org/sioc/spec/#term_links_to.
sioclinks_to :: ScopedName

-- | sioc:member_of from
--   http://rdfs.org/sioc/spec/#term_member_of.
siocmember_of :: ScopedName

-- | sioc:moderator_of from
--   http://rdfs.org/sioc/spec/#term_moderator_of.
siocmoderator_of :: ScopedName

-- | sioc:modifier_of from
--   http://rdfs.org/sioc/spec/#term_modifier_of.
siocmodifier_of :: ScopedName

-- | sioc:name from http://rdfs.org/sioc/spec/#term_name.
siocname :: ScopedName

-- | sioc:next_by_date from
--   http://rdfs.org/sioc/spec/#term_next_by_date.
siocnext_by_date :: ScopedName

-- | sioc:next_version from
--   http://rdfs.org/sioc/spec/#term_next_version.
siocnext_version :: ScopedName

-- | sioc:note from http://rdfs.org/sioc/spec/#term_note.
siocnote :: ScopedName

-- | sioc:num_authors from
--   http://rdfs.org/sioc/spec/#term_num_authors.
siocnum_authors :: ScopedName

-- | sioc:num_items from
--   http://rdfs.org/sioc/spec/#term_num_items.
siocnum_items :: ScopedName

-- | sioc:num_replies from
--   http://rdfs.org/sioc/spec/#term_num_replies.
siocnum_replies :: ScopedName

-- | sioc:num_threads from
--   http://rdfs.org/sioc/spec/#term_num_threads.
siocnum_threads :: ScopedName

-- | sioc:num_views from
--   http://rdfs.org/sioc/spec/#term_num_views.
siocnum_views :: ScopedName

-- | sioc:owner_of from
--   http://rdfs.org/sioc/spec/#term_owner_of.
siocowner_of :: ScopedName

-- | sioc:parent_of from
--   http://rdfs.org/sioc/spec/#term_parent_of.
siocparent_of :: ScopedName

-- | sioc:previous_by_date from
--   http://rdfs.org/sioc/spec/#term_previous_by_date.
siocprevious_by_date :: ScopedName

-- | sioc:previous_version from
--   http://rdfs.org/sioc/spec/#term_previous_version.
siocprevious_version :: ScopedName

-- | sioc:related_to from
--   http://rdfs.org/sioc/spec/#term_related_to.
siocrelated_to :: ScopedName

-- | sioc:reply_of from
--   http://rdfs.org/sioc/spec/#term_reply_of.
siocreply_of :: ScopedName

-- | sioc:scope_of from
--   http://rdfs.org/sioc/spec/#term_scope_of.
siocscope_of :: ScopedName

-- | sioc:sibling from
--   http://rdfs.org/sioc/spec/#term_sibling.
siocsibling :: ScopedName

-- | sioc:space_of from
--   http://rdfs.org/sioc/spec/#term_space_of.
siocspace_of :: ScopedName

-- | sioc:subscriber_of from
--   http://rdfs.org/sioc/spec/#term_subscriber_of.
siocsubscriber_of :: ScopedName

-- | sioc:topic from http://rdfs.org/sioc/spec/#term_topic.
sioctopic :: ScopedName

-- | sioc:usergroup_of from
--   http://rdfs.org/sioc/spec/#term_usergroup_of.
siocusergroup_of :: ScopedName
