Skip to contentMethod: visit(DataParticipationConstraint)
1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.owl2java;
16:
17: import org.semanticweb.owlapi.model.OWLDataFactory;
18: import org.semanticweb.owlapi.reasoner.OWLReasoner;
19:
20: import cz.cvut.kbss.jopa.model.ic.DataDomainConstraint;
21: import cz.cvut.kbss.jopa.model.ic.DataParticipationConstraint;
22: import cz.cvut.kbss.jopa.model.ic.DataRangeConstraint;
23: import cz.cvut.kbss.jopa.model.ic.IntegrityConstraintVisitor;
24: import cz.cvut.kbss.jopa.model.ic.ObjectDomainConstraint;
25: import cz.cvut.kbss.jopa.model.ic.ObjectParticipationConstraint;
26: import cz.cvut.kbss.jopa.model.ic.ObjectRangeConstraint;
27:
28: public class ICSatisfiabilityChecker implements IntegrityConstraintVisitor {
29:
30:         private OWLReasoner r;
31:         private OWLDataFactory f;
32:
33:         private boolean result;
34:
35:         public ICSatisfiabilityChecker(final OWLReasoner r, final OWLDataFactory f) {
36:                 this.f = f;
37:                 this.r = r;
38:         }
39:
40:         public void visit(DataParticipationConstraint cpc) {
41:                 result = r.isSatisfiable(f.getOWLObjectIntersectionOf(cpc.getSubject(),
42:                                 f.getOWLDataMaxCardinality(cpc.getMax(), cpc.getPredicate(),
43:                                                 cpc.getObject()), f.getOWLDataMinCardinality(cpc
44:                                                 .getMin(), cpc.getPredicate())));
45:         }
46:
47:         public void visit(ObjectParticipationConstraint cpc) {
48:                 result = r.isSatisfiable(f.getOWLObjectIntersectionOf(cpc.getSubject(),
49:                                 f.getOWLObjectMaxCardinality(cpc.getMax(), cpc.getPredicate(),
50:                                                 cpc.getObject()), f.getOWLObjectMinCardinality(cpc
51:                                                 .getMin(), cpc.getPredicate())));
52:         }
53:
54:         public boolean getResult() {
55:                 return result;
56:         }
57:
58:         public void visit(ObjectDomainConstraint cpc) {
59:                 // TODO Auto-generated method stub
60:                 
61:         }
62:
63:         public void visit(ObjectRangeConstraint cpc) {
64:                 // TODO Auto-generated method stub
65:                 
66:         }
67:
68:         public void visit(DataDomainConstraint cpc) {
69:                 // TODO Auto-generated method stub
70:                 
71:         }
72:
73:         public void visit(DataRangeConstraint cpc) {
74:                 // TODO Auto-generated method stub
75:                 
76:         }
77: }