VirtuosoException: SQ199

Did a bit digging and we have at least 3 select queries that have the same problem and the reason is that there is a case the where clause has 6000 ids :frowning: so I guess it is normal!
Just an idea of the query:

Summary
"SPARQL "
PREFIX torr: " + "<" + Ontology.ns + ">" + "\n"
PREFIX owl: " + "<" + Ontology.owlPrefix + ">" + "\n"
+ "PREFIX rdf: " + "<" + Ontology.rdfPrefix + ">" + "\n"
+ "PREFIX res: " + "<" + Ontology.instancePrefix + "Project/>" + "\n"
+ "SELECT DISTINCT ?projectId ?projectName ?projectProgram ?projectAcronym ?projectAbstract 
+ "(group_concat(DISTINCT ?firstTopicInfo; separator=\",\") as ?firstTopics) "
+ "(group_concat(DISTINCT ?highTopicInfo; separator=\",\") as ?highTopics) "
+ "from <" + Ontology.torrPrefix + ">" + "\n"
+ " WHERE {" + "\n"
+ "  ?project torr:projectId ?projectId ." + "\n"
+ "{" + "\n"
+ "{ SELECT ?project" + "\n"
+ " WHERE {" + "\n"
+ " VALUES ?project {res:222983 res:304963 res:241683 res:241955 res:223156 res:223445 res:600847 res:603121 res:242013 res:200234 res:304884 res:212281 res:223243 res:305207 res:304900 res:201804 res:278981 res:248294} }" + "\n"
+ "}
+ "
+ "			OPTIONAL {?project torr:projectName ?projectName }." + "\n"
+ "			OPTIONAL {?project torr:projectProgram ?projectProgram }." + "\n"
+ "			OPTIONAL {?project torr:projectAcronym ?projectAcronym }." + "\n"
+ "			OPTIONAL {?project torr:projectAbstract ?projectAbstract }." + "\n"
+ "			OPTIONAL { {?project torr:belongsToFirstTopic ?topic }." + "\n"
+ "						{?topic torr:topicFosId ?topicFosId }." + "\n"
+ "						{?topic torr:topicFosName ?topicFosName } }." + "\n"
+ "			OPTIONAL { {?project torr:belongsToHighTopic ?hightopic }.\n"
+ "					 {?hightopic torr:topicFosId ?hightopicFosId }.\n"
+ "					 {?hightopic torr:topicFosName ?hightopicFosName } }." + "\n"
+ "		 bind ( COALESCE(?hightopicFosName, \"\") As ?hightopicFosNameB)" + "\n"
+ "		 bind ( COALESCE(?hightopicFosId, \"\") As ?hightopicFosIdB)" + "\n"
+ "		 bind ( COALESCE(?topicFosName, \"\") As ?topicFosNameB)" + "\n"
+ "		 bind ( COALESCE(?topicFosId, \"\") As ?topicFosIdB)" + "\n"
+ "		 BIND (CONCAT('{ \"topicName\":', '\"', ?topicFosNameB, '\"', ', \"topicId\":', '\"', ?topicFosIdB, '\"',\" }\") AS ?firstTopicInfo)." + "\n"
+ "		 BIND (CONCAT('{ \"topicName\":', '\"', ?hightopicFosNameB, '\"', ', \"topicId\":', '\"', ?hightopicFosIdB, '\"',\" }\") AS ?highTopicInfo)" + "\n"
+ " } order by ?projectId";