Parser/QueryParser.cpp
void QueryParser::replacePrefix(string &str)
{
	if (str[0] != '<' && str[0] != '\"' && str[0] != '?')
	{
		int sep = str.find(":");
		if (sep == -1)	return;

		string prefix = str.substr(0, sep + 1);

		//blank node
		if (prefix == "_:")	return;

		printf("prefix = %s\n", prefix.c_str());
		if (this->prefix_map.count(prefix) != 0)
		{
			str = this->prefix_map[prefix].substr(0, this->prefix_map[prefix].length() - 1) + str.substr(sep + 1 ,str.length() - sep - 1) + ">";
			printf("str = %s\n",str.c_str());
		}
		else
		{
			printf("prefix not found...\n");
			throw runtime_error("[ERROR]	Prefix is not found, please define it before use.");
		}
	}
}
/**
	Helper function that replaces prefixes in triples with their corresponding IRIs.

	@param str a subject/predicate/object that may contain a prefix.
*/
Helper function that replaces prefixes in triples with their corresponding IRIs.
Helper function that replaces prefixes in triples with their corresponding IRIs .
void QueryParser::replacePrefix(string &str)
{
	if (str[0] != '<' && str[0] != '\"' && str[0] != '?')
	{
		int sep = str.find(":");
		if (sep == -1)	return;
		string prefix = str.substr(0, sep + 1);
		if (prefix == "_:")	return;
		printf("prefix = %s\n", prefix.c_str());
		if (this->prefix_map.count(prefix) != 0)
		{
			str = this->prefix_map[prefix].substr(0, this->prefix_map[prefix].length() - 1) + str.substr(sep + 1 ,str.length() - sep - 1) + ">";
			printf("str = %s\n",str.c_str());
		}
		else
		{
			printf("prefix not found...\n");
			throw runtime_error("[ERROR]	Prefix is not found, please define it before use.");
		}
	}
}
void QueryParser :: replacePrefix ( string & str ) { if ( str [ 0 ] != ' ' && str [ 0 ] != ' \" ' && str [ 0 ] != ' ' ) { int sep = str . find ( " " ) ; if ( sep == -1 ) return ; string prefix = str . substr ( 0 , sep + 1 ) ; if ( prefix == " " ) return ; printf ( " \n " , prefix . c_str ( ) ) ; if ( this -> prefix_map . count ( prefix ) != 0 ) { str = this -> prefix_map [ prefix ] . substr ( 0 , this -> prefix_map [ prefix ] . length ( ) - 1 ) + str . substr ( sep + 1 , str . length ( ) - sep - 1 ) + " " ; printf ( " \n " , str . c_str ( ) ) ; } else { printf ( " \n " ) ; throw runtime_error ( " " ) ; } } }
Helper function that replaces prefixes in triples with their corresponding IRIs.
Helper function that replaces prefixes in triples with their corresponding IRIs .
//blank node