42 ARMOR_ERR(
"in connecting and loading the ontology. " );
56 if( classname ==
"HYPOTHESIS" )
58 if( this->GetPositionOf( indivname, DiscardHypotheses ) != DiscardHypotheses.end( ) )
63 if( !this->TrackIndiv( indivname ) )
return false;
66 if( !this->
SendCommand(
"ADD",
"IND",
"CLASS", indivname, classname ) )
70 if( makeDisjoint ) DisjointAllIndiv( indivname );
84 if( !this->
SendCommand(
"QUERY",
"CLASS",
"IND", indivname,
SS( deep?
"true" :
"false" ) ) )
86 ARMOR_ERR(
"unable to find the classes of the individual " << indivname );
87 return std::vector<std::string>();
99 if( !this->
SendCommand(
"QUERY",
"IND",
"CLASS", classname ) )
101 ARMOR_ERR(
"unable to find the individuals inside the class " << classname );
102 return std::vector<std::string>();
114 this->
SendCommand(
"QUERY",
"IND",
"", indivname );
119 if( this->GetPositionOf( indivname, DiscardHypotheses ) != DiscardHypotheses.end( ) )
134 if( !ExistsItem( Aelem, individuals ) || !ExistsItem( Belem, individuals ) )
138 if( !this->
SendCommand(
"ADD",
"OBJECTPROP",
"IND", prop, Aelem, Belem ) )
140 ARMOR_ERR(
"unable to set the property " <<
"(" << Aelem <<
", " << Belem <<
"):" << prop );
152 if( !this->
SendCommand(
"QUERY",
"OBJECTPROP",
"IND", prop, indivname ) )
154 ARMOR_ERR(
"unable to find the values of the property " << prop <<
" related to the individual " << indivname );
155 return std::vector<std::string>();
171 for(
auto it = DiscardHypotheses.begin() ; it != DiscardHypotheses.end(); ++it )
173 auto pos = this->GetPositionOf( *it, temp );
174 if( pos != temp.end( ) )
208 DiscardHypotheses.push_back( hypTag );
211 auto pos = this->GetPositionOf( hypTag, individuals );
212 if( pos != individuals.end( ) )
214 individuals.erase( pos );
226 if( ( pos = raw.find(
"#" ) ) == std::string::npos )
229 return raw.substr( pos+1, raw.length()-pos-2 );
237 std::vector<std::string> returnlist;
240 for( std::string item : itemlist )
249 bool ArmorCluedo::ExistsItem( std::string item,
const std::vector<std::string>& container )
251 for( std::string s : container )
252 if( s == item )
return true;
260 bool ArmorCluedo::TrackIndiv( std::string indivname )
263 if( ExistsItem( indivname, this->individuals ) )
270 this->individuals.push_back( indivname );
278 void ArmorCluedo::DisjointAllIndiv( std::string from =
"" )
283 for( std::string s : this->individuals )
284 this->DisjointAllIndiv( s );
289 for( std::string s : this->individuals )
291 this->
SendCommand(
"DISJOINT",
"IND",
"", s, from );
299 std::vector<std::string>::iterator ArmorCluedo::GetPositionOf( std::string tag, std::vector<std::string>& list )
302 for(
auto it = list.begin(); it != list.end( ); ++it )
304 if( *it == tag )
return it;