### Logic Framework Extension -- Jos De Roo
### importing http://www.w3.org/2000/10/swap/log

@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix prolog: <http://eulersharp.sourceforge.net/2003/03swap/prolog#>.
@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.

<> owl:imports <http://www.w3.org/2000/10/swap/log>.

### classes
e:Builtin a rdfs:Class;
	rdfs:comment "class of EYE built-ins".

e:Component a rdfs:Class;
	rdfs:comment "class of EYE components".

e:Fact a rdfs:Class;
	rdfs:comment "class of facts".

e:Lemma a rdfs:Class;
	rdfs:comment "class of lemmas".

e:Numeral a rdfs:Class;
	rdfs:comment "class of things that are numerals";
	rdfs:subClassOf rdfs:Literal.

e:Scope a rdfs:Class;
	rdfs:comment "class of (context span) pairs where a context is a list of consulted URI's and a span is the deductive closure number";
	rdfs:subClassOf rdf:List.

e:T0 a owl:DeprecatedClass;
	rdfs:comment "class of things that are time reference points".


### constants
e:epsilon a e:Numeral;
	rdfs:comment "the difference between the float 1.0 and the first larger floating point number".

e:F a rdfs:Resource;
	rdfs:comment "identifier for boolean false".

e:T a rdfs:Resource;
	rdfs:comment "identifier for boolean true".


### properties
e:allAncestors a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "built-in to collect all ancestor triples of subject";
	rdfs:domain log:Formula;
	rdfs:range log:Formula.

e:allAssertedAncestors a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "built-in to collect all ancestor asserted triples of subject";
	rdfs:domain log:Formula;
	rdfs:range log:Formula.

e:allDescendents a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "built-in to collect all descendent triples of subject";
	rdfs:domain log:Formula;
	rdfs:range log:Formula.

e:allModels a owl:DeprecatedProperty;
	rdfs:comment "object is the number of possible, counter and false models";
	rdfs:domain rdfs:Resource;
	rdfs:range xsd:integer.

e:ancestor a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:ancestorModel a owl:DeprecatedProperty;
	rdfs:comment "object is a ancestor model";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:ancestors a owl:DeprecatedProperty;
	rdfs:comment "used in e:ancestorModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:answer a owl:DeprecatedProperty;
	rdfs:comment "used to descibe an answer as a graph";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:applicability a owl:DeprecatedProperty;
	rdfs:comment "a property to express the ratio possibleModels/(possibleModels+counterModels+falseModels)";
	rdfs:domain rdfs:Resource;
	rdfs:range e:Numeral.

e:assertedAncestors a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:assertedTriple a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "built-in to succeed when subject is an asserted triple";
	rdfs:domain log:Formula;
	rdfs:range log:Formula.

e:bayesRule a owl:DeprecatedProperty;
	rdfs:comment "Bayes Rule justification";
	rdfs:domain rdfs:Resource;
	rdfs:range rdf:List.

e:because a owl:DeprecatedProperty;
	rdfs:comment "proof of formula";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Resource.

e:biconditional a rdf:Property, e:Builtin;
	rdfs:comment "built-in and object is conditional belief of first element of subject list given rest of subject list";
	rdfs:domain rdf:List;
	rdfs:range e:Numeral.

e:binaryEntropy a rdf:Property, e:Builtin;
	rdfs:comment "built-in to calculate binary entropy e.g. 0.25 e:binaryEntropy 0.8112781244591328";
	rdfs:domain e:Numeral;
	rdfs:range e:Numeral.

e:boolean a rdf:Property;
	rdfs:comment "to model a logical proposition";
	rdfs:domain rdfs:Resource;
	rdfs:range [ owl:oneOf (e:F e:T)].

