@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf4j: <http://rdf4j.org/schema/rdf4j#> .
@prefix sesame: <http://www.openrdf.org/schema/sesame#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .

<http://purl.uniprot.org/unirules/MF_01251#construct> a <http://www.w3.org/ns/shacl#SPARQLRule>,
    <http://spinrdf.org/sp#Construct>;
  <https://hamap.expasy.org/rdf/vocab#addsTriple> <http://purl.uniprot.org/unirules/MF_01251#construct-template-16>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-21>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-39>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-15>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-38>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-11>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-9>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-14>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-1>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-17>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-10>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-13>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-37>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-3>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-12>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-36>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-2>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-35>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-59>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-34>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-58>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-33>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-57>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-23>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-5>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-24>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-18>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-19>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-4>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-7>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-8>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-6>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-20>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-44>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-43>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-22>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-42>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-41>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-40>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-0>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-61>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-60>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-28>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-27>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-26>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-49>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-25>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-48>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-47>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-46>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-45>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-29>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-32>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-56>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-31>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-55>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-30>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-54>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-53>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-52>, <http://purl.uniprot.org/unirules/MF_01251#construct-template-51>,
    <http://purl.uniprot.org/unirules/MF_01251#construct-template-50>;
  <http://www.w3.org/ns/shacl#prefixes> <http://purl.uniprot.org/unirules/>;
  <http://spinrdf.org/sp#where> <http://purl.uniprot.org/unirules/MF_01251#construct-where-list-0>;
  <http://spinrdf.org/sp#templates> <http://purl.uniprot.org/unirules/MF_01251#construct-template-list-0>;
  <http://www.w3.org/ns/shacl#construct> """CONSTRUCT {
  _:440316 up:source unirule:MF_01251 .
  _:440317 up:source unirule:MF_01251 .
  _:440318 up:source unirule:MF_01251 .
  _:440319 up:source unirule:MF_01251 .
  _:440320 up:source unirule:MF_01251 .
  _:440321 up:source unirule:MF_01251 .
  _:440322 up:source unirule:MF_01251 .
  _:440323 up:source unirule:MF_01251 .
  _:440324 up:source unirule:MF_01251 .
  _:440325 up:source unirule:MF_01251 .
  ?this up:annotation ?annotation0 .
  ?annotation0 a up:Similarity_Annotation ;
    rdfs:comment 'Belongs to the UPF0313 family.' .
  ?case1 up:classifiedWith GO:0005506 ,
      keyword:408 ,
      keyword:411 ,
      keyword:479 ,
      keyword:4 ,
      keyword:949 .
  ?pfs4 up:annotation ?annotation5 ,
      ?annotation11 ,
      ?annotation17 .
  ?annotation5 faldo:begin ?pfsb6 ;
    faldo:end ?pfse7 ;
    up:ligand ?ligand8 ;
    rdf:type up:Binding_Site_Annotation .
  ?pfsb6 faldo:position ?thisPositionOn9 ;
    rdf:type faldo:ExactPosition .
  ?pfse7 faldo:position ?thisPositionOn10 ;
    rdf:type faldo:ExactPosition .
  ?ligand8 rdfs:subClassOf chebi:49883 .
  ?annotation11 faldo:begin ?pfsb12 ;
    faldo:end ?pfse13 ;
    up:ligand ?ligand14 ;
    rdf:type up:Binding_Site_Annotation .
  ?pfsb12 faldo:position ?thisPositionOn15 ;
    rdf:type faldo:ExactPosition .
  ?pfse13 faldo:position ?thisPositionOn16 ;
    rdf:type faldo:ExactPosition .
  ?ligand14 rdfs:subClassOf chebi:49883 .
  ?annotation17 faldo:begin ?pfsb18 ;
    faldo:end ?pfse19 ;
    up:ligand ?ligand20 ;
    rdf:type up:Binding_Site_Annotation .
  ?pfsb18 faldo:position ?thisPositionOn21 ;
    rdf:type faldo:ExactPosition .
  ?pfse19 faldo:position ?thisPositionOn22 ;
    rdf:type faldo:ExactPosition .
  ?ligand20 rdfs:subClassOf chebi:49883 .
  _:440326 a rdf:Statement ;
    up:attribution _:440316 ;
    rdf:subject ?this ;
    rdf:predicate up:annotation ;
    rdf:object ?annotation0 .
  _:440327 a rdf:Statement ;
    up:attribution _:440317 ;
    rdf:subject ?case1 ;
    rdf:predicate up:classifiedWith ;
    rdf:object keyword:4 .
  _:440328 a rdf:Statement ;
    up:attribution _:440318 ;
    rdf:subject ?case1 ;
    rdf:predicate up:classifiedWith ;
    rdf:object keyword:408 .
  _:440329 a rdf:Statement ;
    up:attribution _:440319 ;
    rdf:subject ?case1 ;
    rdf:predicate up:classifiedWith ;
    rdf:object keyword:411 .
  _:440330 a rdf:Statement ;
    up:attribution _:440320 ;
    rdf:subject ?case1 ;
    rdf:predicate up:classifiedWith ;
    rdf:object keyword:479 .
  _:440331 a rdf:Statement ;
    up:attribution _:440321 ;
    rdf:subject ?case1 ;
    rdf:predicate up:classifiedWith ;
    rdf:object keyword:949 .
  _:440332 a rdf:Statement ;
    up:attribution _:440322 ;
    rdf:subject ?case1 ;
    rdf:predicate up:classifiedWith ;
    rdf:object GO:0005506 .
  _:440333 a rdf:Statement ;
    up:source unirule:MF_01251 ;
    rdf:subject ?pfs4 ;
    rdf:predicate up:annotation ;
    rdf:object ?annotation5 .
  _:440334 a rdf:Statement ;
    up:attribution _:440323 ;
    rdf:subject ?pfs4 ;
    rdf:predicate up:annotation ;
    rdf:object ?annotation5 .
  _:440335 a rdf:Statement ;
    up:source unirule:MF_01251 ;
    rdf:subject ?pfs4 ;
    rdf:predicate up:annotation ;
    rdf:object ?annotation11 .
  _:440336 a rdf:Statement ;
    up:attribution _:440324 ;
    rdf:subject ?pfs4 ;
    rdf:predicate up:annotation ;
    rdf:object ?annotation11 .
  _:440337 a rdf:Statement ;
    up:source unirule:MF_01251 ;
    rdf:subject ?pfs4 ;
    rdf:predicate up:annotation ;
    rdf:object ?annotation17 .
  _:440338 a rdf:Statement ;
    up:attribution _:440325 ;
    rdf:subject ?pfs4 ;
    rdf:predicate up:annotation ;
    rdf:object ?annotation17 .
}
WHERE {
  #baseURI: http://purl.uniprot.org/unirule/MF_01251
  #Rule MF_01251 Created by:? on:2005-02-28 Modified by:Edouard de Castro on:2023-06-01
  VALUES ?supertaxon23 {taxon:2 taxon:2157}
  ?this up:organism ?thisOrganism ;
    rdfs:seeAlso signature:MF_01251 .
  ?thisOrganism rdfs:subClassOf+ ?supertaxon23 .
  BIND(URI(CONCAT(STR(?this), '#MF_01251a0')) AS ?annotation0) .
  OPTIONAL {
    ?this up:sequence ?thisSequence .
    ?thisSequence rdf:value ?thisSequenceValue .
    ?templateMotifMatch28 faldo:location ?templateMotifSequenceMatchRegionQ4686129 ;
      edam:is_output_of ?templateMotifSequenceProfileAlignmentOperationQ4686131 ;
      rdf:type edam:data_0869 ;
      rdf:value ?templateMotifCigarQ46861MF_0125124 .
    ?templateMotifSequenceMatchRegionQ4686129 faldo:begin ?templateMotifSequenceMatchBeginQ4686130 .
    ?templateMotifSequenceMatchBeginQ4686130 faldo:position ?templateMotifSequenceMatchBeginPositionQ4686125 ;
      faldo:reference isoform:Q46861-1 .
    ?templateMotifSequenceProfileAlignmentOperationQ4686131 edam:has_input signature:MF_01251 ;
      rdf:type edam:operation_0300 .
    ?targetMotifMatch32 faldo:location ?targetMotifMatchRegionMatch33 ;
      edam:is_output_of ?targetMotifSequenceAlignmentOperationMF_0125135 ;
      rdf:type edam:data_0869 ;
      rdf:value ?targetMotifMatchCigarQ46861MF_0125126 .
    ?targetMotifMatchRegionMatch33 faldo:begin ?targetMotifMatchRegionMatchBeginMF_0125134 .
    ?targetMotifMatchRegionMatchBeginMF_0125134 faldo:position ?targetMotifMatchRegionMatchBeginPositionMF_0125127 ;
      faldo:reference ?thisSequence .
    ?targetMotifSequenceAlignmentOperationMF_0125135 edam:has_input signature:MF_01251 ;
      rdf:type edam:operation_0300 .
    BIND(?this AS ?tagFTGRP_1) .
    BIND(STRLEN(REPLACE(SUBSTR(?templateMotifCigarQ46861MF_0125124, 1, (STRLEN(?templateMotifCigarQ46861MF_0125124) - STRLEN(REPLACE(?templateMotifCigarQ46861MF_0125124, CONCAT('^(?:-*[^-]){', STR(((386 - ?templateMotifSequenceMatchBeginPositionQ4686125) + 1)), '}'), '')))), '[a-z]', '')) AS ?step136) .
    BIND((STRLEN(SUBSTR(?targetMotifMatchCigarQ46861MF_0125126, 1, (STRLEN(?targetMotifMatchCigarQ46861MF_0125126) - STRLEN(REPLACE(?targetMotifMatchCigarQ46861MF_0125126, CONCAT('^(?:[a-z]*(?:[A-Z]|-)){', STR(?step136), '}'), ''))))) - STRLEN(REPLACE(SUBSTR(?targetMotifMatchCigarQ46861MF_0125126, 1, (STRLEN(?targetMotifMatchCigarQ46861MF_0125126) - STRLEN(REPLACE(?targetMotifMatchCigarQ46861MF_0125126, CONCAT('^(?:[a-z]*(?:[A-Z]|-)){', STR(?step136), '}'), '')))), '[^-]', ''))) AS ?step237) .
    BIND(((?step237 + ?targetMotifMatchRegionMatchBeginPositionMF_0125127) - 1) AS ?thisPositionOn9) .
    BIND(?thisPositionOn9 AS ?thisPositionOn10) .
    BIND(?this AS ?pfs1t38) .
    BIND(URI(CONCAT(STR(?thisSequence), '#position', STR(?thisPositionOn9))) AS ?pfsb6) .
    BIND(URI(CONCAT(STR(?thisSequence), '#position', STR(?thisPositionOn10))) AS ?pfse7) .
    FILTER ((SUBSTR(?thisSequenceValue, ?thisPositionOn9, 1) = 'C')) .
    BIND(STRLEN(REPLACE(SUBSTR(?templateMotifCigarQ46861MF_0125124, 1, (STRLEN(?templateMotifCigarQ46861MF_0125124) - STRLEN(REPLACE(?templateMotifCigarQ46861MF_0125124, CONCAT('^(?:-*[^-]){', STR(((390 - ?templateMotifSequenceMatchBeginPositionQ4686125) + 1)), '}'), '')))), '[a-z]', '')) AS ?step139) .
    BIND((STRLEN(SUBSTR(?targetMotifMatchCigarQ46861MF_0125126, 1, (STRLEN(?targetMotifMatchCigarQ46861MF_0125126) - STRLEN(REPLACE(?targetMotifMatchCigarQ46861MF_0125126, CONCAT('^(?:[a-z]*(?:[A-Z]|-)){', STR(?step139), '}'), ''))))) - STRLEN(REPLACE(SUBSTR(?targetMotifMatchCigarQ46861MF_0125126, 1, (STRLEN(?targetMotifMatchCigarQ46861MF_0125126) - STRLEN(REPLACE(?targetMotifMatchCigarQ46861MF_0125126, CONCAT('^(?:[a-z]*(?:[A-Z]|-)){', STR(?step139), '}'), '')))), '[^-]', ''))) AS ?step240) .
    BIND(((?step240 + ?targetMotifMatchRegionMatchBeginPositionMF_0125127) - 1) AS ?thisPositionOn15) .
    BIND(?thisPositionOn15 AS ?thisPositionOn16) .
    BIND(?this AS ?pfs1t41) .
    BIND(URI(CONCAT(STR(?thisSequence), '#position', STR(?thisPositionOn15))) AS ?pfsb12) .
    BIND(URI(CONCAT(STR(?thisSequence), '#position', STR(?thisPositionOn16))) AS ?pfse13) .
    FILTER ((SUBSTR(?thisSequenceValue, ?thisPositionOn15, 1) = 'C')) .
    BIND(STRLEN(REPLACE(SUBSTR(?templateMotifCigarQ46861MF_0125124, 1, (STRLEN(?templateMotifCigarQ46861MF_0125124) - STRLEN(REPLACE(?templateMotifCigarQ46861MF_0125124, CONCAT('^(?:-*[^-]){', STR(((393 - ?templateMotifSequenceMatchBeginPositionQ4686125) + 1)), '}'), '')))), '[a-z]', '')) AS ?step142) .
    BIND((STRLEN(SUBSTR(?targetMotifMatchCigarQ46861MF_0125126, 1, (STRLEN(?targetMotifMatchCigarQ46861MF_0125126) - STRLEN(REPLACE(?targetMotifMatchCigarQ46861MF_0125126, CONCAT('^(?:[a-z]*(?:[A-Z]|-)){', STR(?step142), '}'), ''))))) - STRLEN(REPLACE(SUBSTR(?targetMotifMatchCigarQ46861MF_0125126, 1, (STRLEN(?targetMotifMatchCigarQ46861MF_0125126) - STRLEN(REPLACE(?targetMotifMatchCigarQ46861MF_0125126, CONCAT('^(?:[a-z]*(?:[A-Z]|-)){', STR(?step142), '}'), '')))), '[^-]', ''))) AS ?step243) .
    BIND(((?step243 + ?targetMotifMatchRegionMatchBeginPositionMF_0125127) - 1) AS ?thisPositionOn21) .
    BIND(?thisPositionOn21 AS ?thisPositionOn22) .
    BIND(?this AS ?pfs1t44) .
    BIND(URI(CONCAT(STR(?thisSequence), '#position', STR(?thisPositionOn21))) AS ?pfsb18) .
    BIND(URI(CONCAT(STR(?thisSequence), '#position', STR(?thisPositionOn22))) AS ?pfse19) .
    FILTER ((SUBSTR(?thisSequenceValue, ?thisPositionOn21, 1) = 'C')) .
    BIND(?this AS ?pfs4) .
  }
  OPTIONAL {
    ?this a up:Protein .
    BIND(?this AS ?caseWithTag45) .
  }
  BIND(IF(BOUND(?tagFTGRP_1), ?caseWithTag45, ?UNBOUND_VARIABLE) AS ?case1) .
  OPTIONAL {
    ?this a up:Protein .
    VALUES ?supertaxon46 {taxon:561 taxon:620 taxon:590}
    ?this up:organism ?thisOrganism .
    ?thisOrganism rdfs:subClassOf+ ?supertaxon46 .
    BIND(?this AS ?case2) .
  }
  OPTIONAL {
    ?this a up:Protein .
    ?this up:organism ?thisOrganism .
    FILTER (! (EXISTS {
      VALUES ?supertaxon47 {taxon:561 taxon:620 taxon:590}
      ?thisOrganism rdfs:subClassOf+ ?supertaxon47 .
    })) .
    BIND(?this AS ?case3) .
  }
}
""" .

<http://purl.uniprot.org/unirules/MF_01251> <http://www.w3.org/ns/shacl#rule> <http://purl.uniprot.org/unirules/MF_01251#construct> .
