01: package org.ontoware.rdf2go.model;
02:
03: import java.util.Collection;
04:
05: import org.ontoware.rdf2go.model.node.BlankNode;
06: import org.ontoware.rdf2go.model.node.Resource;
07:
08: /**
09: * Support for reification, as defined in
10: * {@link http://www.w3.org/TR/rdf-mt/#Reif}
11: *
12: * @author voelkel
13: *
14: */
15: public interface ReificationSupport {
16:
17: /**
18: * A convenience function for createReficationOf( createBlankNode(),
19: * statement );
20: *
21: * @param statement
22: * @return a new BlankNode which holds the reification of the given
23: * statement.
24: */
25: BlankNode createReficationOf(Statement statement);
26:
27: /**
28: * Reifies the statement, whether the statement was present in the model or
29: * not. The statement itself is never added to the model, but it might have
30: * been in the model before this method call. This method creates only
31: * triples like (resource )rdf:subject s; rdf:predicate p; rdf:object o.
32: * Where s,p, and o are taken from the given statement.
33: *
34: * Adds the following statemens, as defined in
35: * {@link http://www.w3.org/TR/rdf-mt/#Reif}
36: *
37: * <code><pre>
38: * (resource) rdf:type rdf:Statement .
39: * (resource) rdf:subject (statement.getSubject()) .
40: * (resource) rdf:predicate (statement.getPredicate()) .
41: * (resource) rdf:object (statement.getObject()) .
42: * </pre></code>
43: *
44: * @param statement
45: * which will be reified
46: * @param resource
47: * used to represent the reified statement
48: * @return the given resource
49: */
50: Resource createReficationOf(Statement statement, Resource resource);
51:
52: /**
53: * Delete reifications made by this resource. More technically, this method
54: * will remove the following patterns: <code><pre>
55: * (reificationResource) rdf:type rdf:Statement .
56: * (reificationResource) rdf:subject * .
57: * (reificationResource) rdf:predicate * .
58: * (reificationResource) rdf:object * .
59: * </pre></code>
60: * Note that one resource might have been used in several reifications.
61: * Although semantic nonsense, this can happen. This method cleans up also these cases.
62: * @param reificationResource
63: */
64: void deleteReification(Resource reificationResource);
65:
66: /**
67: * @param statement
68: * @return a collection which contains all resources that are a reification
69: * of the given statement.
70: */
71: Collection<Resource> getAllReificationsOf(Statement statement);
72:
73: /**
74: * @param stmt
75: * @return true if the model contains results to the query
76: * <code><pre>
77: * ?reificationResource rdf:type rdf:Statement .
78: * ?reificationResource rdf:subject ?s .
79: * ?reificationResource rdf:predicate ?p .
80: * ?reificationResource rdf:object ?o .
81: * </pre></code>
82: */
83: boolean hasReifications(Statement stmt);
84:
85: }
|