1:- module(dss_graph, []). 2:- use_module(cliopatria(cliopatria)). 3:- use_module(cliopatria(hooks)). 4:- use_module(library(semweb/rdf_db)). 5:- use_module(library(semweb/rdfs)).
12create_inverse_properties :-
13 forall(rdf(P, owl:inverseOf, P2),
14 rdf_set_predicate(P, inverse_of(P2))).
15
16:- initialization create_inverse_properties. 17:- cp_after_load(create_inverse_properties). 18:- multifile user:message_hook/3. 19user:message_hook(rdf(loaded(_Action, _Source, _DB, _Triples, _Time)), _, _) :-
20 create_inverse_properties,
21 fail.
22
23:- rdf_meta
24 dss_context_predicate(r, r). 25
26dss_context_predicate(_, mdb:bestemming).
27dss_context_predicate(_, mdb:has_aanmonstering).
28dss_context_predicate(_, mdb:persoon).
29dss_context_predicate(_, mdb:rang).
30dss_context_predicate(_, mdb:schip).
31dss_context_predicate(_, mdb:ligplaats).
32dss_context_predicate(_, mdb:thuishaven).
33dss_context_predicate(_, mdb:vertrekhaven).
34dss_context_predicate(_, mdb:woonplaats).
35dss_context_predicate(_, dss:has_shiptype).
36dss_context_predicate(_, dss:hasOriginalScan).
37dss_context_predicate(_, mdb:has_person_contract).
38dss_context_predicate(_, mdb:has_contract).
39dss_context_predicate(_, dss:has_kb_link).
40dss_context_predicate(_, dss:has_ship).
41dss_context_predicate(_, dss:typeOfShip).
42dss_context_predicate(_, dss:has_record).
43dss_context_predicate(_, foaf:based_near).
44dss_context_predicate(_, gzmvoc:has_das_link_heen).
45dss_context_predicate(_, gzmvoc:has_das_link_terug).
46dss_context_predicate(_, gzmvoc:has_lokatie).
47dss_context_predicate(_, dss:has_captain).
48dss_context_predicate(_, dcterms:spatial).
49dss_context_predicate(_, das:chamber).
50dss_context_predicate(_, das:chamberForWhichCargoIsDestined).
51
52
53cliopatria:context_predicate(S, P) :-
54 dss_context_predicate(S, P).
55
56cliopatria:node_shape(URI, Shape, _Options) :-
57 rdf(URI, schema:image, Image), !,
58 rdfs_label(URI, Label),
59 Shape = [ img([ src(Image),
60 scale(true)
61 ]),
62 width('150'), height('120'),
63 cellpadding('0'),
64 fixedsize(true),
65 label(Label),
66 border(1)
67 ].
68cliopatria:node_shape(Image, Shape, _Options) :-
69 rdf(URI, dss:hasOriginalScan, Image), !,
70 rdfs_label(URI, Label),
71 Shape = [ img([ src(Image),
72 scale(true)
73 ]),
74 width('150'), height('120'),
75 cellpadding('0'),
76 fixedsize(true),
77 label(Label),
78 border(1)
79 ].
80cliopatria:node_shape(Ship, Shape, _Options) :-
81 rdf(Ship, rdf:type, Type),
82 rdf_reachable(Type, rdfs:subClassOf, dss:'Ship'), !,
83 Shape = [ shape(invtrapezium), style(filled), fillcolor('#cc9966') ].
84cliopatria:node_shape(Ship, Shape, _Options) :-
85 rdf(Ship, rdf:type, Type),
86 rdf_reachable(Type, rdfs:subClassOf, dss:'Place'), !,
87 Shape = [ shape(house), style(filled), fillcolor('#ff9966') ].
88cliopatria:node_shape(Ship, Shape, _Options) :-
89 rdf(Ship, rdf:type, Type),
90 rdf_reachable(Type, rdfs:subClassOf, dss:'Person'), !,
91 Shape = [ shape(egg), style(filled), fillcolor('#ccffff') ].
92cliopatria:node_shape(Ship, Shape, _Options) :-
93 rdf(Ship, rdf:type, Type),
94 rdf_reachable(Type, rdfs:subClassOf, dss:'Record'), !,
95 Shape = [ shape(component), style(filled), fillcolor('#99ff99') ].
96cliopatria:node_shape(Ship, Shape, _Options) :-
97 rdf(Ship, rdf:type, Type),
98 rdf_reachable(Type, rdfs:subClassOf, skos:'Concept'), !,
99 Shape = [ shape(trapezium), style(filled), fillcolor('#cccccc') ].
100
101cliopatria:bag_shape([First|_], Shape, _Options) :-
102 rdf(First, rdf:type, Type),
103 rdf_reachable(Type, rdfs:subClassOf, dss:'Record'), !,
104 Shape = [ max(25),
105 shape(tab),
106 style('filled,bold'),
107 max_label_length(50)
108 ].
109cliopatria:bag_shape(_Members, [max(25)], _Options)