etc.rdfs-fb-tgc.rules Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jena Show documentation
Show all versions of jena Show documentation
Jena is a Java framework for building Semantic Web applications. It provides a programmatic environment for RDF, RDFS and OWL, SPARQL and includes a rule-based inference engine.
#------------------------------------------------------------------
# RDFS rule set v0.1.
# This variant is used in the case where the subclass and subproperty
# lattices have been precomputed by a transitive graph closure cache.
# $Id: rdfs-fb-tgc.rules,v 1.10 2006/11/16 14:23:31 der Exp $
#------------------------------------------------------------------
#------------------------------------------------------------------
# Tabling directives
#------------------------------------------------------------------
-> tableAll().
#------------------------------------------------------------------
# RDFS Axioms
#------------------------------------------------------------------
-> (rdf:type rdfs:range rdfs:Class).
-> (rdfs:Resource rdf:type rdfs:Class).
-> (rdfs:Literal rdf:type rdfs:Class).
-> (rdf:Statement rdf:type rdfs:Class).
-> (rdf:nil rdf:type rdf:List).
-> (rdf:subject rdf:type rdf:Property).
-> (rdf:object rdf:type rdf:Property).
-> (rdf:predicate rdf:type rdf:Property).
-> (rdf:first rdf:type rdf:Property).
-> (rdf:rest rdf:type rdf:Property).
-> (rdf:value rdf:type rdf:Property).
-> (rdfs:member rdf:type rdf:Property).
-> (rdfs:subPropertyOf rdfs:domain rdf:Property).
-> (rdfs:subClassOf rdfs:domain rdfs:Class).
-> (rdfs:domain rdfs:domain rdf:Property).
-> (rdfs:range rdfs:domain rdf:Property).
-> (rdf:type rdfs:domain rdfs:Resource).
-> (rdfs:comment rdfs:domain rdfs:Resource).
-> (rdfs:label rdfs:domain rdfs:Resource).
-> (rdf:subject rdfs:domain rdf:Statement).
-> (rdf:predicate rdfs:domain rdf:Statement).
-> (rdf:object rdfs:domain rdf:Statement).
-> (rdf:first rdfs:domain rdf:List).
-> (rdf:rest rdfs:domain rdf:List).
-> (rdfs:subPropertyOf rdfs:range rdf:Property).
-> (rdfs:subClassOf rdfs:range rdfs:Class).
-> (rdfs:domain rdfs:range rdfs:Class).
-> (rdfs:range rdfs:range rdfs:Class).
-> (rdf:type rdfs:range rdfs:Class).
-> (rdfs:comment rdfs:range rdfs:Literal).
-> (rdfs:label rdfs:range rdfs:Literal).
-> (rdf:subject rdfs:range rdfs:Resource).
-> (rdf:predicate rdfs:range rdf:Property).
-> (rdf:object rdfs:range rdfs:Resource).
-> (rdf:first rdfs:range rdfs:Resource).
-> (rdf:rest rdfs:range rdf:List).
-> (rdf:Alt rdfs:subClassOf rdfs:Container).
-> (rdf:Bag rdfs:subClassOf rdfs:Container).
-> (rdf:Seq rdfs:subClassOf rdfs:Container).
-> (rdfs:ContainerMembershipProperty rdfs:subClassOf rdf:Property).
-> (rdfs:isDefinedBy rdfs:subPropertyOf rdfs:seeAlso).
-> (rdf:XMLLiteral rdf:type rdfs:Datatype).
-> (rdfs:Datatype rdfs:subClassOf rdfs:Class).
#------------------------------------------------------------------
# RDFS Closure rules
#------------------------------------------------------------------
# This one could be omitted since the results are not really very interesting!
[rdf1and4: (?x ?p ?y) -> (?p rdf:type rdf:Property), (?x rdf:type rdfs:Resource), (?y rdf:type rdfs:Resource)]
[rdfs7b: (?a rdf:type rdfs:Class) -> (?a rdfs:subClassOf rdfs:Resource)]
[rdfs2: (?p rdfs:domain ?c) -> [(?x rdf:type ?c) <- (?x ?p ?y)] ]
[rdfs3: (?p rdfs:range ?c) -> [(?y rdf:type ?c) <- (?x ?p ?y)] ]
[rdfs5b: (?a rdf:type rdf:Property) -> (?a rdfs:subPropertyOf ?a)]
[rdfs6: (?p rdfs:subPropertyOf ?q), notEqual(?p,?q) -> [ (?a ?q ?b) <- (?a ?p ?b)] ]
[rdfs7: (?a rdf:type rdfs:Class) -> (?a rdfs:subClassOf ?a)]
[rdfs10: (?x rdf:type rdfs:ContainerMembershipProperty) -> (?x rdfs:subPropertyOf rdfs:member)]
[rdfs2-partial: (?p rdfs:domain ?c) -> (?c rdf:type rdfs:Class)]
[rdfs3-partial: (?p rdfs:range ?c) -> (?c rdf:type rdfs:Class)]
# Either version should work, pure back one scales better.
# rdfs9: (?x rdfs:subClassOf ?y) -> [ (?a rdf:type ?y) <- (?a rdf:type ?x)] ]
[rdfs9-alt: (?a rdf:type ?y) <- (?x rdfs:subClassOf ?y), (?a rdf:type ?x) ]
# Not needed - replaced by TGC front end
#[rdfs8: (?a rdfs:subClassOf ?b), (?b rdfs:subClassOf ?c) -> (?a rdfs:subClassOf ?c)]
#[rdfs5a: (?a rdfs:subPropertyOf ?b), (?b rdfs:subPropertyOf ?c) -> (?a rdfs:subPropertyOf ?c)]
#------------------------------------------------------------------
# Declaration of main XSD datatypes
#------------------------------------------------------------------
-> (xsd:float rdf:type rdfs:Datatype).
-> (xsd:double rdf:type rdfs:Datatype).
-> (xsd:int rdf:type rdfs:Datatype).
-> (xsd:long rdf:type rdfs:Datatype).
-> (xsd:short rdf:type rdfs:Datatype).
-> (xsd:byte rdf:type rdfs:Datatype).
-> (xsd:unsignedByte rdf:type rdfs:Datatype).
-> (xsd:unsignedShort rdf:type rdfs:Datatype).
-> (xsd:unsignedInt rdf:type rdfs:Datatype).
-> (xsd:unsignedLong rdf:type rdfs:Datatype).
-> (xsd:decimal rdf:type rdfs:Datatype).
-> (xsd:integer rdf:type rdfs:Datatype).
-> (xsd:nonPositiveInteger rdf:type rdfs:Datatype).
-> (xsd:nonNegativeInteger rdf:type rdfs:Datatype).
-> (xsd:positiveInteger rdf:type rdfs:Datatype).
-> (xsd:negativeInteger rdf:type rdfs:Datatype).
-> (xsd:boolean rdf:type rdfs:Datatype).
-> (xsd:string rdf:type rdfs:Datatype).
-> (xsd:anyURI rdf:type rdfs:Datatype).
-> (xsd:hexBinary rdf:type rdfs:Datatype).
-> (xsd:base64Binary rdf:type rdfs:Datatype).
-> (xsd:date rdf:type rdfs:Datatype).
-> (xsd:time rdf:type rdfs:Datatype).
-> (xsd:dateTime rdf:type rdfs:Datatype).
-> (xsd:duration rdf:type rdfs:Datatype).
-> (xsd:gDay rdf:type rdfs:Datatype).
-> (xsd:gMonth rdf:type rdfs:Datatype).
-> (xsd:gYear rdf:type rdfs:Datatype).
-> (xsd:gYearMonth rdf:type rdfs:Datatype).
-> (xsd:gMonthDay rdf:type rdfs:Datatype).
#-> (xsd:integer rdfs:subClassOf xsd:decimal).
-> hide(rb:xsdBase).
-> hide(rb:xsdRange).
-> hide(rb:prototype).
-> (xsd:byte rb:xsdBase xsd:decimal).
-> (xsd:short rb:xsdBase xsd:decimal).
-> (xsd:int rb:xsdBase xsd:decimal).
-> (xsd:long rb:xsdBase xsd:decimal).
-> (xsd:unsignedByte rb:xsdBase xsd:decimal).
-> (xsd:unsignedShort rb:xsdBase xsd:decimal).
-> (xsd:unsignedInt rb:xsdBase xsd:decimal).
-> (xsd:unsignedLong rb:xsdBase xsd:decimal).
-> (xsd:integer rb:xsdBase xsd:decimal).
-> (xsd:nonNegativeInteger rb:xsdBase xsd:decimal).
-> (xsd:nonPositiveInteger rb:xsdBase xsd:decimal).
-> (xsd:byte rb:xsdBase xsd:decimal).
-> (xsd:float rb:xsdBase xsd:float).
-> (xsd:decimal rb:xsdBase xsd:decimal).
-> (xsd:string rb:xsdBase xsd:string).
-> (xsd:boolean rb:xsdBase xsd:boolean).
-> (xsd:date rb:xsdBase xsd:date).
-> (xsd:time rb:xsdBase xsd:time).
-> (xsd:dateTime rb:xsdBase xsd:dateTime).
-> (xsd:duration rb:xsdBase xsd:duration).
# Describe range (base type, signed, min bits)
-> (xsd:byte rb:xsdRange xsd(xsd:integer,1,8)).
-> (xsd:short rb:xsdRange xsd(xsd:integer,1,16)).
-> (xsd:int rb:xsdRange xsd(xsd:integer,1,32)).
-> (xsd:long rb:xsdRange xsd(xsd:integer,1,64)).
-> (xsd:integer rb:xsdRange xsd(xsd:integer,1,65)).
-> (xsd:unsignedByte rb:xsdRange xsd(xsd:integer,0,8)).
-> (xsd:unsignedShort rb:xsdRange xsd(xsd:integer,0,16)).
-> (xsd:unsignedInt rb:xsdRange xsd(xsd:integer,0,32)).
-> (xsd:unsignedLong rb:xsdRange xsd(xsd:integer,0,64)).
-> (xsd:nonNegativeInteger rb:xsdRange xsd(xsd:integer,0,65)).
# Some XSD support may be disabled temporarily during performance checking
#[xsd1: (?X rdfs:subClassOf ?Y) <-
# (?X rb:xsdRange xsd(?B, 0, ?L)) (?Y rb:xsdRange xsd(?B, ?S, ?L2)) le(?L, ?L2)]
#[xsd2: (?X rdfs:subClassOf ?Y) <-
# (?X rb:xsdRange xsd(?B, 1, ?L)) (?Y rb:xsdRange xsd(?B, 1, ?L2)) le(?L, ?L2)]
#[range1: (?P rdfs:range ?C) <-
# (?P rdfs:range ?D), (?D rb:xsdRange xsd(?B, ?S1, ?L1)),
# (?P rdfs:range ?E), notEqual(?D, ?E),
# (?E rb:xsdRange xsd(?B, ?S2, ?L2)),
# min(?S1, ?S2, ?S3),
# min(?L1, ?L2, ?L3),
# (?C rb:xsdRange xsd(?B, ?S3, ?L3)),
# ]
#------------------------------------------------------------------
# Validation rules. These are dormant by default but are triggered
# by the additional of a validation control triple to the graph.
#------------------------------------------------------------------
[validationDisjoint: (?v rb:validation on()) ->
[validationIndiv: (?X rb:violation error('disjoint', 'Subclass relationship asserted between disjoint datatypes', ?Y))
<- (?C rdfs:subClassOf ?D) notEqual(?C, ?D),
(?C rb:xsdBase ?BC), (?D rb:xsdBase ?BD), notEqual(?BC, ?BD) ] ]
# Hardwired anyway
#[validationDTRange: (?v rb:validation on()), (?P rdfs:range ?R) (?R rdf:type rdfs:Datatype)
# [validationDTRange: (?X rb:violation error('range check', 'Incorrectly typed literal due to range (prop, value)', ?P, ?V))
# <- (?X ?P ?V), notDType(?V, ?R) ] ]
[validationDTRange: (?v rb:validation on()), (?P rdfs:range rdfs:Literal) ->
[validationDTRange: (?X rb:violation error('range check', 'Incorrectly typed literal due to range rdsf:Literal (prop, value)', ?P, ?V))
<- (?X ?P ?V), notLiteral(?V), notBNode(?V) ] ]
© 2015 - 2025 Weber Informatics LLC | Privacy Policy