e:calculate a rdf:Property, e:Builtin;
	rdfs:comment """built-in to evaluate arithmetic expressions e.g.
				("1+1") e:calculate 2 .
				?X log:equalTo 3. ("sqrt(_width^2+_length^2)" ?X 4) e:calculate 5.0 .
				("_period-250" "PT5M2S"^^xsd:dayTimeDuration) e:calculate 52.0 .
			the first element of the subject list is the arithmetic expression in which variable names start with an underscore and the rest of the subject list are the variable values
			the supported arithmetic functions are described in http://www.swi-prolog.org/pldoc/man?section=functions""";
	rdfs:domain rdf:List;
	rdfs:range e:Numeral.

e:call a rdf:Property, e:Builtin;
	rdfs:comment "built-in to call the object formula within the subject scope and to succeed when the call succeeds";
	rdfs:domain e:Scope;
	rdfs:range log:Formula.

e:cartesianProduct a rdf:Property, e:Builtin;
	rdfs:comment "built-in (L1 L2 ... Ln) e:cartesianProduct L, where L is the n-ary cartesian product of the sets L1, L2, ...., Ln";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:clashesWith a rdf:Property;
	rdfs:comment "to say that the graph is XSD-inconsistent or has a datatype clash";
	rdfs:domain rdfs:Literal;
	rdfs:range rdfs:Datatype.

e:closure a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "built-in to test the deductive closure within the subject scope";
	rdfs:domain e:Scope;
	rdfs:range log:Formula.

e:closureInconsistentTriplesOrdering a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:columns a rdf:Property;
	rdfs:comment "to list the webized relational database collumns";
	rdfs:domain rdfs:Class;
	rdfs:range rdf:List.

e:conditional a rdf:Property;
	rdfs:comment "object is conditional belief of first element of subject list given rest of subject list";
	rdfs:domain rdf:List;
	rdfs:range e:Numeral.

e:construct a owl:DeprecatedProperty;
	rdfs:comment "connecting a resource to a formula";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:consistentGives a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:counterModel a owl:DeprecatedProperty;
	rdfs:comment "object is a counter model";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:counterModels a owl:DeprecatedProperty;
	rdfs:comment "object is the number of counter models";
	rdfs:domain rdfs:Resource;
	rdfs:range xsd:integer.

e:csvTuple a rdf:Property, e:Builtin;
	rdfs:comment "to generate CSV output with --strings; columns ending with ID are outputted as Modified Base64 for XML identifiers encoded SHA-1 hash";
	rdfs:domain rdfs:Resource;
	rdfs:range rdf:List.

e:delta a owl:DeprecatedProperty;
	rdfs:comment "used in proof output to explain belief differences";
	rdfs:domain rdf:List;
	rdfs:range e:Numeral.

e:distinct a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "deprecated and use RIF DTB func:distinct-values instead";
	rdfs:comment "built-in to remove duplicate list items";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:evidence a owl:DeprecatedProperty;
	rdfs:comment "to say that subject has an evident relationship with object either as fact or as conclusion of rule";
	rdfs:domain log:Formula;
	rdfs:range rdfs:Resource.

e:evidentiality a owl:DeprecatedProperty;
	rdfs:comment "a property to express the ratio (possibleModels+counterModels)/(possibleModels+counterModels+falseModels)";
	rdfs:domain rdfs:Resource;
	rdfs:range e:Numeral.

e:fail a rdf:Property, e:Builtin;
	rdfs:comment "built-in to call the object formula within the subject scope and to succeed when the call fails";
	rdfs:domain e:Scope;
	rdfs:range log:Formula.

e:falseAncestors a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:falseDescendents a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:falseModel a owl:DeprecatedProperty;
	rdfs:comment "object is a false model";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:falseModels a owl:DeprecatedProperty;
	rdfs:comment "object is the number of false models";
	rdfs:domain rdfs:Resource;
	rdfs:range xsd:integer.

e:finalize a rdf:Property, e:Builtin;
	rdfs:comment "built-in to call object formula exactly once after subject formula is finished: either on failure, deterministic success, commit, or an exception";
	rdfs:domain log:Formula;
	rdfs:range log:Formula.

