112 static auto fullyConfident = std::make_shared<Double>(1.0);
114 static auto b_var = std::make_shared<Variable>(
"_reified_b");
115 static auto e_var = std::make_shared<Variable>(
"_reified_e");
117 if (!nonReified.propertyTerm() || !nonReified.propertyTerm()->isAtom()) {
118 throw QueryError(
"non-reified triple does not have a property term");
120 auto seq = std::make_shared<GraphSequence>();
121 auto p_atom = std::static_pointer_cast<Atom>(nonReified.propertyTerm());
122 auto property =
vocabulary_->defineProperty(p_atom->stringForm());
124 auto relationType =
property->reification();
127 auto name = std::make_shared<Variable>(
"_reified" + std::to_string(
varCounter_++));
129 auto &g = nonReified.graphTerm();
138 std::shared_ptr<TriplePattern> objectQuery;
139 if (property->isObjectProperty()) {
144 objectQuery->setObjectOperator(nonReified.objectOperator());
147 bool includeOnlyCertain;
148 if (nonReified.isUncertainTerm().has_grounding() && nonReified.isUncertainTerm().grounded()->asBoolean()) {
151 x->setIsOptional(
true);
153 includeOnlyCertain =
false;
154 }
else if (nonReified.isUncertainTerm().has_variable()) {
156 x->setIsOptional(
true);
157 includeOnlyCertain =
false;
160 x->setIsOptional(
true);
161 includeOnlyCertain =
true;
164 if (nonReified.confidenceTerm().has_grounding()) {
167 x->setIsOptional(
true);
168 }
else if (nonReified.confidenceTerm().has_variable()) {
170 x->setIsOptional(
true);
171 }
else if (includeOnlyCertain) {
174 x->setIsOptional(
true);
177 if (nonReified.perspectiveTerm().has_grounding()) {
180 x->setIsOptional(
true);
184 }
else if (nonReified.perspectiveTerm().has_variable()) {
186 x->setIsOptional(
true);
189 x->setIsOptional(
true);
192 bool includeOccasional;
193 if (nonReified.isOccasionalTerm().has_grounding() && nonReified.isOccasionalTerm().grounded()->asBoolean()) {
196 x->setIsOptional(
true);
198 includeOccasional =
true;
199 }
else if (nonReified.isOccasionalTerm().has_variable()) {
201 x->setIsOptional(
true);
202 includeOccasional =
true;
205 x->setIsOptional(
true);
206 includeOccasional =
false;
209 if (nonReified.beginTerm().has_grounding()) {
210 if (includeOccasional) {
213 x->setIsOptional(
true);
217 x->setIsOptional(
true);
219 }
else if (nonReified.beginTerm().has_variable()) {
221 x->setIsOptional(
true);
224 x->setIsNegated(
true);
227 if (nonReified.endTerm().has_grounding()) {
228 if (includeOccasional) {
231 x->setIsOptional(
true);
235 x->setIsOptional(
true);
237 }
else if (nonReified.endTerm().has_variable()) {
239 x->setIsOptional(
true);
242 x->setIsNegated(
true);
std::shared_ptr< TriplePattern > addPattern(const std::shared_ptr< GraphSequence > &sequence, const TermPtr &s, const TermPtr &p, const TermPtr &o, const groundable< Atom > &g)
static std::shared_ptr< Numeric > trueAtom()
static std::shared_ptr< Numeric > falseAtom()
static std::shared_ptr< Perspective > getEgoPerspective()
const IRIAtomPtr hasSubject
const IRIAtomPtr isUncertain
const IRIAtomPtr hasConfidence
const IRIAtomPtr isOccasional
const IRIAtomPtr hasEndTime
const IRIAtomPtr hasLiteral
const IRIAtomPtr hasBeginTime
const IRIAtomPtr hasPerspective
const IRIAtomPtr hasObject