rdf-mt/commit

Include data type inheritance

authorJan Wielemaker
Tue Dec 17 14:44:03 2013 +0100
committerJan Wielemaker
Tue Dec 17 14:44:03 2013 +0100
commit0ea24a0c43e97fc09c702a8779d73ed52536ea64
tree741a26986db8be8c05fa98ed6685209cf2084008
parent9634f7da79d11c9487ff889a2fc7d7f812c26de9
Diff style: patch stat
diff --git a/lib/rdf_mt/graph_consistency.pl b/lib/rdf_mt/graph_consistency.pl
index 1204814..bb134e0 100644
--- a/lib/rdf_mt/graph_consistency.pl
+++ b/lib/rdf_mt/graph_consistency.pl
@@ -30,7 +30,9 @@
 	[ consistent_graph/2,		% +GraphName, +Props
 	  graph_value_space/3,		% +Graph, -ValueSpaceGraph, +Props
 	  literal_value/3,		% +Literal, -Canonical, +Props
-	  literal_value/2		% +Literal, -Canonical
+	  literal_value/2,		% +Literal, -Canonical
+	  xsd_datatype/1,		% ?URI
+	  xsd_subtype_of/2		% ?Sub, ?Super
 	]).
 :- use_module(library(apply)).
 :- use_module(library(xsdp_types)).
diff --git a/lib/rdf_mt/mt_rdfs.pl b/lib/rdf_mt/mt_rdfs.pl
index dfe703f..3997829 100644
--- a/lib/rdf_mt/mt_rdfs.pl
+++ b/lib/rdf_mt/mt_rdfs.pl
@@ -31,6 +31,7 @@
 :- module(mt_rdfs, []).
 :- use_module(library(semweb/rdf_db)).
 :- use_module(library(xmlrdf/rdf_rewrite)).
+:- use_module(graph_consistency).
 
 :- multifile rdf_reasoner:entailment_module/2.
 rdf_reasoner:entailment_module(rdfs, mt_rdfs).
@@ -49,6 +50,12 @@ literal_type(type(Type, _), Type) :- !.
 literal_type(lang(_, _),    rdf:langString) :- !.
 literal_type(_Plain,        xsd:string).
 
+rdfs_xsd @@
+{ S, rdf:type, Type }
+	==>
+	xsd_subtype_of(Type, Super),
+	{ S, rdf:type, Super }.
+
 rdfs1 @@
 { S, P, L } ==>
 	L = literal(LV),
@@ -58,7 +65,8 @@ rdfs1 @@
 	literal_type(LV, Type),
 	rdf_bnode(BN),
 	{ S, P, BN },
-	{ BN, rdf:type, Type }.
+	{ BN, rdf:type, Type },
+	{ BN, rdf:type, rdfs:'Literal' }.
 
 rdfs2 @@
 { A, rdfs:domain, X },