{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Swish.RDF.ProofContext ( rulesetRDF
, rulesetRDFS
, rulesetRDFD) where
import Swish.Datatype (typeMkCanonicalForm)
import Swish.Namespace (Namespace, makeNSScopedName)
import Swish.QName (LName)
import Swish.Ruleset (makeRuleset)
import Swish.VarBinding (VarBindingModify(..))
import Swish.VarBinding (applyVarBinding, addVarBinding, makeVarFilterModify, varFilterDisjunction)
import Swish.RDF.BuiltIn.Datatypes (findRDFDatatype)
import Swish.RDF.Proof (makeRdfSubgraphEntailmentRule
, makeRdfSimpleEntailmentRule )
import Swish.RDF.Ruleset
( RDFFormula, RDFRule, RDFRuleset
, makeRDFFormula
, makeN3ClosureRule
, makeN3ClosureSimpleRule
, makeN3ClosureModifyRule
, makeN3ClosureAllocatorRule
, makeNodeAllocTo )
import Swish.RDF.VarBinding
( RDFVarBinding
, RDFVarBindingModify
, RDFVarBindingFilter
, rdfVarBindingUriRef, rdfVarBindingBlank
, rdfVarBindingLiteral
, rdfVarBindingUntypedLiteral
, rdfVarBindingXMLLiteral, rdfVarBindingDatatyped
, rdfVarBindingMemberProp
)
import Swish.RDF.Graph (RDFLabel(..), isUri)
import Swish.RDF.Vocabulary
( namespaceRDFD
, scopeRDF
, scopeRDFS
, scopeRDFD
)
#if (!defined(__GLASGOW_HASKELL__)) || (__GLASGOW_HASKELL__ < 710)
import Data.Monoid (Monoid(..))
#endif
import qualified Data.Text.Lazy.Builder as B
makeFormula :: Namespace -> LName -> B.Builder -> RDFFormula
makeFormula :: Namespace -> LName -> Builder -> RDFFormula
makeFormula = Namespace -> LName -> Builder -> RDFFormula
makeRDFFormula
requireAny :: [RDFVarBindingFilter] -> RDFVarBindingFilter
requireAny :: [RDFVarBindingFilter] -> RDFVarBindingFilter
requireAny = forall a b. Eq a => [VarBindingFilter a b] -> VarBindingFilter a b
varFilterDisjunction
isLiteralV :: String -> RDFVarBindingFilter
isLiteralV :: String -> RDFVarBindingFilter
isLiteralV = RDFLabel -> RDFVarBindingFilter
rdfVarBindingLiteral forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> RDFLabel
Var
isUntypedLitV :: String -> RDFVarBindingFilter
isUntypedLitV :: String -> RDFVarBindingFilter
isUntypedLitV = RDFLabel -> RDFVarBindingFilter
rdfVarBindingUntypedLiteral forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> RDFLabel
Var
isXMLLitV :: String -> RDFVarBindingFilter
isXMLLitV :: String -> RDFVarBindingFilter
isXMLLitV = RDFLabel -> RDFVarBindingFilter
rdfVarBindingXMLLiteral forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> RDFLabel
Var
isUriRefV :: String -> RDFVarBindingFilter
isUriRefV :: String -> RDFVarBindingFilter
isUriRefV = RDFLabel -> RDFVarBindingFilter
rdfVarBindingUriRef forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> RDFLabel
Var
isBlankV :: String -> RDFVarBindingFilter
isBlankV :: String -> RDFVarBindingFilter
isBlankV = RDFLabel -> RDFVarBindingFilter
rdfVarBindingBlank forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> RDFLabel
Var
isDatatypedV :: String -> String -> RDFVarBindingFilter
isDatatypedV :: String -> String -> RDFVarBindingFilter
isDatatypedV String
d String
l = RDFLabel -> RDFLabel -> RDFVarBindingFilter
rdfVarBindingDatatyped (String -> RDFLabel
Var String
d) (String -> RDFLabel
Var String
l)
isMemberPropV :: String -> RDFVarBindingFilter
isMemberPropV :: String -> RDFVarBindingFilter
isMemberPropV = RDFLabel -> RDFVarBindingFilter
rdfVarBindingMemberProp forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> RDFLabel
Var
allocateTo :: String -> String -> [RDFLabel] -> RDFVarBindingModify
allocateTo :: String -> String -> [RDFLabel] -> RDFVarBindingModify
allocateTo String
bv String
av = RDFLabel -> RDFLabel -> [RDFLabel] -> RDFVarBindingModify
makeNodeAllocTo (String -> RDFLabel
Var String
bv) (String -> RDFLabel
Var String
av)
valueSame :: String -> String -> String -> String -> RDFVarBindingModify
valueSame :: String -> String -> String -> String -> RDFVarBindingModify
valueSame String
val1 String
typ1 String
val2 String
typ2 =
RDFLabel -> RDFLabel -> RDFLabel -> RDFLabel -> RDFVarBindingModify
sameDatatypedValue (String -> RDFLabel
Var String
val1) (String -> RDFLabel
Var String
typ1) (String -> RDFLabel
Var String
val2) (String -> RDFLabel
Var String
typ2)
sameDatatypedValue ::
RDFLabel -> RDFLabel -> RDFLabel -> RDFLabel -> RDFVarBindingModify
sameDatatypedValue :: RDFLabel -> RDFLabel -> RDFLabel -> RDFLabel -> RDFVarBindingModify
sameDatatypedValue RDFLabel
val1 RDFLabel
typ1 RDFLabel
val2 RDFLabel
typ2 = VarBindingModify
{ vbmName :: ScopedName
vbmName = Namespace -> LName -> ScopedName
makeNSScopedName Namespace
namespaceRDFD LName
"sameValue"
, vbmApply :: [VarBinding RDFLabel RDFLabel] -> [VarBinding RDFLabel RDFLabel]
vbmApply = RDFLabel
-> RDFLabel
-> RDFLabel
-> RDFLabel
-> [VarBinding RDFLabel RDFLabel]
-> [VarBinding RDFLabel RDFLabel]
sameDatatypedValueApplyAll RDFLabel
val1 RDFLabel
typ1 RDFLabel
val2 RDFLabel
typ2
, vbmVocab :: [RDFLabel]
vbmVocab = [RDFLabel
val1,RDFLabel
typ1,RDFLabel
val2,RDFLabel
typ2]
, vbmUsage :: [[RDFLabel]]
vbmUsage = [[RDFLabel
val2]]
}
sameDatatypedValueApplyAll ::
RDFLabel -> RDFLabel -> RDFLabel -> RDFLabel
-> [RDFVarBinding]
-> [RDFVarBinding]
sameDatatypedValueApplyAll :: RDFLabel
-> RDFLabel
-> RDFLabel
-> RDFLabel
-> [VarBinding RDFLabel RDFLabel]
-> [VarBinding RDFLabel RDFLabel]
sameDatatypedValueApplyAll RDFLabel
val1 RDFLabel
typ1 RDFLabel
val2 RDFLabel
typ2 =
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (RDFLabel
-> RDFLabel
-> RDFLabel
-> RDFLabel
-> VarBinding RDFLabel RDFLabel
-> [VarBinding RDFLabel RDFLabel]
sameDatatypedValueApply RDFLabel
val1 RDFLabel
typ1 RDFLabel
val2 RDFLabel
typ2)
sameDatatypedValueApply ::
RDFLabel -> RDFLabel -> RDFLabel -> RDFLabel
-> RDFVarBinding
-> [RDFVarBinding]
sameDatatypedValueApply :: RDFLabel
-> RDFLabel
-> RDFLabel
-> RDFLabel
-> VarBinding RDFLabel RDFLabel
-> [VarBinding RDFLabel RDFLabel]
sameDatatypedValueApply RDFLabel
val1 RDFLabel
typ1 RDFLabel
val2 RDFLabel
typ2 VarBinding RDFLabel RDFLabel
vbind =
[VarBinding RDFLabel RDFLabel]
result
where
v1 :: RDFLabel
v1 = forall a. VarBinding a a -> a -> a
applyVarBinding VarBinding RDFLabel RDFLabel
vbind RDFLabel
val1
t1 :: RDFLabel
t1 = forall a. VarBinding a a -> a -> a
applyVarBinding VarBinding RDFLabel RDFLabel
vbind RDFLabel
typ1
t2 :: RDFLabel
t2 = forall a. VarBinding a a -> a -> a
applyVarBinding VarBinding RDFLabel RDFLabel
vbind RDFLabel
typ2
sametype :: Maybe RDFLabel
sametype = RDFLabel -> RDFLabel -> RDFLabel -> Maybe RDFLabel
getCanonical RDFLabel
v1 RDFLabel
t1 RDFLabel
t2
result :: [VarBinding RDFLabel RDFLabel]
result =
if RDFLabel -> Bool
isUri RDFLabel
t1 Bool -> Bool -> Bool
&& RDFLabel -> Bool
isUri RDFLabel
t2 then
if RDFLabel
t1 forall a. Eq a => a -> a -> Bool
== RDFLabel
t2 then
case Maybe RDFLabel
sametype of
Just RDFLabel
st -> [forall a b.
(Ord a, Ord b) =>
a -> b -> VarBinding a b -> VarBinding a b
addVarBinding RDFLabel
val2 RDFLabel
st VarBinding RDFLabel RDFLabel
vbind]
Maybe RDFLabel
_ -> []
else
forall a. HasCallStack => String -> a
error String
"subtype conversions not yet defined"
else
[]
getCanonical :: RDFLabel -> RDFLabel -> RDFLabel -> Maybe RDFLabel
getCanonical :: RDFLabel -> RDFLabel -> RDFLabel -> Maybe RDFLabel
getCanonical (TypedLit Text
v ScopedName
dt) (Res ScopedName
dqn1) (Res ScopedName
dqn2) =
if ScopedName
dt forall a. Eq a => a -> a -> Bool
== ScopedName
dqn1
then case ScopedName -> Maybe RDFDatatype
findRDFDatatype ScopedName
dqn1 of
Just RDFDatatype
dt1 -> forall a b c. (a -> b -> c) -> b -> a -> c
flip Text -> ScopedName -> RDFLabel
TypedLit ScopedName
dqn2 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` forall ex lb vn. Datatype ex lb vn -> Text -> Maybe Text
typeMkCanonicalForm RDFDatatype
dt1 Text
v
Maybe RDFDatatype
_ -> forall a. Maybe a
Nothing
else forall a. Maybe a
Nothing
getCanonical RDFLabel
_ RDFLabel
_ RDFLabel
_ = forall a. Maybe a
Nothing
rdfa1 :: RDFFormula
rdfa1 :: RDFFormula
rdfa1 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a1" Builder
"rdf:type rdf:type rdf:Property ."
rdfa2 :: RDFFormula
rdfa2 :: RDFFormula
rdfa2 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a2" Builder
"rdf:subject rdf:type rdf:Property ."
rdfa3 :: RDFFormula
rdfa3 :: RDFFormula
rdfa3 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a3" Builder
"rdf:predicate rdf:type rdf:Property ."
rdfa4 :: RDFFormula
rdfa4 :: RDFFormula
rdfa4 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a4" Builder
"rdf:object rdf:type rdf:Property ."
rdfa5 :: RDFFormula
rdfa5 :: RDFFormula
rdfa5 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a5" Builder
"rdf:first rdf:type rdf:Property ."
rdfa6 :: RDFFormula
rdfa6 :: RDFFormula
rdfa6 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a6" Builder
"rdf:rest rdf:type rdf:Property ."
rdfa7 :: RDFFormula
rdfa7 :: RDFFormula
rdfa7 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a7" Builder
"rdf:value rdf:type rdf:Property ."
rdfa8 :: RDFFormula
rdfa8 :: RDFFormula
rdfa8 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDF LName
"a8" Builder
"rdf:nil rdf:type rdf:List ."
axiomsRDF :: [RDFFormula]
axiomsRDF :: [RDFFormula]
axiomsRDF =
[ RDFFormula
rdfa1, RDFFormula
rdfa2, RDFFormula
rdfa3, RDFFormula
rdfa4, RDFFormula
rdfa5
, RDFFormula
rdfa6, RDFFormula
rdfa7, RDFFormula
rdfa8
]
rdfsub :: RDFRule
rdfsub :: RDFRule
rdfsub = ScopedName -> RDFRule
makeRdfSubgraphEntailmentRule (Namespace -> LName -> ScopedName
makeNSScopedName Namespace
scopeRDF LName
"sub")
rdfse :: RDFRule
rdfse :: RDFRule
rdfse = ScopedName -> RDFRule
makeRdfSimpleEntailmentRule (Namespace -> LName -> ScopedName
makeNSScopedName Namespace
scopeRDF LName
"se")
rdflg :: RDFRule
rdflg :: RDFRule
rdflg = Namespace
-> LName
-> Builder
-> Builder
-> RDFVarBindingModify
-> ([RDFLabel] -> RDFVarBindingModify)
-> RDFRule
makeN3ClosureAllocatorRule Namespace
scopeRDF LName
"lg"
Builder
"?x ?a ?l . "
Builder
"?x ?a ?b . ?b rdf:_allocatedTo ?l ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isLiteralV String
"l")
(String -> String -> [RDFLabel] -> RDFVarBindingModify
allocateTo String
"b" String
"l")
rdfgl :: RDFRule
rdfgl :: RDFRule
rdfgl = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDF LName
"gl"
Builder
"?x ?a ?l . ?b rdf:_allocatedTo ?l . "
Builder
"?x ?a ?b ."
rdfr1 :: RDFRule
rdfr1 :: RDFRule
rdfr1 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDF LName
"r1"
Builder
"?x ?a ?y ."
Builder
"?a rdf:type rdf:Property ."
rdfr2 :: RDFRule
rdfr2 :: RDFRule
rdfr2 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDF LName
"r2"
Builder
"?x ?a ?b . ?b rdf:_allocatedTo ?l . "
Builder
"?b rdf:type rdf:XMLLiteral ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isXMLLitV String
"l")
rdfcp1 :: RDFRule
rdfcp1 :: RDFRule
rdfcp1 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDF LName
"cp1"
Builder
"?x ?c ?y . "
Builder
"?c rdf:type rdf:Property ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfcp2 :: RDFRule
rdfcp2 :: RDFRule
rdfcp2 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDF LName
"cp2"
Builder
"?c ?p ?y . "
Builder
"?c rdf:type rdf:Property ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfcp3 :: RDFRule
rdfcp3 :: RDFRule
rdfcp3 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDF LName
"cp3"
Builder
"?x ?p ?c . "
Builder
"?c rdf:type rdf:Property ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rulesRDF :: [RDFRule]
rulesRDF :: [RDFRule]
rulesRDF =
[ RDFRule
rdfsub, RDFRule
rdfse
, RDFRule
rdflg, RDFRule
rdfgl
, RDFRule
rdfr1, RDFRule
rdfr2
, RDFRule
rdfcp1, RDFRule
rdfcp2, RDFRule
rdfcp3
]
rulesetRDF :: RDFRuleset
rulesetRDF :: RDFRuleset
rulesetRDF = forall ex. Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex
makeRuleset Namespace
scopeRDF [RDFFormula]
axiomsRDF [RDFRule]
rulesRDF
rdfsa01 :: RDFFormula
rdfsa01 :: RDFFormula
rdfsa01 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a01"
Builder
"rdf:type rdfs:domain rdfs:Resource ."
rdfsa02 :: RDFFormula
rdfsa02 :: RDFFormula
rdfsa02 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a02"
Builder
"rdf:type rdfs:range rdfs:Class ."
rdfsa03 :: RDFFormula
rdfsa03 :: RDFFormula
rdfsa03 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a03"
Builder
"rdfs:domain rdfs:domain rdf:Property ."
rdfsa04 :: RDFFormula
rdfsa04 :: RDFFormula
rdfsa04 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a04"
Builder
"rdfs:domain rdfs:range rdfs:Class ."
rdfsa05 :: RDFFormula
rdfsa05 :: RDFFormula
rdfsa05 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a05"
Builder
"rdfs:range rdfs:domain rdf:Property ."
rdfsa06 :: RDFFormula
rdfsa06 :: RDFFormula
rdfsa06 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a06"
Builder
"rdfs:range rdfs:range rdfs:Class ."
rdfsa07 :: RDFFormula
rdfsa07 :: RDFFormula
rdfsa07 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a07"
Builder
"rdfs:subPropertyOf rdfs:domain rdf:Property ."
rdfsa08 :: RDFFormula
rdfsa08 :: RDFFormula
rdfsa08 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a08"
Builder
"rdfs:subPropertyOf rdfs:range rdf:Property ."
rdfsa09 :: RDFFormula
rdfsa09 :: RDFFormula
rdfsa09 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a09"
Builder
"rdfs:subClassOf rdfs:domain rdfs:Class ."
rdfsa10 :: RDFFormula
rdfsa10 :: RDFFormula
rdfsa10 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a10"
Builder
"rdfs:subClassOf rdfs:range rdfs:Class ."
rdfsa11 :: RDFFormula
rdfsa11 :: RDFFormula
rdfsa11 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a11"
Builder
"rdf:subject rdfs:domain rdf:Statement ."
rdfsa12 :: RDFFormula
rdfsa12 :: RDFFormula
rdfsa12 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a12"
Builder
"rdf:subject rdfs:range rdfs:Resource ."
rdfsa13 :: RDFFormula
rdfsa13 :: RDFFormula
rdfsa13 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a13"
Builder
"rdf:predicate rdfs:domain rdf:Statement ."
rdfsa14 :: RDFFormula
rdfsa14 :: RDFFormula
rdfsa14 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a14"
Builder
"rdf:predicate rdfs:range rdfs:Resource ."
rdfsa15 :: RDFFormula
rdfsa15 :: RDFFormula
rdfsa15 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a15"
Builder
"rdf:object rdfs:domain rdf:Statement ."
rdfsa16 :: RDFFormula
rdfsa16 :: RDFFormula
rdfsa16 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a16"
Builder
"rdf:object rdfs:range rdfs:Resource ."
rdfsa17 :: RDFFormula
rdfsa17 :: RDFFormula
rdfsa17 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a17"
Builder
"rdfs:member rdfs:domain rdfs:Resource ."
rdfsa18 :: RDFFormula
rdfsa18 :: RDFFormula
rdfsa18 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a18"
Builder
"rdfs:member rdfs:range rdfs:Resource ."
rdfsa19 :: RDFFormula
rdfsa19 :: RDFFormula
rdfsa19 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a19"
Builder
"rdf:first rdfs:domain rdf:List ."
rdfsa20 :: RDFFormula
rdfsa20 :: RDFFormula
rdfsa20 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a20"
Builder
"rdf:first rdfs:range rdfs:Resource ."
rdfsa21 :: RDFFormula
rdfsa21 :: RDFFormula
rdfsa21 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a21"
Builder
"rdf:rest rdfs:domain rdf:List ."
rdfsa22 :: RDFFormula
rdfsa22 :: RDFFormula
rdfsa22 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a22"
Builder
"rdf:rest rdfs:range rdf:List ."
rdfsa23 :: RDFFormula
rdfsa23 :: RDFFormula
rdfsa23 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a23"
Builder
"rdfs:seeAlso rdfs:domain rdfs:Resource ."
rdfsa24 :: RDFFormula
rdfsa24 :: RDFFormula
rdfsa24 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a24"
Builder
"rdfs:seeAlso rdfs:range rdfs:Resource ."
rdfsa25 :: RDFFormula
rdfsa25 :: RDFFormula
rdfsa25 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a25"
Builder
"rdfs:isDefinedBy rdfs:domain rdfs:Resource ."
rdfsa26 :: RDFFormula
rdfsa26 :: RDFFormula
rdfsa26 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a26"
Builder
"rdfs:isDefinedBy rdfs:range rdfs:Resource ."
rdfsa27 :: RDFFormula
rdfsa27 :: RDFFormula
rdfsa27 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a27"
Builder
"rdfs:isDefinedBy rdfs:subPropertyOf rdfs:seeAlso ."
rdfsa28 :: RDFFormula
rdfsa28 :: RDFFormula
rdfsa28 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a28"
Builder
"rdfs:comment rdfs:domain rdfs:Resource ."
rdfsa29 :: RDFFormula
rdfsa29 :: RDFFormula
rdfsa29 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a29"
Builder
"rdfs:comment rdfs:range rdfs:Literal ."
rdfsa30 :: RDFFormula
rdfsa30 :: RDFFormula
rdfsa30 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a30"
Builder
"rdfs:label rdfs:domain rdfs:Resource ."
rdfsa31 :: RDFFormula
rdfsa31 :: RDFFormula
rdfsa31 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a31"
Builder
"rdfs:label rdfs:range rdfs:Literal ."
rdfsa32 :: RDFFormula
rdfsa32 :: RDFFormula
rdfsa32 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a32"
Builder
"rdf:value rdfs:domain rdfs:Resource ."
rdfsa33 :: RDFFormula
rdfsa33 :: RDFFormula
rdfsa33 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a33"
Builder
"rdf:value rdfs:range rdfs:Resource ."
rdfsa34 :: RDFFormula
rdfsa34 :: RDFFormula
rdfsa34 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a34"
Builder
"rdf:Alt rdfs:subClassOf rdfs:Container ."
rdfsa35 :: RDFFormula
rdfsa35 :: RDFFormula
rdfsa35 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a35"
Builder
"rdf:Bag rdfs:subClassOf rdfs:Container ."
rdfsa36 :: RDFFormula
rdfsa36 :: RDFFormula
rdfsa36 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a36"
Builder
"rdf:Seq rdfs:subClassOf rdfs:Container ."
rdfsa37 :: RDFFormula
rdfsa37 :: RDFFormula
rdfsa37 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a37"
Builder
"rdfs:ContainerMembershipProperty rdfs:subClassOf rdf:Property ."
rdfsa38 :: RDFFormula
rdfsa38 :: RDFFormula
rdfsa38 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a38"
Builder
"rdf:XMLLiteral rdf:type rdfs:Datatype ."
rdfsa39 :: RDFFormula
rdfsa39 :: RDFFormula
rdfsa39 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a39"
Builder
"rdf:XMLLiteral rdfs:subClassOf rdfs:Literal ."
rdfsa40 :: RDFFormula
rdfsa40 :: RDFFormula
rdfsa40 = Namespace -> LName -> Builder -> RDFFormula
makeFormula Namespace
scopeRDFS LName
"a40"
Builder
"rdfs:Datatype rdfs:subClassOf rdfs:Class ."
axiomsRDFS :: [RDFFormula]
axiomsRDFS :: [RDFFormula]
axiomsRDFS =
[ RDFFormula
rdfsa01, RDFFormula
rdfsa02, RDFFormula
rdfsa03, RDFFormula
rdfsa04
, RDFFormula
rdfsa05, RDFFormula
rdfsa06, RDFFormula
rdfsa07, RDFFormula
rdfsa08, RDFFormula
rdfsa09
, RDFFormula
rdfsa10, RDFFormula
rdfsa11, RDFFormula
rdfsa12, RDFFormula
rdfsa13, RDFFormula
rdfsa14
, RDFFormula
rdfsa15, RDFFormula
rdfsa16, RDFFormula
rdfsa17, RDFFormula
rdfsa18, RDFFormula
rdfsa19
, RDFFormula
rdfsa20, RDFFormula
rdfsa21, RDFFormula
rdfsa22, RDFFormula
rdfsa23, RDFFormula
rdfsa24
, RDFFormula
rdfsa25, RDFFormula
rdfsa26, RDFFormula
rdfsa27, RDFFormula
rdfsa28, RDFFormula
rdfsa29
, RDFFormula
rdfsa30, RDFFormula
rdfsa31, RDFFormula
rdfsa32, RDFFormula
rdfsa33, RDFFormula
rdfsa34
, RDFFormula
rdfsa35, RDFFormula
rdfsa36, RDFFormula
rdfsa37, RDFFormula
rdfsa38, RDFFormula
rdfsa39
, RDFFormula
rdfsa40
]
rdfsr1 :: RDFRule
rdfsr1 :: RDFRule
rdfsr1 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"r1"
Builder
"?x ?a ?b . ?b rdf:_allocatedTo ?l . "
Builder
"?b rdf:type rdfs:Literal ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isUntypedLitV String
"l" )
rdfsr2 :: RDFRule
rdfsr2 :: RDFRule
rdfsr2 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r2"
Builder
"?x ?a ?y . ?a rdfs:domain ?z ."
Builder
"?x rdf:type ?z ."
rdfsr3 :: RDFRule
rdfsr3 :: RDFRule
rdfsr3 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"r3"
Builder
"?u ?a ?v . ?a rdfs:range ?z ."
Builder
"?v rdf:type ?z ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ [RDFVarBindingFilter] -> RDFVarBindingFilter
requireAny [String -> RDFVarBindingFilter
isUriRefV String
"v",String -> RDFVarBindingFilter
isBlankV String
"v"])
rdfsr4a :: RDFRule
rdfsr4a :: RDFRule
rdfsr4a = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r4a"
Builder
"?x ?a ?y ."
Builder
"?x rdf:type rdfs:Resource ."
rdfsr4b :: RDFRule
rdfsr4b :: RDFRule
rdfsr4b = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"r4b"
Builder
"?x ?a ?u ."
Builder
"?u rdf:type rdfs:Resource ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ [RDFVarBindingFilter] -> RDFVarBindingFilter
requireAny [String -> RDFVarBindingFilter
isUriRefV String
"u",String -> RDFVarBindingFilter
isBlankV String
"u"])
rdfsr5 :: RDFRule
rdfsr5 :: RDFRule
rdfsr5 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r5"
Builder
"?a rdfs:subPropertyOf ?b . ?b rdfs:subPropertyOf ?c ."
Builder
"?a rdfs:subPropertyOf ?c ."
rdfsr6 :: RDFRule
rdfsr6 :: RDFRule
rdfsr6 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r6"
Builder
"?x rdf:type rdf:Property ."
Builder
"?x rdfs:subPropertyOf ?x ."
rdfsr7 :: RDFRule
rdfsr7 :: RDFRule
rdfsr7 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r7"
Builder
"?x ?a ?y . ?a rdfs:subPropertyOf ?b ."
Builder
"?x ?b ?y ."
rdfsr8 :: RDFRule
rdfsr8 :: RDFRule
rdfsr8 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r8"
Builder
"?x rdf:type rdfs:Class ."
Builder
"?x rdfs:subClassOf rdfs:Resource ."
rdfsr9 :: RDFRule
rdfsr9 :: RDFRule
rdfsr9 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r9"
Builder
"?x rdfs:subClassOf ?y . ?a rdf:type ?x ."
Builder
"?a rdf:type ?y ."
rdfsr10 :: RDFRule
rdfsr10 :: RDFRule
rdfsr10 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r10"
Builder
"?x rdf:type rdfs:Class ."
Builder
"?x rdfs:subClassOf ?x ."
rdfsr11 :: RDFRule
rdfsr11 :: RDFRule
rdfsr11 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r11"
Builder
"?x rdfs:subClassOf ?y . ?y rdfs:subClassOf ?z ."
Builder
"?x rdfs:subClassOf ?z ."
rdfsr12 :: RDFRule
rdfsr12 :: RDFRule
rdfsr12 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r12"
Builder
"?x rdf:type rdfs:ContainerMembershipProperty ."
Builder
"?x rdfs:subPropertyOf rdfs:member ."
rdfsr13 :: RDFRule
rdfsr13 :: RDFRule
rdfsr13 = Namespace -> LName -> Builder -> Builder -> RDFRule
makeN3ClosureSimpleRule Namespace
scopeRDFS LName
"r13"
Builder
"?x rdf:type rdfs:Datatype ."
Builder
"?x rdfs:subClassOf rdfs:Literal ."
rdfscp11 :: RDFRule
rdfscp11 :: RDFRule
rdfscp11 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp11"
Builder
"?x ?c ?y . "
Builder
"?c rdf:type rdfs:ContainerMembershipProperty ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp12 :: RDFRule
rdfscp12 :: RDFRule
rdfscp12 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp12"
Builder
"?c ?p ?y . "
Builder
"?c rdf:type rdfs:ContainerMembershipProperty ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp13 :: RDFRule
rdfscp13 :: RDFRule
rdfscp13 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp13"
Builder
"?x ?p ?c . "
Builder
"?c rdf:type rdfs:ContainerMembershipProperty ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp21 :: RDFRule
rdfscp21 :: RDFRule
rdfscp21 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp21"
Builder
"?x ?c ?y . "
Builder
"?c rdfs:domain rdfs:Resource ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp22 :: RDFRule
rdfscp22 :: RDFRule
rdfscp22 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp22"
Builder
"?c ?p ?y . "
Builder
"?c rdfs:domain rdfs:Resource ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp23 :: RDFRule
rdfscp23 :: RDFRule
rdfscp23 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp23"
Builder
"?x ?p ?c . "
Builder
"?c rdfs:domain rdfs:Resource ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp31 :: RDFRule
rdfscp31 :: RDFRule
rdfscp31 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp31"
Builder
"?x ?c ?y . "
Builder
"?c rdfs:range rdfs:Resource ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp32 :: RDFRule
rdfscp32 :: RDFRule
rdfscp32 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp32"
Builder
"?c ?p ?y . "
Builder
"?c rdfs:range rdfs:Resource ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rdfscp33 :: RDFRule
rdfscp33 :: RDFRule
rdfscp33 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFS LName
"cp33"
Builder
"?x ?p ?c . "
Builder
"?c rdfs:range rdfs:Resource ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> RDFVarBindingFilter
isMemberPropV String
"c")
rulesRDFS :: [RDFRule]
rulesRDFS :: [RDFRule]
rulesRDFS =
[ RDFRule
rdfsr1, RDFRule
rdfsr2, RDFRule
rdfsr3, RDFRule
rdfsr4a, RDFRule
rdfsr4b
, RDFRule
rdfsr5, RDFRule
rdfsr6, RDFRule
rdfsr7, RDFRule
rdfsr8, RDFRule
rdfsr9
, RDFRule
rdfsr10, RDFRule
rdfsr11, RDFRule
rdfsr12, RDFRule
rdfsr13
, RDFRule
rdfscp11, RDFRule
rdfscp12, RDFRule
rdfscp13
, RDFRule
rdfscp21, RDFRule
rdfscp22, RDFRule
rdfscp23
, RDFRule
rdfscp31, RDFRule
rdfscp32, RDFRule
rdfscp33
]
rulesetRDFS :: RDFRuleset
rulesetRDFS :: RDFRuleset
rulesetRDFS = forall ex. Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex
makeRuleset Namespace
scopeRDFS [RDFFormula]
axiomsRDFS [RDFRule]
rulesRDFS
axiomsRDFD :: [RDFFormula]
axiomsRDFD :: [RDFFormula]
axiomsRDFD =
[
]
rdfdr1 :: RDFRule
rdfdr1 :: RDFRule
rdfdr1 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFD LName
"r1"
Builder
"?d rdf:type rdfs:Datatype . ?a ?p ?l . ?b rdf:_allocatedTo ?l . "
Builder
"?b rdf:type ?d ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> String -> RDFVarBindingFilter
isDatatypedV String
"d" String
"l")
rdfdr2 :: RDFRule
rdfdr2 :: RDFRule
rdfdr2 = Namespace
-> LName -> Builder -> Builder -> RDFVarBindingModify -> RDFRule
makeN3ClosureRule Namespace
scopeRDFD LName
"r2"
Builder
"?d rdf:type rdfs:Datatype . ?a ?p ?s ."
Builder
"?a ?p ?t ."
(String -> String -> String -> String -> RDFVarBindingModify
valueSame String
"s" String
"d" String
"t" String
"d")
rdfdr3 :: RDFRule
rdfdr3 :: RDFRule
rdfdr3 = Namespace
-> LName
-> Builder
-> Builder
-> RDFVarBindingModify
-> RDFVarBindingModify
-> RDFRule
makeN3ClosureModifyRule Namespace
scopeRDFD LName
"r3"
( Builder
"?d rdf:type rdfs:Datatype . ?e rdf:type rdfs:Datatype . " forall a. Monoid a => a -> a -> a
`mappend`
Builder
"?a ?p ?s ." )
Builder
"?a ?p ?t ."
(forall a b. VarBindingFilter a b -> VarBindingModify a b
makeVarFilterModify forall a b. (a -> b) -> a -> b
$ String -> String -> RDFVarBindingFilter
isDatatypedV String
"s" String
"d")
(String -> String -> String -> String -> RDFVarBindingModify
valueSame String
"s" String
"d" String
"t" String
"e")
rulesRDFD :: [RDFRule]
rulesRDFD :: [RDFRule]
rulesRDFD =
[ RDFRule
rdfdr1, RDFRule
rdfdr2, RDFRule
rdfdr3
]
rulesetRDFD :: RDFRuleset
rulesetRDFD :: RDFRuleset
rulesetRDFD = forall ex. Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex
makeRuleset Namespace
scopeRDFD [RDFFormula]
axiomsRDFD [RDFRule]
rulesRDFD