SELECT ?tool1 ?tool2 ?tool3 ?platform ?format4
WHERE {
    ?tool1 <realizesStep> <step1>.
    ?tool2 <realizesStep> <step2>.
    ?tool3 <realizesStep> <step3>.
    ?tool1 <usesPlatform> ?platform.
    ?tool2 <usesPlatform> ?platform.
    ?tool3 <usesPlatform> ?platform.
    ?requirements <allowPlatform> ?platform.
    ?requirements <inputFormat> ?format1.
    ?tool1 <supportsInputFormat> ?format1.
    ?tool1 <supportsOutputFormat> ?format2.
    ?tool2 <supportsInputFormat> ?format2.
    ?tool2 <supportsOutputFormat> ?format3.
    ?tool3 <supportsInputFormat> ?format3.
    ?tool3 <supportsOutputFormat> ?format4
    OPTIONAL {
        ?requirements <outputFormat> ?formatR.
        FILTER sameTerm(?format4, ?formatR)
    }
ORDER BY (!BOUND(?formatR))
Algorithm 1