e:findall a rdf:Property, e:Builtin;
	rdfs:comment """built-in used as ?SCOPE e:findall (?SELECT ?WHERE ?ANSWER).
			within the subject ?SCOPE it unifies ?ANSWER with a list that contains all the instantiations of ?SELECT satisfying the ?WHERE clause""";
	rdfs:domain e:Scope;
	rdfs:range rdf:List.

e:format a rdf:Property, e:Builtin;
	rdfs:comment """built-in with the subject a list, whose first member is a format string, and whose remaining members are
			arguments to the format string. The format string is the one used in prolog's format predicate.
			The object is calculated from the subject""";
	rdfs:domain rdf:List;
	rdfs:range rdfs:Literal.

e:weight a rdf:Property;
	rdfs:comment "used to express the weight in MLN (Markov Logic Network) inspired descriptions";
	rdfs:domain rdf:List;
	rdfs:range e:Numeral.

e:gives a owl:DeprecatedProperty;
	rdfs:comment "used in e:possibleModel and in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:graphCopy a rdf:Property, e:Builtin;
	rdfs:comment "built-in to make a bounded copy of the subject graph e.g. {:a :b :c. :d :e :f} e:graphCopy ?GRAPH";
	rdfs:domain log:Formula;
	rdfs:range log:Formula.

e:graphDifference a rdf:Property, e:Builtin;
	rdfs:comment "built-in used for graph difference e.g. ({:a :b :c. :d :e :f} {:d :e :f}) e:graphDifference {:a :b :c}";
	rdfs:domain rdf:List;
	rdfs:range log:Formula.

e:graphIntersection a rdf:Property, e:Builtin;
	rdfs:comment "built-in used for graph intersection e.g. ({:a :b :c. :d :e :f} {:d :e :f}) e:graphIntersection {:d :e :f}";
	rdfs:domain rdf:List;
	rdfs:range log:Formula.

e:graphList a rdf:Property, e:Builtin;
	rdfs:comment "built-in used for graph/list transformation e.g. {:a :b :c. :d :e :f} e:graphList ({:a :b :c} {:d :e :f})";
	rdfs:domain log:Formula;
	rdfs:range rdf:List.

e:hmac-sha a rdf:Property, e:Builtin;
	rdfs:comment "built-in function where the object is a Modified Base64 for XML identifiers encoded HMAC SHA-1 hash of the subject";
	rdfs:domain rdfs:Literal;
	rdfs:range rdfs:Literal.

e:ignore a rdf:Property, e:Builtin;
	rdfs:comment "built-in to call the object formula within the subject scope and to succeed anyway but only once";
	rdfs:domain e:Scope;
	rdfs:range log:Formula.

e:inconsistentTriplesOrdering a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:inductivity a rdf:Property;
	rdfs:comment "a property to express the ratio possibleModels/(possibleModels+counterModels)";
	rdfs:domain rdfs:Resource;
	rdfs:range e:Numeral.

e:inferredDescendents a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:integrityConstraint a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:label a rdf:Property, e:Builtin;
	rdfs:comment "built-in to test wether the subject is a blank node or a Skolem IRI and return the relabeled blank node label or the Skolem IRI fragment as object (this is a level breaker)";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Literal.

e:labelvars a rdf:Property, e:Builtin;
	rdfs:comment "built-in to make a bounded copy of the subject";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Resource.

e:length a rdf:Property, e:Builtin;
	rdfs:comment "built-in that calculates the length of the subject list";
	rdfs:domain rdf:List;
	rdfs:range xsd:integer.

e:match a rdf:Property, e:Builtin;
	rdfs:comment "built-in to succeed when the object formula succeeds and to forget the bindings";
	rdfs:domain rdf:Resource;
	rdfs:range log:Formula.

e:max a rdf:Property, e:Builtin;
	rdfs:comment "built-in to maximum of the subject list";
	rdfs:domain rdf:List;
	rdfs:range rdfs:Resource.

e:min a rdf:Property, e:Builtin;
	rdfs:comment "built-in to minimum of the subject list";
	rdfs:domain rdf:List;
	rdfs:range rdfs:Resource.

