-
Notifications
You must be signed in to change notification settings - Fork 19
/
owl2_thea1_compat.pl
93 lines (71 loc) · 3.23 KB
/
owl2_thea1_compat.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* -*- Mode: Prolog -*- */
:- module(owl2_thea1_compat,[
class/5,
subclassOf/2,
disjointSet/1,
equivalentSet/1,
property/7,
sameIndividuals/1,
individual/4
]
).
:- use_module(owl2_model,[]).
:- use_module('owl2_from_rdf').
%% class(?Class,?Deprecated,?Complete,?Annotations, ?Descriptions)
class(C,false,true,Annotations,Descs) :-
owl2_model:class(C),
( owl2_model:equivalentClasses(ECL),member(C,ECL) -> select(C,ECL,Descs) ; Descs = []),
findall(annotation(AP,AV),owl2_model:annotationAssertion(AP,C,AV),Annotations).
subclassOf(X,Y) :-
owl2_model:subClassOf(X,Y).
disjointSet(S) :-
owl2_model:disjointClasses(S).
equivalentSet(S) :-
owl2_model:equivalentClasses(S).
property(PID,Deprecated,AnnotationList,PID_SuperList,
PTList,
PID_DomainList,PID_RangeList):-
( owl2_model:dataProperty(PID) ; owl2_model:objectProperty(PID)),
property_type(PID,PTList),
Deprecated = false,
findall(annotation(AP,AV),owl2_model:annotationAssertion(AP,PID,AV),AnnotationList),
findall(SPID,owl2_model:subPropertyOf(PID,SPID),PID_SuperList),
findall(Domain,owl2_model:propertyDomain(PID,Domain),PID_DomainList),
findall(Range,owl2_model:propertyRange(PID,Range),PID_RangeList).
property_type(PID,[OT,F,IF,T,S,iof(Inv)]) :-
( owl2_model:dataProperty(PID) -> OT =datatypeProperty ; true),
( owl2_model:objectProperty(PID) -> OT = objectProperty ; true),
( owl2_model:functionalProperty(PID) -> F = functional ; true),
( owl2_model:inverseFunctionalProperty(PID) -> IF=inversefunctional; true),
( owl2_model:transitiveProperty(PID) -> T = transitive ; true),
( owl2_model:symmetricProperty(PID)-> S = symmetric ; true),
( owl2_model:inverseProperties(PID,Inv) ; true),!.
sameIndividuals(Set) :-
owl2_model:sameIndividual(Set).
individual(I,Annotations,ITList,IVList) :-
owl2_model:classAssertion(_,I),
findall(C1,owl2_model:classAssertion(C1,I),ITList),
findall(value(P,V),owl2_model:propertyAssertion(P,I,V),IVList),
findall(annotation(AP,AV),owl2_model:annotationAssertion(AP,I,AV),Annotations).
go :-
owl_parse('http://www.theoldtile.gr/data',complete,complete,true),
open('thea2',write,St),
print(St, '**** Classes *****'),nl(St),
forall(owl_parser:class(A,B,C,D,E),(print(St,A-B-C-D-E),nl(St))),
print(St, '**** Sub Classes *****'),nl(St),
forall(owl_parser:subclassOf(A,B),(print(St,A-B),nl(St))),
print(St, '**** Equiv Set *****'),nl(St),
forall(owl_parser:equivalentSet(S),(print(St,S),nl(St))),
print(St, '**** DisjointSet Set *****'),nl(St),
forall(owl_parser:disjointSet(S),(print(St,S),nl(St))),
print(St, '**** Properties *****'),nl(St),
forall(owl_parser:property(A,B,C,D,E,F,G),(print(St,A-B-C-D-E-F-G),nl(St))),
print(St, '**** Annotation Properties *****'),nl(St),
forall(owl_parser:annotationProperty(A),(print(St-A),nl(St))),
print(St, '**** Individuals *****'),nl(St),
forall(owl_parser:individual(A,B,C,D),(print(St,A-B-C-D),nl(St))),
print(St, '**** Different Individuals *****'),nl(St),
forall(owl_parser:differentIndividuals(S),(print(St,S),nl(St))),
print(St, '**** Same Individuals *****'),nl(St),
forall(owl_parser:sameIndividuals(S),(print(St,S),nl(St))),
close(St).