Debian Codegraph @

Source/Reasoner/Kernel/Algorithm/COccurrenceStatisticsCacheHandler.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "COccurrenceStatisticsCacheHandler.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Algorithm {
31
32 COccurrenceStatisticsCacheHandler::COccurrenceStatisticsCacheHandler(COccurrenceStatisticsCacheWriter* occStatsCacheWriter) {
33 mOccStatsCacheWriter = occStatsCacheWriter;
34 mOntologyId = -1;
35 mOntology = nullptr;
36 }
37
38 COccurrenceStatisticsCacheHandler* COccurrenceStatisticsCacheHandler::configureOntology(CConcreteOntology* ontology) {
39 mOntologyId = ontology->getOntologyID();
40 mOntology = ontology;
41 return this;
42 }
43
44 COccurrenceStatisticsCacheHandler* COccurrenceStatisticsCacheHandler::incConceptInstanceOccurrencceStatistics(CConcept* concept, bool nondeterministic, bool existential) {
45 cint64 deterministicCount = 0, nondeterministicCount = 0, individualCount = 0, existentialCount = 0;
46 if (nondeterministic) {
47 nondeterministicCount = 1;
48 } else {
49 deterministicCount = 1;
50 }
51 if (existential) {
52 existentialCount = 1;
53 } else {
54 individualCount = 1;
55 }
56 incConceptInstanceOccurrencceStatistics(concept, deterministicCount, nondeterministicCount, individualCount, existentialCount);
57 return this;
58 }
59
60 COccurrenceStatisticsCacheHandler* COccurrenceStatisticsCacheHandler::incRoleInstanceOccurrencceStatistics(CRole* role, bool nondeterministic, bool existential, bool newOutgoing) {
61 cint64 deterministicCount = 0, nondeterministicCount = 0, individualCount = 0, existentialCount = 0, outgoingCount = 0, incomingCount = 0;
62 if (nondeterministic) {
63 nondeterministicCount = 1;
64 } else {
65 deterministicCount = 1;
66 }
67 if (existential) {
68 existentialCount = 1;
69 } else {
70 individualCount = 1;
71 }
72 if (newOutgoing) {
73 outgoingCount = 1;
74 }
75 incRoleInstanceOccurrencceStatistics(role, deterministicCount, nondeterministicCount, individualCount, existentialCount, outgoingCount, incomingCount);
76 return this;
77 }
78
79
80 COccurrenceStatisticsCacheHandler* COccurrenceStatisticsCacheHandler::incConceptInstanceOccurrencceStatistics(CConcept* concept, cint64 deterministicCount, cint64 nondeterministicCount, cint64 individualCount, cint64 existentialCount) {
81 mOccStatsCacheWriter->incConceptInstanceOccurrencceStatistics(mOntology, concept->getConceptTag(), deterministicCount, nondeterministicCount, individualCount, existentialCount);
82 return this;
83 }
84
85 COccurrenceStatisticsCacheHandler* COccurrenceStatisticsCacheHandler::incRoleInstanceOccurrencceStatistics(CRole* role, cint64 deterministicCount, cint64 nondeterministicCount, cint64 individualCount, cint64 existentialCount, cint64 outgoingCount, cint64 incomingCount) {
86 mOccStatsCacheWriter->incRoleInstanceOccurrencceStatistics(mOntology, role->getRoleTag(), deterministicCount, nondeterministicCount, individualCount, existentialCount, outgoingCount, incomingCount);
87 return this;
88 }
89
90 }; // end namespace Algorithm
91
92 }; // end namespace Kernel
93
94 }; // end namespace Reasoner
95
96 }; // end namespace Konclude