Original query:

SELECT * FROM (SELECT * FROM (SELECT "0"."0$oid" AS "0$oid", "0"."0$cid" AS "0$cid", "0"."0$from_v" AS "0$from_v", "0"."0$deletionDate" AS "0$deletionDate", "0"."0$identifier" AS "0$identifier", "0"."0$isActive" AS "0$isActive", "0"."0$mergedInto" AS "0$mergedInto", "0"."0$state" AS "0$state", "0"."0$currentContact$oid" AS "0$currentContact$oid", "0"."0$currentContact$cid" AS "0$currentContact$cid", "0"."1$oid" AS "1$oid", "0"."1$cid" AS "1$cid", "0"."1$from_v" AS "1$from_v", "0"."1$chapter4LastUpdated" AS "1$chapter4LastUpdated", "0"."1$chronicIllnessState" AS "1$chronicIllnessState", "0"."1$consentLastUpdated" AS "1$consentLastUpdated", "0"."1$custodian" AS "1$custodian", "0"."1$dontAskForGhr" AS "1$dontAskForGhr", "0"."1$eidCardNumber" AS "1$eidCardNumber", "0"."1$eidLastUpdated" AS "1$eidLastUpdated", "0"."1$eidValidityEnd" AS "1$eidValidityEnd", "0"."1$employerBroNumber" AS "1$employerBroNumber", "0"."1$employerMedexId" AS "1$employerMedexId", "0"."1$entitledSsin" AS "1$entitledSsin", "0"."1$ghrLastUpdated" AS "1$ghrLastUpdated", "0"."1$gpPeriodicInvoicingSubscriptionDate" AS "1$gpPeriodicInvoicingSubscriptionDate", "0"."1$gpPeriodicInvoicingTerminationDate" AS "1$gpPeriodicInvoicingTerminationDate", "0"."1$healthInsuranceCapacity" AS "1$healthInsuranceCapacity", "0"."1$healthInsuranceFund" AS "1$healthInsuranceFund", "0"."1$healthInsuranceFundMemberId" AS "1$healthInsuranceFundMemberId", "0"."1$healthInsuranceType" AS "1$healthInsuranceType", "0"."1$identityPhoto" AS "1$identityPhoto", "0"."1$insurabilityLastUpdated" AS "1$insurabilityLastUpdated", "0"."1$isiCardNumber" AS "1$isiCardNumber", "0"."1$keepSumehrUpToDate" AS "1$keepSumehrUpToDate", "0"."1$kinePeriodicInvoicingSubscriptionDate" AS "1$kinePeriodicInvoicingSubscriptionDate", "0"."1$kinePeriodicInvoicingTerminationDate" AS "1$kinePeriodicInvoicingTerminationDate", "0"."1$medicalHouseContract" AS "1$medicalHouseContract", "0"."1$nursePeriodicInvoicingSubscriptionDate" AS "1$nursePeriodicInvoicingSubscriptionDate", "0"."1$nursePeriodicInvoicingTerminationDate" AS "1$nursePeriodicInvoicingTerminationDate", "0"."1$palliativeState" AS "1$palliativeState", "0"."1$patientConsentGiven" AS "1$patientConsentGiven", "0"."1$patientResidenceId" AS "1$patientResidenceId", "0"."1$patientWillBloodTransfusionRefusal" AS "1$patientWillBloodTransfusionRefusal", "0"."1$patientWillClinicalTrialParticipationConsent" AS "1$patientWillClinicalTrialParticipationConsent", "0"."1$patientWillDataReuseForClinicalResearchConsent" AS "1$patientWillDataReuseForClinicalResearchConsent", "0"."1$patientWillDataReuseForClinicalTrialsConsent" AS "1$patientWillDataReuseForClinicalTrialsConsent", "0"."1$patientWillEuthanasiaRequest" AS "1$patientWillEuthanasiaRequest", "0"."1$patientWillIntubationRefusal" AS "1$patientWillIntubationRefusal", "0"."1$patientWillNotToBeResuscitated" AS "1$patientWillNotToBeResuscitated", "0"."1$patientWillOrganDonationConsent" AS "1$patientWillOrganDonationConsent", "0"."1$patientWillVaccinationRefusal" AS "1$patientWillVaccinationRefusal", "0"."1$paymentByInsuranceFund" AS "1$paymentByInsuranceFund", "0"."1$pcswNumber" AS "1$pcswNumber", "0"."1$ssin" AS "1$ssin", "0"."1$vitalinkSumehrUri" AS "1$vitalinkSumehrUri", "0"."1$careRecord$oid" AS "1$careRecord$oid", "0"."1$careRecord$cid" AS "1$careRecord$cid", "1"."0$oid" AS "2$oid", "1"."0$cid" AS "2$cid", "1"."0$from_v" AS "2$from_v", "1"."0$aboBloodGroup" AS "2$aboBloodGroup", "1"."0$bloodGroupComment" AS "2$bloodGroupComment", "1"."0$externalCareRecordId" AS "2$externalCareRecordId", "1"."0$isPatient" AS "2$isPatient", "1"."0$responsibleCareAgentId" AS "2$responsibleCareAgentId", "1"."0$rhesusPositive" AS "2$rhesusPositive", "1"."0$careRecord$oid" AS "2$careRecord$oid", "1"."0$careRecord$cid" AS "2$careRecord$cid", "1"."0$patient$oid" AS "2$patient$oid", "1"."0$patient$cid" AS "2$patient$cid", "1"."1$oid" AS "3$oid", "1"."1$cid" AS "3$cid", "1"."1$from_v" AS "3$from_v", "1"."1$addressAs" AS "3$addressAs", "1"."1$birthDate" AS "3$birthDate", "1"."1$birthLocation" AS "3$birthLocation", "1"."1$comment" AS "3$comment", "1"."1$dateOfDeath" AS "3$dateOfDeath", "1"."1$firstName" AS "3$firstName", "1"."1$gender" AS "3$gender", "1"."1$isDeceased" AS "3$isDeceased", "1"."1$lastName" AS "3$lastName", "1"."1$maritalStatus" AS "3$maritalStatus", "1"."1$middleNames" AS "3$middleNames", "1"."1$nationality" AS "3$nationality", "1"."1$profession" AS "3$profession", "1"."1$title" AS "3$title" FROM (SELECT "0"."0$oid" AS "0$oid", "0"."0$cid" AS "0$cid", "0"."0$from_v" AS "0$from_v", "0"."0$deletionDate" AS "0$deletionDate", "0"."0$identifier" AS "0$identifier", "0"."0$isActive" AS "0$isActive", "0"."0$mergedInto" AS "0$mergedInto", "0"."0$state" AS "0$state", "0"."0$currentContact$oid" AS "0$currentContact$oid", "0"."0$currentContact$cid" AS "0$currentContact$cid", "1"."0$oid" AS "1$oid", "1"."0$cid" AS "1$cid", "1"."0$from_v" AS "1$from_v", "1"."0$chapter4LastUpdated" AS "1$chapter4LastUpdated", "1"."0$chronicIllnessState" AS "1$chronicIllnessState", "1"."0$consentLastUpdated" AS "1$consentLastUpdated", "1"."0$custodian" AS "1$custodian", "1"."0$dontAskForGhr" AS "1$dontAskForGhr", "1"."0$eidCardNumber" AS "1$eidCardNumber", "1"."0$eidLastUpdated" AS "1$eidLastUpdated", "1"."0$eidValidityEnd" AS "1$eidValidityEnd", "1"."0$employerBroNumber" AS "1$employerBroNumber", "1"."0$employerMedexId" AS "1$employerMedexId", "1"."0$entitledSsin" AS "1$entitledSsin", "1"."0$ghrLastUpdated" AS "1$ghrLastUpdated", "1"."0$gpPeriodicInvoicingSubscriptionDate" AS "1$gpPeriodicInvoicingSubscriptionDate", "1"."0$gpPeriodicInvoicingTerminationDate" AS "1$gpPeriodicInvoicingTerminationDate", "1"."0$healthInsuranceCapacity" AS "1$healthInsuranceCapacity", "1"."0$healthInsuranceFund" AS "1$healthInsuranceFund", "1"."0$healthInsuranceFundMemberId" AS "1$healthInsuranceFundMemberId", "1"."0$healthInsuranceType" AS "1$healthInsuranceType", "1"."0$identityPhoto" AS "1$identityPhoto", "1"."0$insurabilityLastUpdated" AS "1$insurabilityLastUpdated", "1"."0$isiCardNumber" AS "1$isiCardNumber", "1"."0$keepSumehrUpToDate" AS "1$keepSumehrUpToDate", "1"."0$kinePeriodicInvoicingSubscriptionDate" AS "1$kinePeriodicInvoicingSubscriptionDate", "1"."0$kinePeriodicInvoicingTerminationDate" AS "1$kinePeriodicInvoicingTerminationDate", "1"."0$medicalHouseContract" AS "1$medicalHouseContract", "1"."0$nursePeriodicInvoicingSubscriptionDate" AS "1$nursePeriodicInvoicingSubscriptionDate", "1"."0$nursePeriodicInvoicingTerminationDate" AS "1$nursePeriodicInvoicingTerminationDate", "1"."0$palliativeState" AS "1$palliativeState", "1"."0$patientConsentGiven" AS "1$patientConsentGiven", "1"."0$patientResidenceId" AS "1$patientResidenceId", "1"."0$patientWillBloodTransfusionRefusal" AS "1$patientWillBloodTransfusionRefusal", "1"."0$patientWillClinicalTrialParticipationConsent" AS "1$patientWillClinicalTrialParticipationConsent", "1"."0$patientWillDataReuseForClinicalResearchConsent" AS "1$patientWillDataReuseForClinicalResearchConsent", "1"."0$patientWillDataReuseForClinicalTrialsConsent" AS "1$patientWillDataReuseForClinicalTrialsConsent", "1"."0$patientWillEuthanasiaRequest" AS "1$patientWillEuthanasiaRequest", "1"."0$patientWillIntubationRefusal" AS "1$patientWillIntubationRefusal", "1"."0$patientWillNotToBeResuscitated" AS "1$patientWillNotToBeResuscitated", "1"."0$patientWillOrganDonationConsent" AS "1$patientWillOrganDonationConsent", "1"."0$patientWillVaccinationRefusal" AS "1$patientWillVaccinationRefusal", "1"."0$paymentByInsuranceFund" AS "1$paymentByInsuranceFund", "1"."0$pcswNumber" AS "1$pcswNumber", "1"."0$ssin" AS "1$ssin", "1"."0$vitalinkSumehrUri" AS "1$vitalinkSumehrUri", "1"."0$careRecord$oid" AS "1$careRecord$oid", "1"."0$careRecord$cid" AS "1$careRecord$cid" FROM (SELECT "0"."oid" AS "0$oid", "0"."cid" AS "0$cid", "0"."from_v" AS "0$from_v", "0"."deletionDate" AS "0$deletionDate", "0"."identifier" AS "0$identifier", "0"."isActive" AS "0$isActive", "0"."mergedInto" AS "0$mergedInto", "0"."state" AS "0$state", "0"."currentContact$oid" AS "0$currentContact$oid", "0"."currentContact$cid" AS "0$currentContact$cid" FROM "CareRecord" AS "0" WHERE ("to_v" IS NULL)) AS "0", (SELECT "0"."oid" AS "0$oid", "0"."cid" AS "0$cid", "0"."from_v" AS "0$from_v", "0"."chapter4LastUpdated" AS "0$chapter4LastUpdated", "0"."chronicIllnessState" AS "0$chronicIllnessState", "0"."consentLastUpdated" AS "0$consentLastUpdated", "0"."custodian" AS "0$custodian", "0"."dontAskForGhr" AS "0$dontAskForGhr", "0"."eidCardNumber" AS "0$eidCardNumber", "0"."eidLastUpdated" AS "0$eidLastUpdated", "0"."eidValidityEnd" AS "0$eidValidityEnd", "0"."employerBroNumber" AS "0$employerBroNumber", "0"."employerMedexId" AS "0$employerMedexId", "0"."entitledSsin" AS "0$entitledSsin", "0"."ghrLastUpdated" AS "0$ghrLastUpdated", "0"."gpPeriodicInvoicingSubscriptionDate" AS "0$gpPeriodicInvoicingSubscriptionDate", "0"."gpPeriodicInvoicingTerminationDate" AS "0$gpPeriodicInvoicingTerminationDate", "0"."healthInsuranceCapacity" AS "0$healthInsuranceCapacity", "0"."healthInsuranceFund" AS "0$healthInsuranceFund", "0"."healthInsuranceFundMemberId" AS "0$healthInsuranceFundMemberId", "0"."healthInsuranceType" AS "0$healthInsuranceType", "0"."identityPhoto" AS "0$identityPhoto", "0"."insurabilityLastUpdated" AS "0$insurabilityLastUpdated", "0"."isiCardNumber" AS "0$isiCardNumber", "0"."keepSumehrUpToDate" AS "0$keepSumehrUpToDate", "0"."kinePeriodicInvoicingSubscriptionDate" AS "0$kinePeriodicInvoicingSubscriptionDate", "0"."kinePeriodicInvoicingTerminationDate" AS "0$kinePeriodicInvoicingTerminationDate", "0"."medicalHouseContract" AS "0$medicalHouseContract", "0"."nursePeriodicInvoicingSubscriptionDate" AS "0$nursePeriodicInvoicingSubscriptionDate", "0"."nursePeriodicInvoicingTerminationDate" AS "0$nursePeriodicInvoicingTerminationDate", "0"."palliativeState" AS "0$palliativeState", "0"."patientConsentGiven" AS "0$patientConsentGiven", "0"."patientResidenceId" AS "0$patientResidenceId", "0"."patientWillBloodTransfusionRefusal" AS "0$patientWillBloodTransfusionRefusal", "0"."patientWillClinicalTrialParticipationConsent" AS "0$patientWillClinicalTrialParticipationConsent", "0"."patientWillDataReuseForClinicalResearchConsent" AS "0$patientWillDataReuseForClinicalResearchConsent", "0"."patientWillDataReuseForClinicalTrialsConsent" AS "0$patientWillDataReuseForClinicalTrialsConsent", "0"."patientWillEuthanasiaRequest" AS "0$patientWillEuthanasiaRequest", "0"."patientWillIntubationRefusal" AS "0$patientWillIntubationRefusal", "0"."patientWillNotToBeResuscitated" AS "0$patientWillNotToBeResuscitated", "0"."patientWillOrganDonationConsent" AS "0$patientWillOrganDonationConsent", "0"."patientWillVaccinationRefusal" AS "0$patientWillVaccinationRefusal", "0"."paymentByInsuranceFund" AS "0$paymentByInsuranceFund", "0"."pcswNumber" AS "0$pcswNumber", "0"."ssin" AS "0$ssin", "0"."vitalinkSumehrUri" AS "0$vitalinkSumehrUri", "0"."careRecord$oid" AS "0$careRecord$oid", "0"."careRecord$cid" AS "0$careRecord$cid" FROM "BelgianCareRecordExtension" AS "0" WHERE ("to_v" IS NULL)) AS "1" WHERE "1"."0$careRecord$oid" = "0"."0$oid") AS "0", (SELECT "0"."0$oid" AS "0$oid", "0"."0$cid" AS "0$cid", "0"."0$from_v" AS "0$from_v", "0"."0$aboBloodGroup" AS "0$aboBloodGroup", "0"."0$bloodGroupComment" AS "0$bloodGroupComment", "0"."0$externalCareRecordId" AS "0$externalCareRecordId", "0"."0$isPatient" AS "0$isPatient", "0"."0$responsibleCareAgentId" AS "0$responsibleCareAgentId", "0"."0$rhesusPositive" AS "0$rhesusPositive", "0"."0$careRecord$oid" AS "0$careRecord$oid", "0"."0$careRecord$cid" AS "0$careRecord$cid", "0"."0$patient$oid" AS "0$patient$oid", "0"."0$patient$cid" AS "0$patient$cid", "1"."0$oid" AS "1$oid", "1"."0$cid" AS "1$cid", "1"."0$from_v" AS "1$from_v", "1"."0$addressAs" AS "1$addressAs", "1"."0$birthDate" AS "1$birthDate", "1"."0$birthLocation" AS "1$birthLocation", "1"."0$comment" AS "1$comment", "1"."0$dateOfDeath" AS "1$dateOfDeath", "1"."0$firstName" AS "1$firstName", "1"."0$gender" AS "1$gender", "1"."0$isDeceased" AS "1$isDeceased", "1"."0$lastName" AS "1$lastName", "1"."0$maritalStatus" AS "1$maritalStatus", "1"."0$middleNames" AS "1$middleNames", "1"."0$nationality" AS "1$nationality", "1"."0$profession" AS "1$profession", "1"."0$title" AS "1$title" FROM (SELECT "0"."oid" AS "0$oid", "0"."cid" AS "0$cid", "0"."from_v" AS "0$from_v", "0"."aboBloodGroup" AS "0$aboBloodGroup", "0"."bloodGroupComment" AS "0$bloodGroupComment", "0"."externalCareRecordId" AS "0$externalCareRecordId", "0"."isPatient" AS "0$isPatient", "0"."responsibleCareAgentId" AS "0$responsibleCareAgentId", "0"."rhesusPositive" AS "0$rhesusPositive", "0"."careRecord$oid" AS "0$careRecord$oid", "0"."careRecord$cid" AS "0$careRecord$cid", "0"."patient$oid" AS "0$patient$oid", "0"."patient$cid" AS "0$patient$cid" FROM "MedicalCareRecordExtension" AS "0" WHERE ("to_v" IS NULL)) AS "0", (SELECT "0"."oid" AS "0$oid", "0"."cid" AS "0$cid", "0"."from_v" AS "0$from_v", "0"."addressAs" AS "0$addressAs", "0"."birthDate" AS "0$birthDate", "0"."birthLocation" AS "0$birthLocation", "0"."comment" AS "0$comment", "0"."dateOfDeath" AS "0$dateOfDeath", "0"."firstName" AS "0$firstName", "0"."gender" AS "0$gender", "0"."isDeceased" AS "0$isDeceased", "0"."lastName" AS "0$lastName", "0"."maritalStatus" AS "0$maritalStatus", "0"."middleNames" AS "0$middleNames", "0"."nationality" AS "0$nationality", "0"."profession" AS "0$profession", "0"."title" AS "0$title" FROM "Person" AS "0" WHERE ("to_v" IS NULL)) AS "1" WHERE "0"."0$patient$oid" = "1"."0$oid") AS "1" WHERE "1"."0$careRecord$oid" = "0"."0$oid") AS "0" WHERE (((EXISTS (SELECT * FROM (SELECT "1_0"."oid" AS "1_0$oid", "1_0"."cid" AS "1_0$cid", "1_0"."from_v" AS "1_0$from_v", "1_0"."active" AS "1_0$active", "1_0"."confidential" AS "1_0$confidential", "1_0"."factClassification" AS "1_0$factClassification", "1_0"."factCode" AS "1_0$factCode", "1_0"."hypothesis" AS "1_0$hypothesis", "1_0"."identifier" AS "1_0$identifier", "1_0"."negative" AS "1_0$negative", "1_0"."relevant" AS "1_0$relevant", "1_0"."valueInterval$startNof" AS "1_0$valueInterval$startNof", "1_0"."valueInterval$startDate" AS "1_0$valueInterval$startDate", "1_0"."valueInterval$startTime" AS "1_0$valueInterval$startTime", "1_0"."valueInterval$endNof" AS "1_0$valueInterval$endNof", "1_0"."valueInterval$endDate" AS "1_0$valueInterval$endDate", "1_0"."valueInterval$endTime" AS "1_0$valueInterval$endTime" FROM "CodedFactService" AS "1_0" WHERE ("to_v" IS NULL)) AS "1_0" WHERE (("1_0"."1_0$oid" BETWEEN "0"."0$oid" / 1099511627776 * 1099511627776 AND ("0"."0$oid" / 1099511627776 + 1) * 1099511627776 - 1)) AND (((EXISTS (SELECT "2_0"."2_0$oid" AS "2_0$oid", "2_0"."2_0$cid" AS "2_0$cid", "2_0"."2_0$from_v" AS "2_0$from_v", "2_0"."2_0$kindIdentifier" AS "2_0$kindIdentifier", "2_0"."2_0$subcontact$oid" AS "2_0$subcontact$oid", "2_0"."2_0$subcontact$cid" AS "2_0$subcontact$cid", "2_1"."2_0$oid" AS "2_1$oid", "2_1"."2_0$cid" AS "2_1$cid", "2_1"."2_0$from_v" AS "2_1$from_v", "2_1"."2_0$multiplicity" AS "2_1$multiplicity", "2_1"."2_0$internalService$oid" AS "2_1$internalService$oid", "2_1"."2_0$internalService$cid" AS "2_1$internalService$cid", "2_1"."2_0$topLevelService$oid" AS "2_1$topLevelService$oid", "2_1"."2_0$topLevelService$cid" AS "2_1$topLevelService$cid" FROM (SELECT "2_0"."oid" AS "2_0$oid", "2_0"."cid" AS "2_0$cid", "2_0"."from_v" AS "2_0$from_v", "2_0"."kindIdentifier" AS "2_0$kindIdentifier", "2_0"."subcontact$oid" AS "2_0$subcontact$oid", "2_0"."subcontact$cid" AS "2_0$subcontact$cid" FROM "TopLevelService" AS "2_0" WHERE ("to_v" IS NULL)) AS "2_0", (SELECT "2_0"."oid" AS "2_0$oid", "2_0"."cid" AS "2_0$cid", "2_0"."from_v" AS "2_0$from_v", "2_0"."multiplicity" AS "2_0$multiplicity", "2_0"."internalService$oid" AS "2_0$internalService$oid", "2_0"."internalService$cid" AS "2_0$internalService$cid", "2_0"."topLevelService$oid" AS "2_0$topLevelService$oid", "2_0"."topLevelService$cid" AS "2_0$topLevelService$cid" FROM "ServiceToTopLevelServiceLink" AS "2_0" WHERE ("to_v" IS NULL)) AS "2_1" WHERE (("2_1"."2_0$topLevelService$oid" = "2_0"."2_0$oid") AND ("2_1"."2_0$internalService$oid" = "1_0"."1_0$oid")) AND ((("2_0"."2_0$kindIdentifier") = (E'analysis'))))) AND ((("1_0"."1_0$negative") = ($1)))) AND ((("1_0"."1_0$hypothesis") = ($2)))))) OR (EXISTS (SELECT * FROM (SELECT "1_0"."oid" AS "1_0$oid", "1_0"."cid" AS "1_0$cid", "1_0"."from_v" AS "1_0$from_v", "1_0"."confidential" AS "1_0$confidential", "1_0"."identifier" AS "1_0$identifier", "1_0"."text" AS "1_0$text", "1_0"."valueInterval$startNof" AS "1_0$valueInterval$startNof", "1_0"."valueInterval$startDate" AS "1_0$valueInterval$startDate", "1_0"."valueInterval$startTime" AS "1_0$valueInterval$startTime", "1_0"."valueInterval$endNof" AS "1_0$valueInterval$endNof", "1_0"."valueInterval$endDate" AS "1_0$valueInterval$endDate", "1_0"."valueInterval$endTime" AS "1_0$valueInterval$endTime" FROM "FreeTextService" AS "1_0" WHERE ("to_v" IS NULL)) AS "1_0" WHERE (("1_0"."1_0$oid" BETWEEN "0"."0$oid" / 1099511627776 * 1099511627776 AND ("0"."0$oid" / 1099511627776 + 1) * 1099511627776 - 1)) AND (EXISTS (SELECT "2_0"."2_0$oid" AS "2_0$oid", "2_0"."2_0$cid" AS "2_0$cid", "2_0"."2_0$from_v" AS "2_0$from_v", "2_0"."2_0$kindIdentifier" AS "2_0$kindIdentifier", "2_0"."2_0$subcontact$oid" AS "2_0$subcontact$oid", "2_0"."2_0$subcontact$cid" AS "2_0$subcontact$cid", "2_1"."2_0$oid" AS "2_1$oid", "2_1"."2_0$cid" AS "2_1$cid", "2_1"."2_0$from_v" AS "2_1$from_v", "2_1"."2_0$multiplicity" AS "2_1$multiplicity", "2_1"."2_0$internalService$oid" AS "2_1$internalService$oid", "2_1"."2_0$internalService$cid" AS "2_1$internalService$cid", "2_1"."2_0$topLevelService$oid" AS "2_1$topLevelService$oid", "2_1"."2_0$topLevelService$cid" AS "2_1$topLevelService$cid" FROM (SELECT "2_0"."oid" AS "2_0$oid", "2_0"."cid" AS "2_0$cid", "2_0"."from_v" AS "2_0$from_v", "2_0"."kindIdentifier" AS "2_0$kindIdentifier", "2_0"."subcontact$oid" AS "2_0$subcontact$oid", "2_0"."subcontact$cid" AS "2_0$subcontact$cid" FROM "TopLevelService" AS "2_0" WHERE ("to_v" IS NULL)) AS "2_0", (SELECT "2_0"."oid" AS "2_0$oid", "2_0"."cid" AS "2_0$cid", "2_0"."from_v" AS "2_0$from_v", "2_0"."multiplicity" AS "2_0$multiplicity", "2_0"."internalService$oid" AS "2_0$internalService$oid", "2_0"."internalService$cid" AS "2_0$internalService$cid", "2_0"."topLevelService$oid" AS "2_0$topLevelService$oid", "2_0"."topLevelService$cid" AS "2_0$topLevelService$cid" FROM "ServiceToTopLevelServiceLink" AS "2_0" WHERE ("to_v" IS NULL)) AS "2_1" WHERE (("2_1"."2_0$topLevelService$oid" = "2_0"."2_0$oid") AND ("2_1"."2_0$internalService$oid" = "1_0"."1_0$oid")) AND ((("2_0"."2_0$kindIdentifier") = (E'analysis')))))))) OR (EXISTS (SELECT * FROM (SELECT "1_0"."oid" AS "1_0$oid", "1_0"."cid" AS "1_0$cid", "1_0"."from_v" AS "1_0$from_v", "1_0"."factClassification" AS "1_0$factClassification", "1_0"."factCode" AS "1_0$factCode", "1_0"."factServiceType" AS "1_0$factServiceType", "1_0"."hypothesis" AS "1_0$hypothesis", "1_0"."manualLabel" AS "1_0$manualLabel", "1_0"."negative" AS "1_0$negative" FROM "CareElement" AS "1_0" WHERE ("to_v" IS NULL)) AS "1_0" WHERE (("1_0"."1_0$oid" BETWEEN "0"."0$oid" / 1099511627776 * 1099511627776 AND ("0"."0$oid" / 1099511627776 + 1) * 1099511627776 - 1)) AND ((($3) = ($4)))))) OR (EXISTS (SELECT * FROM (SELECT "1_0"."oid" AS "1_0$oid", "1_0"."cid" AS "1_0$cid", "1_0"."from_v" AS "1_0$from_v", "1_0"."active" AS "1_0$active", "1_0"."confidential" AS "1_0$confidential", "1_0"."hypothesis" AS "1_0$hypothesis", "1_0"."identifier" AS "1_0$identifier", "1_0"."negative" AS "1_0$negative", "1_0"."relevant" AS "1_0$relevant", "1_0"."serviceType" AS "1_0$serviceType", "1_0"."valueInterval$startNof" AS "1_0$valueInterval$startNof", "1_0"."valueInterval$startDate" AS "1_0$valueInterval$startDate", "1_0"."valueInterval$startTime" AS "1_0$valueInterval$startTime", "1_0"."valueInterval$endNof" AS "1_0$valueInterval$endNof", "1_0"."valueInterval$endDate" AS "1_0$valueInterval$endDate", "1_0"."valueInterval$endTime" AS "1_0$valueInterval$endTime" FROM "InstanceFactService" AS "1_0" WHERE ("to_v" IS NULL)) AS "1_0" WHERE (("1_0"."1_0$oid" BETWEEN "0"."0$oid" / 1099511627776 * 1099511627776 AND ("0"."0$oid" / 1099511627776 + 1) * 1099511627776 - 1)) AND (((((("1_0"."1_0$serviceType") IS NOT DISTINCT FROM (NULL))) AND (EXISTS (SELECT "2_0"."2_0$oid" AS "2_0$oid", "2_0"."2_0$cid" AS "2_0$cid", "2_0"."2_0$from_v" AS "2_0$from_v", "2_0"."2_0$kindIdentifier" AS "2_0$kindIdentifier", "2_0"."2_0$subcontact$oid" AS "2_0$subcontact$oid", "2_0"."2_0$subcontact$cid" AS "2_0$subcontact$cid", "2_1"."2_0$oid" AS "2_1$oid", "2_1"."2_0$cid" AS "2_1$cid", "2_1"."2_0$from_v" AS "2_1$from_v", "2_1"."2_0$multiplicity" AS "2_1$multiplicity", "2_1"."2_0$internalService$oid" AS "2_1$internalService$oid", "2_1"."2_0$internalService$cid" AS "2_1$internalService$cid", "2_1"."2_0$topLevelService$oid" AS "2_1$topLevelService$oid", "2_1"."2_0$topLevelService$cid" AS "2_1$topLevelService$cid" FROM (SELECT "2_0"."oid" AS "2_0$oid", "2_0"."cid" AS "2_0$cid", "2_0"."from_v" AS "2_0$from_v", "2_0"."kindIdentifier" AS "2_0$kindIdentifier", "2_0"."subcontact$oid" AS "2_0$subcontact$oid", "2_0"."subcontact$cid" AS "2_0$subcontact$cid" FROM "TopLevelService" AS "2_0" WHERE ("to_v" IS NULL)) AS "2_0", (SELECT "2_0"."oid" AS "2_0$oid", "2_0"."cid" AS "2_0$cid", "2_0"."from_v" AS "2_0$from_v", "2_0"."multiplicity" AS "2_0$multiplicity", "2_0"."internalService$oid" AS "2_0$internalService$oid", "2_0"."internalService$cid" AS "2_0$internalService$cid", "2_0"."topLevelService$oid" AS "2_0$topLevelService$oid", "2_0"."topLevelService$cid" AS "2_0$topLevelService$cid" FROM "ServiceToTopLevelServiceLink" AS "2_0" WHERE ("to_v" IS NULL)) AS "2_1" WHERE (("2_1"."2_0$topLevelService$oid" = "2_0"."2_0$oid") AND ("2_1"."2_0$internalService$oid" = "1_0"."1_0$oid")) AND ((("2_0"."2_0$kindIdentifier") = (E'analysis')))))) AND ((("1_0"."1_0$negative") = ($5)))) AND ((("1_0"."1_0$hypothesis") = ($6))))))) AS "0" WHERE ((("0"."0$isActive") = ($7))) AND ((("0"."0$state") = ($8)))