Browse files

Remove owl_parser_log, remove owl/4 used1 predicates

Improve owl_statistics, fix owl/4 initialisation

Signed-off-by: Vangelis Vassiliadis <vangelis@semanticweb.gr>
  • Loading branch information...
1 parent d7b64a5 commit ad3386bf25d96ca7aa177f39f02b81b2f6d97308 Vangelis Vassiliadis committed Mar 31, 2010
Showing with 7,393 additions and 1,925 deletions.
  1. BIN doc/{Thea Meetup.pptx → Thea Slideshare.pptx}
  2. +0 −1 graph.log
  3. +617 −1 graph.xml
  4. +4,237 −1,815 graph_http.log
  5. +69 −75 owl2_from_rdf.pl
  6. +3 −14 owl2_from_rdf_utils.pl
  7. +65 −19 owl2_util.pl
  8. +2,402 −0 testfiles/wine_no_ontology.owl
View
BIN doc/Thea Meetup.pptx → doc/Thea Slideshare.pptx
Binary file not shown.
View
1 graph.log
@@ -1 +0,0 @@
-[element(load_structure_ok, [], [])][protocol(http), peer(ip(127, 0, 0, 1)), pool(client(httpd@8082, owl2_util:graph_http_reply, $stream(28598328), $stream(28596646))), input($stream(28598328)), method(post), path(/), http_version(1-1), host(localhost), port(8082), user_agent(Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)), accept(text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8), accept_language(en-us,en;q=0.5), accept_encoding(gzip,deflate), accept_charset(ISO-8859-1,utf-8;q=0.7,*;q=0.7), keep_alive(115), connection(keep-alive), content_type(application/xml), content_length(8)][element(graph, [], [])][element(graph, [], [])][element(graph, [], [])][element(graph, [], [])][element(graph, [], [])][element(graph, [], [])]
View
618 graph.xml
@@ -1,3 +1,619 @@
<?xml version="1.0" encoding="UTF-8"?>
-<error>no_ontology_found</error>
+<ontology_graph name="http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine">
+ <node type="class" id="vin:'Wine'">
+ <arc type="subClassOf">
+ <node type="class" id="food:'PotableLiquid'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WineGrape'">
+ <arc type="subClassOf">
+ <node type="class" id="food:'Grape'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WineTaste'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'WineDescriptor'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WineColor'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'WineDescriptor'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WineSugar'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'WineTaste'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WineFlavor'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'WineTaste'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WineBody'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'WineTaste'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'SweetRiesling'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'DessertWine'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Sauternes'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'LateHarvest'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Sauternes'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'Bordeaux'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Port'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'RedWine'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'LateHarvest'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'EarlyHarvest'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'DessertWine'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Chianti'">
+ <arc type="subClassOf">
+ <node type="class" id="vin:'ItalianWine'"/>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WineDescriptor'">
+ <arc type="equivalentClass">
+ <node type="unionOf">
+ <arc type="member">
+ <node type="class" id="vin:'WineTaste'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'WineColor'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WhiteWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WhiteTableWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'TableWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WhiteNonSweetWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'WhiteWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WhiteLoire'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Loire'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'WhiteWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WhiteBurgundy'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Burgundy'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'WhiteWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'WhiteBordeaux'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Bordeaux'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'WhiteWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Zinfandel'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Tours'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Loire'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'TableWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'SweetWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'SweetRiesling'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Riesling'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'StEmilion'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Bordeaux'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'SemillonOrSauvignonBlanc'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Semillon'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'SemillonOrSauvignonBlanc'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'SauvignonBlanc'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'SemillonOrSauvignonBlanc'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Sancerre'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Loire'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'RoseWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Riesling'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'RedWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'RedTableWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'TableWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'RedBurgundy'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Burgundy'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'RedWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'RedBordeaux'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Bordeaux'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'RedWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'PinotNoir'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'PinotBlanc'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'PetiteSyrah'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Pauillac'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Medoc'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Muscadet'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Loire'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Meursault'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'WhiteBurgundy'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Merlot'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Meritage'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Medoc'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Bordeaux'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Margaux'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Medoc'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Loire'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'ItalianWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'IceWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'LateHarvest'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'DessertWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'GermanWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Gamay'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'FullBodiedWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'FrenchWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'DryWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'DryWhiteWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'DryWine'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'WhiteWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'DryRiesling'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Riesling'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'DryRedWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'DryWine'"/>
+ </arc>
+ <arc type="member">
+ <node type="class" id="vin:'RedWine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'CotesDOr'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'RedBurgundy'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'CheninBlanc'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Chardonnay'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'CaliforniaWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'TexasWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'CabernetSauvignon'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'CabernetFranc'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Burgundy'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Bordeaux'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Beaujolais'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'Anjou'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Loire'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'AmericanWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+ <node type="class" id="vin:'AlsatianWine'">
+ <arc type="equivalentClass">
+ <node type="intersectionOf">
+ <arc type="member">
+ <node type="class" id="vin:'Wine'"/>
+ </arc>
+ </node>
+ </arc>
+ </node>
+</ontology_graph>
View
6,052 graph_http.log
4,237 additions, 1,815 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
144 owl2_from_rdf.pl
@@ -46,8 +46,8 @@
uri_split/4,
owl_description/2,
- blanknode/3,
- owl_parser_log/2
+ blanknode/3
+ % owl_parser_log/2 -- deprecated, use debug instead.
]).
/** <module> Translates an RDF database to OWL2 axioms
@@ -79,7 +79,6 @@
% Description - prolog term corresponding to owl Description
% Used - used | shared
:- dynamic(blanknode/3).
-:- dynamic(owl_parser_log/2).
:- dynamic(outstream/1).
% VV 10/3/2010 multifile from owl2_model
% :- dynamic(annotation/3). % implements the ANN(X) function.
@@ -141,20 +140,15 @@
% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/
owl_parse(URL, RDF_Load_Mode, OWL_Parse_Mode,ImportFlag) :-
( RDF_Load_Mode=complete
- -> rdf_retractall(_,_,_)
+ -> rdf_retractall(_,_,_), retractall(rdf_db:rdf_source(_,_,_,_))
; true),
- retractall(rdf_db:rdf_source(_,_,_,_)),
- debug(owl_parser,'Loading stream ~w',[URL]),
- owl_canonical_parse_2([URL],URL,ImportFlag,[],ProcessedIRIs),
- debug(owl_parser,'rdf_db populated, the following IRIs were processed: ~w',[ProcessedIRIs]),
( OWL_Parse_Mode=complete
- -> owl_clear_as,
- retractall(blanknode(_,_,_)),
- retractall(owl(_,_,_,used(_))),
- retractall(owl(_,_,_,used)),
- retractall(owl(_,_,_,used1))
+ -> owl_clear_as,retractall(blanknode(_,_,_)), retractall(owl(_,_,_,_))
; true),
!,
+ debug(owl_parser,'Loading stream ~w',[URL]),
+ owl_canonical_parse_2([URL],URL,ImportFlag,[],ProcessedIRIs),
+ debug(owl_parser,'rdf_db populated, the following IRIs were processed: ~w',[ProcessedIRIs]),
owl2_model_init,
owl_canonical_parse_3(ProcessedIRIs).
@@ -198,7 +192,6 @@
% Copy the owl facts of the IRI document to the 'not_used'
forall(owl(S,P,O,IRI),assert(owl(S,P,O,not_used))),
-
collect_r_nodes,
% First parse the Ontology axiom
@@ -434,10 +427,10 @@
test_use_owl(O,'rdf:type','owl:Ontology'),
\+ test_use_owl([owl(U,_W,O),owl(U,'rdf:type','owl:Ontology')]),
valid_axiom_annotation_mode(AnnMode,O,'rdf:type','owl:Ontology',List),
- use_owl(O,'rdf:type','owl:Ontology'),
+ use_owl(O,'rdf:type','owl:Ontology',ontology),
nb_setval(current_ontology,O),
- forall(use_owl(O,'owl:imports',IRI), assert_axiom(ontologyImport(O,IRI))),
- forall(use_owl(O,'owl:versionInfo',IRI2), assert_axiom(ontologyVersionInfo(O,IRI2))),!. % Do Once
+ forall(use_owl(O,'owl:imports',IRI,ontology_import), assert_axiom(ontologyImport(O,IRI))),
+ forall(use_owl(O,'owl:versionInfo',IRI2,ontology_version_info), assert_axiom(ontologyVersionInfo(O,IRI2))),!. % Do Once
% See table 5.
@@ -570,7 +563,7 @@
owl_property_expression(C,D) :-
blanknode(C,D,Use),
- ( Use = used, owl_parser_log(C-D),
+ ( Use = used,
retractall(blanknode(C,D,used)),
assert(blanknode(C,D,shared))
;
@@ -588,7 +581,7 @@
owl_datarange(C,D) :-
blanknode(C,D,Use),
- ( Use = used, owl_parser_log(C-D),
+ ( Use = used,
retractall(blanknode(C,D,used)),
assert(blanknode(C,D,shared))
;
@@ -609,20 +602,20 @@
owl_datarange(D,complementOf(DY)) :-
- use_owl(D,'rdf:type','rdfs:Datatype',datarange(D)),
- use_owl(D,'owl:datatypeComplementOf',Y),
+ use_owl(D,'rdf:type','rdfs:Datatype',dataRange(D)),
+ use_owl(D,'owl:datatypeComplementOf',Y,datacomplement(D)),
owl_datarange(Y,DY),
owl_get_bnode(D,complementOf(DY)).
% Table 14, case 2
owl_datarange(D,complementOf('rdfs:Literal')) :-
- use_owl(D,'rdf:type','rdfs:DataRange'),
- use_owl(D,'owl:oneOf',[]),
+ use_owl(D,'rdf:type','rdfs:DataRange',dataRange(D)),
+ use_owl(D,'owl:oneOf',[],oneOf(D)),
owl_get_bnode(D,complementOf('rdfs:Literal')).
owl_datarange(D,oneOf(L)) :-
- use_owl(D,'rdf:type','rdfs:Datatype'),
- use_owl(D,'owl:oneOf',L1),
+ use_owl(D,'rdf:type','rdfs:Datatype',dataType(D)),
+ use_owl(D,'owl:oneOf',L1,oneOf(D)),
owl_individual_list(L1,L),
owl_get_bnode(D,oneOf(L)).
@@ -656,7 +649,7 @@
owl_description(C,D) :-
blanknode(C,D,Use),
- ( Use = used, owl_parser_log(C-D),
+ ( Use = used,
retractall(blanknode(C,D,used)),
assert(blanknode(C,D,shared))
;
@@ -682,15 +675,15 @@
owl_description(D,oneOf(L)) :-
use_owl(D,'owl:oneOf',L1,oneOf(D)),
- ( use_owl(D,'rdf:type','owl:Class') ; true),
+ ( use_owl(D,'rdf:type','owl:Class',oneOf(D,L)) ; true),
owl_individual_list(L1,L),
owl_get_bnode(D,oneOf(L)),!.
owl_description(D,datatypeRestriction(DY,L)) :-
use_owl(D,'rdf:type','rdfs:Datatype',datatypeRestr(D)),
- use_owl(D,'owl:onDatatype',Y),
+ use_owl(D,'owl:onDatatype',Y,dataType(D)),
owl_datarange(Y,DY),
- use_owl(D,'owl:withRestrictions',L1),
+ use_owl(D,'owl:withRestrictions',L1,withRestrictions(D)),
owl_datatype_restriction_list(L1,L),
owl_get_bnode(D,datatypeRestriction(DY,L)).
@@ -703,8 +696,8 @@
%
owl_description(D,Result) :-
not(sub_string(D,0,2,_,'__')),
- use_owl(D,'rdf:type','owl:Class'),
- use_owl(D,'owl:unionOf',L),
+ use_owl(D,'rdf:type','owl:Class',description(D)),
+ use_owl(D,'owl:unionOf',L,unionOf(L)),
owl_description_list(L,DL),
( DL = [], Result = 'owl:Nothing' ;
DL = [D1], Result = D1),
@@ -722,7 +715,7 @@
owl_description(D,Result) :-
not(sub_string(D,0,2,_,'__')),!,
use_owl(D,'rdf:type','owl:Class',dl_compatibility_descr(D)),
- use_owl(D,'owl:oneOf',[]),
+ use_owl(D,'owl:oneOf',[],oneOf(D)),
Result = 'owl:Nothing',
owl_get_bnode(D,Result).
@@ -763,13 +756,13 @@
% changed from thea value-->hasValue
owl_restriction_type(E, P, hasValue(PX,Value)) :-
- use_owl(E, 'owl:hasValue',Value),
+ use_owl(E, 'owl:hasValue',Value,hasValue(E)),
owl_property_expression(P, PX).
% VV:check if RDF parser returns a triple with O=true for
% "true"^^xsd:boolean
owl_restriction_type(E, P, hasSelf(PX)) :-
- use_owl(E, 'owl:hasSelf', true),
+ use_owl(E, 'owl:hasSelf', true,hasSelf(E)),
owl_property_expression(P, PX).
% Support of deprecated translations:
@@ -787,7 +780,7 @@
test_use_owl(E, 'owl:cardinality',Lit),
onClass(E,D),
owl_description(D, DX),!,
- use_owl(E, 'owl:cardinality',Lit),
+ use_owl(E, 'owl:cardinality',Lit,cardinality(E)),
literal_integer(Lit,N),
owl_property_expression(P, PX).
@@ -797,7 +790,7 @@
; onDataRange(E,D), owl_datarange(D,DX)),
!,
% we are sure this is an old-style unqualified CR - now consume triples
- use_owl(E, 'owl:minCardinality',Lit),
+ use_owl(E, 'owl:minCardinality',Lit,minCardinality(E)),
literal_integer(Lit,N),
owl_property_expression(P, PX).
@@ -807,7 +800,7 @@
; onDataRange(E,D), owl_datarange(D,DX)),
!,
% we are sure this is an old-style unqualified CR - now consume triples
- use_owl(E, 'owl:maxCardinality',Lit),
+ use_owl(E, 'owl:maxCardinality',Lit,maxCard(E)),
literal_integer(Lit,N),
owl_property_expression(P, PX).
@@ -817,7 +810,7 @@
% changed from Thea1->2: cardinality->exactCardinality
owl_restriction_type(E, P,exactCardinality(N,PX)) :-
- use_owl(E, 'owl:cardinality',Lit),
+ use_owl(E, 'owl:cardinality',Lit,cardinality(E)),
literal_integer(Lit,N),
owl_property_expression(P, PX).
@@ -830,23 +823,24 @@
owl_restriction_type(E, P, minCardinality(N,PX)) :-
- use_owl(E, 'owl:minCardinality',Lit),literal_integer(Lit,N),
+ use_owl(E, 'owl:minCardinality',Lit,cardinality(E)),literal_integer(Lit,N),
owl_property_expression(P, PX).
owl_restriction_type(E, P, minCardinality(N,PX,DX)) :-
- use_owl(E, 'owl:minQualifiedCardinality',Lit),literal_integer(Lit,N),
+ use_owl(E, 'owl:minQualifiedCardinality',Lit,cardinality(E)),literal_integer(Lit,N),
( onClass(E,D),owl_description(D, DX);
onDataRange(E,D), owl_datarange(D,DX)
),
owl_property_expression(P, PX).
owl_restriction_type(E, P, maxCardinality(N,PX)) :-
- use_owl(E, 'owl:maxCardinality',Lit),literal_integer(Lit,N),
+ use_owl(E, 'owl:maxCardinality',Lit,maxCardinality(E)),literal_integer(Lit,N),
owl_property_expression(P, PX).
owl_restriction_type(E, P, maxCardinality(N,PX,DX)) :-
- use_owl(E, 'owl:maxQualifiedCardinality',Lit),literal_integer(Lit,N),
+ use_owl(E, 'owl:maxQualifiedCardinality',Lit,cardinality(E,Lit)),
+ literal_integer(Lit,N),
( onClass(E,D),owl_description(D, DX);
onDataRange(E,D), owl_datarange(D,DX)),
owl_property_expression(P, PX).
@@ -944,7 +938,7 @@
owl_parse_axiom(disjointClasses([DX,DY]),AnnMode,List) :-
test_use_owl(X,'owl:disjointWith',Y),
valid_axiom_annotation_mode(AnnMode,X,'owl:disjointWith',Y,List),
- use_owl(X,'owl:disjointWith',Y),
+ use_owl(X,'owl:disjointWith',Y,disjointWith(X,Y)),
owl_description(X,DX),
owl_description(Y,DY).
@@ -954,15 +948,15 @@
owl_parse_axiom(disjointClasses(L),_AnnMode,[X]) :-
% TODO: X may be referred to in an annotation axiom??
- use_owl(X,'rdf:type','owl:AllDisjointClasses'),
- use_owl(X,'owl:members',L1),
+ use_owl(X,'rdf:type','owl:AllDisjointClasses',allDisjointClasses(X)),
+ use_owl(X,'owl:members',L1,members(L1)),
owl_description_list(L1,L).
owl_parse_axiom(disjointUnion(DX,DY),AnnMode,List) :-
test_use_owl(X,'owl:disjointUnionOf',Y),
valid_axiom_annotation_mode(AnnMode,X,'owl:disjointUnionOf',Y,List),
- use_owl(X,'owl:disjointUnionOf',Y),
+ use_owl(X,'owl:disjointUnionOf',Y,disjointUnionOf(X,Y)),
owl_description(X,DX),
owl_description_list(Y,DY).
@@ -974,14 +968,14 @@
owl_parse_axiom(subPropertyOf(propertyChain(PL),QX),AnnMode,List) :-
test_use_owl(Q,'owl:propertyChainAxiom',L1),
valid_axiom_annotation_mode(AnnMode,Q,'owl:propertyChainAxiom',L1,List),
- use_owl(Q,'owl:propertyChainAxiom',L1),
+ use_owl(Q,'owl:propertyChainAxiom',L1,propertyChainAxiom(Q)),
owl_property_list(L1,PL),
owl_property_expression(Q,QX).
owl_parse_axiom(subPropertyOf(PX,QX),AnnMode,List) :-
test_use_owl(P,'rdfs:subPropertyOf',Q),
valid_axiom_annotation_mode(AnnMode,P,'rdfs:subPropertyOf',Q,List),
- use_owl(P,'rdfs:subPropertyOf',Q),
+ use_owl(P,'rdfs:subPropertyOf',Q,subPropertyOf(P,Q)),
owl_property_expression(P,PX),
owl_property_expression(Q,QX).
@@ -994,7 +988,7 @@
owl_parse_axiom(equivalentProperties(OPEL),AnnMode,List) :-
test_use_owl(X,'owl:equivalentProperty',Y),
valid_axiom_annotation_mode(AnnMode,X,'owl:equivalentProperty',Y,List),
- use_owl(X,'owl:equivalentProperty',Y),
+ use_owl(X,'owl:equivalentProperty',Y,equivProperty(X,Y)),
% maximally_connected_subgraph_over('owl:equivalentProperty',L),
maplist(owl_property_expression,[X,Y],OPEL).
@@ -1006,7 +1000,7 @@
owl_parse_axiom(disjointProperties([DX,DY]),AnnMode,List) :-
test_use_owl(X,'owl:propertyDisjointWith',Y),
valid_axiom_annotation_mode(AnnMode,X,'owl:propertyDisjointWith',Y,List),
- use_owl(X,'owl:propertyDisjointWith',Y),
+ use_owl(X,'owl:propertyDisjointWith',Y,propertyDisjointWith(X,Y)),
owl_description(X,DX),
owl_description(Y,DY).
@@ -1016,16 +1010,16 @@
owl_parse_axiom(disjointProperties(L),_AnnMode,[X]) :-
% TODO: X may be referred to in an annotation axiom??
- use_owl(X,'rdf:type','owl:AllDisjointProperties'),
- use_owl(X,'owl:members',L1),
+ use_owl(X,'rdf:type','owl:AllDisjointProperties',allDisjointProps(X,L1)),
+ use_owl(X,'owl:members',L1,members(L1)),
L1 = [_,_|_], % length >= 2
owl_property_list(L1,L).
owl_parse_axiom(propertyDomain(PX,CX),AnnMode,List) :-
test_use_owl(P,'rdfs:domain',C),
valid_axiom_annotation_mode(AnnMode,P,'rdfs:domain',C,List),
- use_owl(P,'rdfs:domain',C),
+ use_owl(P,'rdfs:domain',C,domain(P,C)),
( annotationProperty(P),CX = C ;
owl_property_expression(P,PX),
owl_description(C,CX)
@@ -1039,7 +1033,7 @@
owl_parse_axiom(propertyRange(PX,CX),AnnMode,List) :-
test_use_owl(P,'rdfs:range',C),
valid_axiom_annotation_mode(AnnMode,P,'rdfs:range',C,List),
- use_owl(P,'rdfs:range',C),
+ use_owl(P,'rdfs:range',C,range(P,C)),
( annotationProperty(P) -> PX = P, CX = C ;
owl_property_expression(P,PX),
( owl_description(C,CX) -> true ; owl_datarange(C,CX))
@@ -1048,49 +1042,49 @@
owl_parse_axiom(inverseProperties(PX,QX),AnnMode,List) :-
test_use_owl(P,'owl:inverseOf',Q),
valid_axiom_annotation_mode(AnnMode,P,'owl:inverseOf',Q,List),
- use_owl(P,'owl:inverseOf',Q),
+ use_owl(P,'owl:inverseOf',Q,inverseOf(P,Q)),
owl_property_expression(P,PX),
owl_property_expression(Q,QX).
owl_parse_axiom(functionalProperty(P),AnnMode,List) :-
test_use_owl(P,'rdf:type','owl:FunctionalProperty'),
valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:FunctionalProperty',List),
- use_owl(P,'rdf:type','owl:FunctionalProperty').
+ use_owl(P,'rdf:type','owl:FunctionalProperty',functionalProperty(P)).
owl_parse_axiom(inverseFunctionalProperty(P),AnnMode,List) :-
test_use_owl(P,'rdf:type','owl:InverseFunctionalProperty'),
valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:InverseFunctionalProperty',List),
- use_owl(P,'rdf:type','owl:InverseFunctionalProperty').
+ use_owl(P,'rdf:type','owl:InverseFunctionalProperty',inverseFunctionalProperty(P)).
owl_parse_axiom(reflexiveProperty(P),AnnMode,List) :-
test_use_owl(P,'rdf:type','owl:ReflexiveProperty'),
valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:ReflexiveProperty',List),
- use_owl(P,'rdf:type','owl:ReflexiveProperty').
+ use_owl(P,'rdf:type','owl:ReflexiveProperty',reflexiveProperty(P)).
owl_parse_axiom(irreflexiveProperty(P),AnnMode,List) :-
test_use_owl(P,'rdf:type','owl:IrreflexiveProperty'),
valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:IrreflexiveProperty',List),
- use_owl(P,'rdf:type','owl:IrreflexiveProperty').
+ use_owl(P,'rdf:type','owl:IrreflexiveProperty',irreflexiveProperty(P)).
owl_parse_axiom(symmetricProperty(P),AnnMode,List) :-
test_use_owl(P,'rdf:type','owl:SymmetricProperty'),
valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:SymmetricProperty',List),
- use_owl(P,'rdf:type','owl:SymmetricProperty').
+ use_owl(P,'rdf:type','owl:SymmetricProperty',symmetricProperty(P)).
owl_parse_axiom(asymmetricProperty(P),AnnMode,List) :-
test_use_owl(P,'rdf:type','owl:AsymmetricProperty'),
valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:AsymmetricProperty',List),
- use_owl(P,'rdf:type','owl:AsymmetricProperty').
+ use_owl(P,'rdf:type','owl:AsymmetricProperty',assymetricProperty(P)).
owl_parse_axiom(transitiveProperty(P),AnnMode,List) :-
test_use_owl(P,'rdf:type','owl:TransitiveProperty'),
valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:TransitiveProperty',List),
- use_owl(P,'rdf:type','owl:TransitiveProperty').
+ use_owl(P,'rdf:type','owl:TransitiveProperty',transitiveProperty(P)).
owl_parse_axiom(hasKey(CX,L),AnnMode,List) :-
test_use_owl(C,'owl:hasKey',L1),
valid_axiom_annotation_mode(AnnMode,C,'owl:hasKey',L1,List),
- use_owl(C,'owl:hasKey',L1),
+ use_owl(C,'owl:hasKey',L1,hasKey(C)),
owl_description(C,CX),
L1 = [_,_|_], % length >= 2
owl_property_list(L1,L).
@@ -1100,36 +1094,36 @@
owl_parse_axiom(sameIndividual([X,Y]),AnnMode,List) :-
test_use_owl(X,'owl:sameAs',Y),
valid_axiom_annotation_mode(AnnMode,X,'owl:sameAs',Y,List),
- use_owl(X,'owl:sameAs',Y).
+ use_owl(X,'owl:sameAs',Y,sameAs(X,Y)).
owl_parse_axiom(differentIndividuals([X,Y]),AnnMode,List) :-
test_use_owl(X,'owl:differentFrom',Y),
valid_axiom_annotation_mode(AnnMode,X,'owl:differentFrom',Y,List),
- use_owl(X,'owl:differentFrom',Y).
+ use_owl(X,'owl:differentFrom',Y,differentFrom(X,Y)).
owl_parse_axiom(differentIndividuals(L),_AnnMode,[X]) :-
- use_owl(X,'rdf:type','owl:AllDifferent'),
- use_owl(X,'owl:distinctMembers',L1),
+ use_owl(X,'rdf:type','owl:AllDifferent',allDifferent(L)),
+ use_owl(X,'owl:distinctMembers',L1,distinctMembers(L)),
owl_individual_list(L1,L).
owl_parse_axiom(differentIndividuals(L),_AnnMode,[X]) :-
- use_owl(X,'rdf:type','owl:AllDifferent'),
- use_owl(X,'owl:members',L1),
+ use_owl(X,'rdf:type','owl:AllDifferent',allDifferent(X)),
+ use_owl(X,'owl:members',L1,members(L)),
owl_individual_list(L1,L).
% make sure this is done before fetching classAssertion/2;
% -- the annotationAssertion matching clause should preceded the classAssertion/2 matching clause
owl_parse_axiom(annotationAssertion('owl:deprecated', X, true),AnnMode,List) :-
test_use_owl(X, 'rdf:type', 'owl:DeprecatedClass'),
valid_axiom_annotation_mode(AnnMode,X,'rdf:type','owl:DeprecatedClass',List),
- use_owl(X, 'rdf:type', 'owl:DeprecatedClass').
+ use_owl(X, 'rdf:type', 'owl:DeprecatedClass',deprecatedClass(X)).
% make sure this is done before fetching propertyAssertion/3
% this clause should precede it
owl_parse_axiom(annotationAssertion('owl:deprecated', X, true),AnnMode,List) :-
test_use_owl(X, 'rdf:type', 'owl:DeprecatedProperty'),
valid_axiom_annotation_mode(AnnMode,X,'rdf:type','owl:DeprecatedProperty',List),
- use_owl(X, 'rdf:type', 'owl:DeprecatedProperty').
+ use_owl(X, 'rdf:type', 'owl:DeprecatedProperty',deprecatedProperty(X)).
% Table 17. Parsing of Annotated Axioms
@@ -1141,7 +1135,7 @@
annotationProperty(P),
test_use_owl(A,P,B), % B can be literal or individual
valid_axiom_annotation_mode(AnnMode,A,P,B,List),
- use_owl(A,P,B).
+ use_owl(A,P,B,annotationProperty(P)).
dothislater(classAssertion/2).
@@ -1234,7 +1228,7 @@
test_use_owl(X,P,Y), % seed
\+ member(X,Used),
\+ member(Y,Used),
- use_owl(X,P,Y), % seed
+ use_owl(X,P,Y,maximally_conected), % seed
!,
extend_set_over(P,[X,Y],CSet),
append(CSet,Used,Used2),
@@ -1247,13 +1241,13 @@
member(X,L),
test_use_owl(X,P,Y),
\+ member(Y,L),
- use_owl(X,P,Y),
+ use_owl(X,P,Y,extend_set_over),
!,extend_set_over(P,[Y|L],L2).
extend_set_over(P,L,L2):-
member(X,L),
test_use_owl(Y,P,X),
\+ member(Y,L),
- use_owl(Y,P,X),
+ use_owl(Y,P,X,extend_set_over),
!,extend_set_over(P,[Y|L],L2).
extend_set_over(_,L,L):- !.
View
17 owl2_from_rdf_utils.pl
@@ -2,16 +2,6 @@
% UTILITY Predicates
% -----------------------------------------------------------------------
-%% owl_parser_log(+Log)
-%
-% Log is a list; together with a timestamp it is asserted as
-% an owl_parser_log/2 term.
-
-owl_parser_log(Log) :-
- debug(owl_parser,'~w',[Log]),
- get_time(T),convert_time(T,TS),
- assertz(owl_parser_log(TS, Log)).
-
%% owl_clear_as
%
@@ -39,17 +29,16 @@
rdf_2_owl(Base,Ont) :-
- owl_parser_log(['Removing existing owl triples']),
+ debug(owl_parser, 'Removing existing owl triples',[]),
retractall(owl(_,_,_,Ont)),
- owl_parser_log('Copying RDF triples to OWL triples'),
+ debug(owl_parser,'Copying RDF triples to OWL triples',[]),
rdf(X,Y,Z,Base:_),
% owl_fix_no(X,X1), owl_fix_no(Y,Y1), owl_fix_no(Z,Z1),
assert(owl(X,Y,Z,Ont)), fail.
rdf_2_owl(_,Ont) :-
owl_count(Ont,Z),
- owl_parser_log(['Number of owl triples copied: ',Z]).
-
+ debug(owl_parser,'Number of owl triples copied: ~w',[Z]).
%% owl_count(?U).
View
84 owl2_util.pl
@@ -38,6 +38,7 @@
:-use_module(library('http/http_open')).
:-use_module(library('http/http_client')).
:-use_module(library('http/thread_httpd.pl')).
+:-use_module(library(sgml)).
% @Deprecated
@@ -378,6 +379,10 @@
isalpha(X) :- X @>= '0',X @=< '9'.
+
+
+stats(File) :- owl_statistics(all,XML), open(File,write,S), xml_write(S,XML,[header(true)]),close(S).
+
%% owl_statistics(+Item, -XMLResult) is det
%
% @param Item Given either all OR a specific ontology(O), it returns
@@ -388,23 +393,45 @@
% @tbd Complete with other statistic info.
-owl_statistics(all,[element(owl_statistics,[axiomCount=ACount],OList)]) :-
- findall(OElem,
- (ontology(O),owl_statistics(ontology(O),OElem)),
- OList),
+owl_statistics(all,[element(all_axioms,[axiomCount=ACount],[AxiomsElement|OList1])]) :-
+
+ findall(element(owl4,[source=Source,count=Count],[]),
+ ( aggregate_all(set(S),(owl2_from_rdf:owl(_,_,_,Source),
+ (atom(Source),S=Source ; Source = used(_),S=used)),SetSource),
+ member(Source,SetSource),
+ aggregate_all(count,((Source = used, Source1 = used(_) ; Source1=Source),owl2_from_rdf:owl(_,_,_,Source1)),Count)),
+ OWL4),
+
+ owl_statistics(axioms,AxiomsElement),
+ findall(OElem,(ontology(O),owl_statistics(ontology(O),OElem)), OList),
+ append(OWL4,OList,OList1),
aggregate_all(count,axiom(_),ACount),!.
-owl_statistics(ontology(O),element(ontology,[name=O,axiomCount=ACount],OntAxioms)) :-
- findall(element(P-axioms,[axiomCount=APCount],PredAxioms),
+owl_statistics(ontology(O),element(ontology,[name=O,axiomCount=ACount,axiomPredCount=AxiomPredCount],OntAxioms)) :-
+ findall(element(P-axioms,[axiomCount=APCount],[]), % or enter P
( axiompred(P/A),functor(T,P,A),
- findall(AT,
- ( ontologyAxiom(O,T),owl_stats_axiom_element(T,AT)),
- PredAxioms),
+ % findall(AT,
+ % ( ontologyAxiom(O,T),owl_stats_axiom_element(T,AT)),
+ % _PredAxioms),
aggregate_all(count,ontologyAxiom(O,T),APCount)
),
OntAxioms),
- aggregate_all(count,ontologyAxiom(O,_Axiom),ACount),!.
+ aggregate_all(count,ontologyAxiom(O,_Axiom),ACount),
+ aggregate_all(sum(X), member(element(_Pred,[axiomCount=X],_),OntAxioms),AxiomPredCount).
+
+
+owl_statistics(axioms,element(allAxioms,[axiomCount=ACount,axiomPredCount=AxiomPredCount],OntAxioms)) :-
+ findall(element(P-axioms,[axiomCount=APCount],[]), % or enter P
+ ( axiompred(P/A),functor(T,P,A),
+ % findall(AT,
+ % ( ontologyAxiom(O,T),owl_stats_axiom_element(T,AT)),
+ % _PredAxioms),
+ aggregate_all(count,axiom(T),APCount)
+ ),
+ OntAxioms),
+ aggregate_all(count,axiom(_Axiom),ACount),
+ aggregate_all(sum(X), member(element(_Pred,[axiomCount=X],_),OntAxioms),AxiomPredCount).
owl_stats_axiom_element(class(C),element(class,[name=C],[])) :- !.
@@ -413,6 +440,7 @@
+
% ---------------------------------------------------------------
%
%
@@ -435,7 +463,7 @@
),
open('graph_http.log',append,Log),write(Log,RequestXML),nl(Log),
- owl_generate_graph(_,true,Result),
+ owl_generate_graph(_,false,Result),
xml_write([Result],[header(true)]),
xml_write(Log,[Result],[header(true)]),nl(Log),
close(Log).
@@ -448,7 +476,7 @@
open(File,write,S), xml_write(S,[Result],[header(true)]),close(S).
owl_generate_graph(Ontology,ReifyAxioms,Result) :-
- ( var(Ontology), ontology(Ontology) ->
+ ( ontology(Ontology) ->
owl_generate_graph(Ontology,ReifyAxioms,Result,[])
;
Result = element(error,[],[no_ontology_found])).
@@ -461,18 +489,33 @@
),
Nodes).
+
owl_generate_axiom_graph(subClassOf(Sub,Super),true,element(node, [type=subClassOf],Children)) :-
Children = [element(arc,[type=axiom_argument],[SubNode]),
element(arc,[type=axiom_argument],[SuperNode])],
owl2_generate_ce_graph(Sub,element(E,L,C)),
SubNode = element(E,L,[element(arc,[type=subClassOf],[SuperNode])|C]),
owl2_generate_ce_graph(Super,SuperNode).
+owl_generate_axiom_graph(equivalentClasses([Sub,Super]),true,element(node, [type=equivalentClass],Children)) :-
+ Children = [element(arc,[type=axiom_argument],[SubNode]),
+ element(arc,[type=axiom_argument],[SuperNode])],
+ owl2_generate_ce_graph(Sub,element(E,L,C)),
+ SubNode = element(E,L,[element(arc,[type=equivalentClass],[SuperNode])|C]),
+ owl2_generate_ce_graph(Super,SuperNode).
+
+
owl_generate_axiom_graph(subClassOf(Sub,Super),false,SubNode) :-
owl2_generate_ce_graph(Sub,element(E,L,C)),
SubNode = element(E,L,[element(arc,[type=subClassOf],[SuperNode])|C]),
owl2_generate_ce_graph(Super,SuperNode).
+owl_generate_axiom_graph(equivalentClasses([Sub,Super]),false,SubNode) :-
+ owl2_generate_ce_graph(Sub,element(E,L,C)),
+ SubNode = element(E,L,[element(arc,[type=equivalentClass],[SuperNode])|C]),
+ owl2_generate_ce_graph(Super,SuperNode).
+
+
% owl_generate_axiom_graph(_,_,element(node,[type=axiom_error],[])).
@@ -481,15 +524,15 @@
%
owl2_generate_ce_graph(intersectionOf([E|Rest]),element(node,[type=intersectionOf],Children)) :-
- findall(element(arc,type=[member],[Node]),
+ findall(element(arc,[type=member],[Node]),
+ (member(X,[E|Rest]), owl2_generate_ce_graph(X,Node)),
+ Children),!.
+
+owl2_generate_ce_graph(unionOf([E|Rest]),element(node,[type=unionOf],Children)) :-
+ findall(element(arc,[type=member],[Node]),
(member(X,[E|Rest]), owl2_generate_ce_graph(X,Node)),
Children),!.
-owl2_export_axiom(unionOf([E|Rest]),main_triple(BNode,'rdf:type',Type)) :-
- as2rdf_bnode(unionOf([E|Rest]),BNode),
- owl2_export_list([E|Rest],LNode),
- ( classExpression(E) -> Type = 'owl:Class'; Type = 'owl:Datatype'),
- owl_rdf_assert(BNode,'owl:unionOf', LNode),!.
owl2_export_axiom(oneOf([E|Rest]),main_triple(BNode,'rdf:type',Type)) :-
as2rdf_bnode(oneOf([E|Rest]),BNode),
@@ -590,8 +633,11 @@
( classExpression(CEorDR) -> owl_rdf_assert(BNode,'owl:onClass',Tce); owl_rdf_assert(BNode,'owl:onDataRange',Tce)),!.
-owl2_generate_ce_graph(IRI,element(node,[type=class,id=NSLocal],[])) :- atom(IRI),contract_ns(IRI,NSLocal),!. % better iri(IRI).
+owl2_generate_ce_graph(IRI,element(node,[type=class,id=NSLocalA],[])) :- atom(IRI),rdf_db:rdf_global_id(NSLocal,IRI),
+ term_to_atom(NSLocal,NSLocalA),!. % better iri(IRI).
+% owl2_generate_ce_graph(_,element(node,[type=unhandled_ce_node],[])) :-
+% !.
/** <module> Various utility predicates for OWL ontologies
View
2,402 testfiles/wine_no_ontology.owl
@@ -0,0 +1,2402 @@
+<?xml version="1.0"?>
+<!DOCTYPE rdf:RDF [
+ <!ENTITY vin "http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#" >
+ <!ENTITY food "http://www.w3.org/TR/2003/PR-owl-guide-20031209/food#" >
+ <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
+ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+ ]>
+
+<rdf:RDF
+ xmlns = "http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#"
+ xmlns:vin = "http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#"
+ xml:base = "http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#"
+ xmlns:food= "http://www.w3.org/TR/2003/PR-owl-guide-20031209/food#"
+ xmlns:owl = "http://www.w3.org/2002/07/owl#"
+ xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:rdfs= "http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:xsd = "http://www.w3.org/2001/XMLSchema#">
+<!--
+ <owl:Ontology rdf:about="">
+ <rdfs:comment>An example OWL ontology</rdfs:comment>
+ <owl:priorVersion>
+ <owl:Ontology rdf:about="http://www.w3.org/TR/2003/CR-owl-guide-20030818/wine"/>
+ </owl:priorVersion>
+ <owl:imports rdf:resource="http://www.w3.org/TR/2003/PR-owl-guide-20031209/food"/>
+ <rdfs:comment>Derived from the DAML Wine ontology at
+ http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml
+ Substantially changed, in particular the Region based relations.
+ </rdfs:comment>
+ <rdfs:label>Wine Ontology</rdfs:label>
+ </owl:Ontology>
+ -->
+ <owl:Class rdf:ID="Wine">
+ <rdfs:subClassOf rdf:resource="&food;PotableLiquid" />
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasMaker" />
+ <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasMaker" />
+ <owl:allValuesFrom rdf:resource="#Winery" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasSugar" />
+ <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasFlavor" />
+ <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasBody" />
+ <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#locatedIn"/>
+ <owl:someValuesFrom rdf:resource="&vin;Region"/>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:label xml:lang="en">wine</rdfs:label>
+ <rdfs:label xml:lang="fr">vin</rdfs:label>
+ </owl:Class>
+
+ <owl:Class rdf:ID="Vintage">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasVintageYear"/>
+ <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WineGrape">
+ <rdfs:subClassOf rdf:resource="&food;Grape" />
+ </owl:Class>
+
+ <owl:Class rdf:ID="WhiteWine">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Wine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:hasValue rdf:resource="#White" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WhiteTableWine">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#TableWine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:hasValue rdf:resource="#White" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WhiteNonSweetWine">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#WhiteWine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasSugar" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Dry" />
+ <owl:Thing rdf:about="#OffDry" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WhiteLoire">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Loire" />
+ <owl:Class rdf:about="#WhiteWine" />
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:about="#WhiteLoire">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#CheninBlancGrape" />
+ <owl:Thing rdf:about="#PinotBlancGrape" />
+ <owl:Thing rdf:about="#SauvignonBlancGrape" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WhiteBurgundy">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Burgundy" />
+ <owl:Class rdf:about="#WhiteWine" />
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:about="#WhiteBurgundy">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:hasValue rdf:resource="#ChardonnayGrape" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WhiteBordeaux">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Bordeaux" />
+ <owl:Class rdf:about="#WhiteWine" />
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:about="#WhiteBordeaux">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#SemillonGrape" />
+ <owl:Thing rdf:about="#SauvignonBlancGrape" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="Region" />
+
+ <owl:ObjectProperty rdf:ID="locatedIn">
+ <rdf:type rdf:resource="&owl;TransitiveProperty" />
+ <rdfs:domain rdf:resource="http://www.w3.org/2002/07/owl#Thing" />
+ <rdfs:range rdf:resource="#Region" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="adjacentRegion">
+ <rdf:type rdf:resource="&owl;SymmetricProperty" />
+ <rdfs:domain rdf:resource="#Region" />
+ <rdfs:range rdf:resource="#Region" />
+ </owl:ObjectProperty>
+
+ <owl:Class rdf:ID="VintageYear" />
+
+ <owl:DatatypeProperty rdf:ID="yearValue">
+ <rdfs:domain rdf:resource="#VintageYear" />
+ <rdfs:range rdf:resource="&xsd;positiveInteger" />
+ </owl:DatatypeProperty>
+
+ <VintageYear rdf:ID="Year1998">
+ <yearValue rdf:datatype="&xsd;positiveInteger">1998</yearValue>
+ </VintageYear>
+
+ <owl:ObjectProperty rdf:ID="hasVintageYear">
+ <rdf:type rdf:resource="&owl;FunctionalProperty" />
+ <rdfs:domain rdf:resource="#Vintage" />
+ <rdfs:range rdf:resource="#VintageYear" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="madeFromGrape">
+ <rdfs:subPropertyOf rdf:resource="&food;madeFromFruit" />
+ <rdfs:domain rdf:resource="#Wine" />
+ <rdfs:range rdf:resource="#WineGrape" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="madeIntoWine">
+ <owl:inverseOf rdf:resource="#madeFromGrape" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="hasWineDescriptor">
+ <rdfs:domain rdf:resource="#Wine" />
+ <rdfs:range rdf:resource="#WineDescriptor" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="hasSugar">
+ <rdf:type rdf:resource="&owl;FunctionalProperty" />
+ <rdfs:subPropertyOf rdf:resource="#hasWineDescriptor" />
+ <rdfs:range rdf:resource="#WineSugar" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="hasBody">
+ <rdf:type rdf:resource="&owl;FunctionalProperty" />
+ <rdfs:subPropertyOf rdf:resource="#hasWineDescriptor" />
+ <rdfs:range rdf:resource="#WineBody" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="hasFlavor">
+ <rdf:type rdf:resource="&owl;FunctionalProperty" />
+ <rdfs:subPropertyOf rdf:resource="#hasWineDescriptor" />
+ <rdfs:range rdf:resource="#WineFlavor" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="hasColor">
+ <rdf:type rdf:resource="&owl;FunctionalProperty" />
+ <rdfs:subPropertyOf rdf:resource="#hasWineDescriptor" />
+ <rdfs:domain rdf:resource="#Wine" />
+ <rdfs:range rdf:resource="#WineColor" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="hasMaker">
+ <rdf:type rdf:resource="&owl;FunctionalProperty" />
+ </owl:ObjectProperty>
+
+ <owl:ObjectProperty rdf:ID="producesWine">
+ <owl:inverseOf rdf:resource="#hasMaker" />
+ </owl:ObjectProperty>
+
+ <owl:Class rdf:ID="Zinfandel">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Wine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:hasValue rdf:resource="#ZinfandelGrape" />
+ </owl:Restriction>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:about="#Zinfandel">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:hasValue rdf:resource="#Red" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasSugar" />
+ <owl:hasValue rdf:resource="#Dry" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasBody" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Full" />
+ <owl:Thing rdf:about="#Medium" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasFlavor" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Moderate" />
+ <owl:Thing rdf:about="#Strong" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="Winery" />
+
+ <owl:Class rdf:ID="WineDescriptor">
+ <rdfs:comment>Made WineDescriptor unionType of tastes and color</rdfs:comment>
+ <owl:unionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#WineTaste" />
+ <owl:Class rdf:about="#WineColor" />
+ </owl:unionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WineTaste">
+ <rdfs:subClassOf rdf:resource="#WineDescriptor" />
+ </owl:Class>
+
+ <owl:Class rdf:ID="WineColor">
+ <rdfs:subClassOf rdf:resource="#WineDescriptor" />
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#White" />
+ <owl:Thing rdf:about="#Rose" />
+ <owl:Thing rdf:about="#Red" />
+ </owl:oneOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WineSugar">
+ <rdfs:subClassOf rdf:resource="#WineTaste" />
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Sweet" />
+ <owl:Thing rdf:about="#OffDry" />
+ <owl:Thing rdf:about="#Dry" />
+ </owl:oneOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WineFlavor">
+ <rdfs:subClassOf rdf:resource="#WineTaste" />
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Delicate" />
+ <owl:Thing rdf:about="#Moderate" />
+ <owl:Thing rdf:about="#Strong" />
+ </owl:oneOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="WineBody">
+ <rdfs:subClassOf rdf:resource="#WineTaste" />
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Light" />
+ <owl:Thing rdf:about="#Medium" />
+ <owl:Thing rdf:about="#Full" />
+ </owl:oneOf>
+ </owl:Class>
+
+ <Region rdf:ID="USRegion" />
+
+ <owl:Class rdf:ID="Tours">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Loire" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#locatedIn" />
+ <owl:hasValue rdf:resource="#ToursRegion" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:about="#Tours">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:hasValue rdf:resource="#CheninBlancGrape" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="TableWine">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Wine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasSugar" />
+ <owl:hasValue rdf:resource="#Dry" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="SweetWine">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Wine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasSugar" />
+ <owl:hasValue rdf:resource="#Sweet" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="SweetRiesling">
+ <rdfs:subClassOf rdf:resource="#DessertWine" />
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasBody" />
+ <owl:hasValue rdf:resource="#Full" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasFlavor" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Moderate" />
+ <owl:Thing rdf:about="#Strong" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Riesling" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasSugar" />
+ <owl:hasValue rdf:resource="#Sweet" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="StEmilion">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:hasValue rdf:resource="#Red" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasFlavor" />
+ <owl:hasValue rdf:resource="#Strong" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:hasValue rdf:resource="#CabernetSauvignonGrape" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Bordeaux" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#locatedIn" />
+ <owl:hasValue rdf:resource="#StEmilionRegion" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="SemillonOrSauvignonBlanc">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:hasValue rdf:resource="#White" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasBody" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#Medium" />
+ <owl:Thing rdf:about="#Full" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Wine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:allValuesFrom>
+ <owl:Class>
+ <owl:oneOf rdf:parseType="Collection">
+ <owl:Thing rdf:about="#SemillonGrape" />
+ <owl:Thing rdf:about="#SauvignonBlancGrape" />
+ </owl:oneOf>
+ </owl:Class>
+ </owl:allValuesFrom>
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="Semillon">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#SemillonOrSauvignonBlanc" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:hasValue rdf:resource="#SemillonGrape" />
+ </owl:Restriction>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="SauvignonBlanc">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#SemillonOrSauvignonBlanc" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:hasValue rdf:resource="#SauvignonBlancGrape" />
+ </owl:Restriction>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="Sauternes">
+ <rdfs:subClassOf rdf:resource="#LateHarvest" />
+ <rdfs:subClassOf rdf:resource="#Bordeaux" />
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#locatedIn" />
+ <owl:hasValue rdf:resource="#SauterneRegion" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasBody" />
+ <owl:hasValue rdf:resource="#Medium" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:hasValue rdf:resource="#White" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="Sancerre">
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasBody" />
+ <owl:hasValue rdf:resource="#Medium" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasSugar" />
+ <owl:hasValue rdf:resource="#OffDry" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasFlavor" />
+ <owl:hasValue rdf:resource="#Delicate" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:hasValue rdf:resource="#SauvignonBlancGrape" />
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <rdfs:subClassOf>
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#madeFromGrape" />
+ <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>
+ </owl:Restriction>
+ </rdfs:subClassOf>
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Loire" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#locatedIn" />
+ <owl:hasValue rdf:resource="#SancerreRegion" />
+ </owl:Restriction>
+ </owl:intersectionOf>
+ </owl:Class>
+
+ <owl:Class rdf:ID="RoseWine">
+ <owl:intersectionOf rdf:parseType="Collection">
+ <owl:Class rdf:about="#Wine" />
+ <owl:Restriction>
+ <owl:onProperty rdf:resource="#hasColor" />
+ <owl:hasValue rdf:resource="#Rose" />
+ </owl:Restriction>
+ <