e:multisetEqualTo a rdf:Property, e:Builtin;
	rdfs:comment "built-in to succeed when the subject multiset is equal to the object multiset e.g. (1 3 6 6 7 2 3) e:multisetEqualTo (3 3 7 6 6 2 1)";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:multisetNotEqualTo a rdf:Property, e:Builtin;
	rdfs:comment "built-in to succeed when the subject multiset is not equal to the object multiset e.g. (1 3 6 6 7 2 3) e:multisetEqualTo (3 3 7 6 2 1)";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:notLabel a rdf:Property, e:Builtin;
	rdfs:comment "built-in to test wether the subject is not a blank node with label in object (this is a level breaker)";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Literal.

e:numeral a rdf:Property, e:Builtin;
	rdfs:comment """built-in to convert literals to numerals e.g. "2012"^^xsd:long e:numeral 2012""";
	rdfs:domain rdfs:Literal;
	rdfs:range e:Numeral.

e:optional a rdf:Property, e:Builtin;
	rdfs:comment "built-in to call the object formula within the subject scope and to succeed anyway";
	rdfs:domain e:Scope;
	rdfs:range log:Formula.

e:possibility a owl:DeprecatedProperty;
	rdfs:comment "proof possibility";
	rdfs:domain log:Formula;
	rdfs:range e:Numeral.

e:possibleModel a owl:DeprecatedProperty;
	rdfs:comment "object is a possible model";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:possibleModels a owl:DeprecatedProperty;
	rdfs:comment "object is the number of possible models";
	rdfs:domain rdfs:Resource;
	rdfs:range xsd:integer.

e:prefix a rdf:Property, e:Builtin;
	rdfs:comment "built-in to produce an object literal containing all prefixes";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Literal.

e:proof a owl:DeprecatedProperty;
	rdfs:comment "proof formula";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:proofID a owl:DeprecatedProperty;
	rdfs:comment "proof ID";
	rdfs:domain rdfs:Resource;
	rdfs:range xsd:integer.

e:propertyChainExtension a rdf:Property, e:Builtin;
	rdfs:comment "built-in to support owl:propertyChainAxiom inferencing i.e. {?sc owl:propertyChainAxiom ?x; rdfs:subPropertyOf ?p. ?x e:propertyChainExtension (?s ?o)} => {?s ?p ?o}";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:random a rdf:Property, e:Builtin;
	rdfs:comment "object is a random integer i such that 0 =< i < first element of subject list; when the rest of subject list rest is not empty i is reproducible in function of the subject list";
	rdfs:domain rdf:List;
	rdfs:range xsd:integer.

e:reason a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "heavy built-in where the subject is the reasoning process and the object the returned status code";
	rdfs:domain rdfs:Literal;
	rdfs:range xsd:integer.

e:relabel a rdf:Property, e:Builtin;
	rdfs:comment "relabel subject with object in the output of the reasoning run";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Resource.

e:reverse a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "deprecated and use RIF DTB func:reverse instead";
	rdfs:comment "built-in to reverse the subject list";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:roc a rdf:Property, e:Builtin;
	rdfs:comment "built-in to simulate ROC curve e.g. strength e:roc (sensitivity aspecificity)";
	rdfs:domain e:Numeral;
	rdfs:range rdf:List.

e:selected a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation and used in e:ancestorModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Resource.

e:sha a rdf:Property, e:Builtin;
	rdfs:comment "built-in function where the object is a Modified Base64 for XML identifiers encoded SHA-1 hash of the subject";
	rdfs:domain rdfs:Literal;
	rdfs:range rdfs:Literal.

e:sigmoid a rdf:Property, e:Builtin;
	rdfs:comment "built-in to calculate a sigmoid e.g. -6 e:sigmoid 0.0024726231566347743";
	rdfs:domain rdf:List;
	rdfs:range e:Numeral.

e:skolem a rdf:Property, e:Builtin;
	rdfs:comment "built-in to generate a Skolem IRI object which is a function of the arguments in the subject list";
	rdfs:domain rdf:List;
	rdfs:range rdfs:Resource.

e:sort a rdf:Property, e:Builtin;
	rdfs:comment "built-in to sort the subject list";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:source a owl:DeprecatedProperty;
	rdfs:comment "source of formula";
	rdfs:domain log:Formula;
	rdfs:range rdfs:Resource.

e:stringEscape a rdf:Property, e:Builtin;
	rdfs:comment "built-in to escape the subject string";
	rdfs:domain rdfs:Literal;
	rdfs:range rdfs:Literal.

e:stringReverse a rdf:Property, e:Builtin;
	rdfs:comment "built-in to reverse the subject string";
	rdfs:domain rdfs:Literal;
	rdfs:range rdfs:Literal.

e:stringSplit a rdf:Property, e:Builtin;
	rdfs:comment """built-in to split a string into a list of strings according to a string containing separator characters e.g. ("a-b/c-d/e" "-/") e:stringSplit ("a" "b" "c" "d" "e")""";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:sublist a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "deprecated and use e:subsequence instead";
	rdfs:comment "built-in to succeed if all elements of object list appear in subject list in the same order";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:subsequence a rdf:Property, e:Builtin;
	rdfs:comment "built-in to succeed if all elements of object list appear in subject list in the same order";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:tactic a owl:DeprecatedProperty;
	rdfs:comment "predicate to express proof tactics";
	rdfs:domain rdf:List;
	rdfs:range rdf:List.

e:timeWindow a owl:DeprecatedProperty;
	rdfs:comment """day 7 is ("P6D"^^xsd:duration "P1D"^^xsd:duration) and is relative to e:T0""";
	rdfs:domain rdfs:Resource;
	rdfs:range rdf:List.

e:trace a rdf:Property, e:Builtin;
	rdfs:comment "built-in that outputs the object";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Resource.

e:transaction a rdf:Property, e:Builtin;
	rdfs:comment "used to rewrite P => C. as P => {P e:transaction C}. {P e:transaction C} => C";
	rdfs:domain log:Formula;
	rdfs:range log:Formula.

e:tripleList a rdf:Property, e:Builtin;
	rdfs:comment "built-in used for triple/list transformation e.g. {:a :b :c} e:tripleList (:a :b :c)";
	rdfs:domain log:Formula;
	rdfs:range rdf:List.

e:triple a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:triples a owl:DeprecatedProperty;
	rdfs:comment "used in e:falseModel explanation";
	rdfs:domain rdfs:Resource;
	rdfs:range log:Formula.

e:true a owl:DeprecatedProperty, e:Builtin;
	rdfs:comment "built-in to model truth-value t(conclusion|premises)";
	rdfs:domain rdfs:Resource;
	rdfs:range e:Numeral.

e:tuple a rdf:Property, e:Builtin;
	rdfs:comment "built-in to bind the subject to a unique blank node which is a function of the object tuple";
	rdfs:domain rdfs:Resource;
	rdfs:range rdf:List.

e:unique a rdf:Property, e:Builtin;
	rdfs:comment "built-in to succeed when the subject object pair is unique";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Resource.

e:valuation a owl:DeprecatedProperty;
	rdfs:comment "to express (lower upper) valuation of a formula e.g. {:PatientWithNoFlu rdfs:subClassOf :PatientWithFever} e:valuation (0.032 0.048)";
	rdfs:domain log:Formula;
	rdfs:range rdf:List.

e:whenGround a rdf:Property, e:Builtin;
	rdfs:comment "when the subject is RDF ground the object is called, otherwise this built-in succeeds e.g.?value e:whenGround {?value math:greaterThan 40}";
	rdfs:domain rdfs:Resource;
	rdfs:range rdfs:Resource.

e:wwwFormEncode a rdf:Property, e:Builtin;
	rdfs:comment "built-in bidirectional www form encoder";
	rdfs:domain rdfs:Literal;
	rdfs:range rdfs:Literal.