Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading the API definition at startup #136

Open
tpluscode opened this issue Jul 31, 2024 · 0 comments
Open

Loading the API definition at startup #136

tpluscode opened this issue Jul 31, 2024 · 0 comments

Comments

@tpluscode
Copy link
Contributor

In the PoC, I had shape which I would use to generate a loong SPARQL query. This method can be useful when API triples are spread across multiple graph but in a simpler scenario, a single graph with the entire API could be loaded as a whole.

I would like this to be pluggable and configurable

Generated query
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX schema: <http://schema.org/>
PREFIX sh: <http://www.w3.org/ns/shacl#>
CONSTRUCT {
  ?resource1 rdf:type <https://kopflos.described.at/Config>.
  ?resource1 <https://kopflos.described.at/api> ?resource2.
  ?resource1 <https://kopflos.described.at/resourceLoader> ?resource68.
  ?resource3 schema:isPartOf ?resource2.
  ?resource2 <https://kopflos.described.at/resourceLoader> ?resource51.
  ?resource3 sh:targetClass ?resource4.
  ?resource3 sh:targetNode ?resource5.
  ?resource3 sh:property ?resource6.
  ?resource3 <https://kopflos.described.at/resourceLoader> ?resource18.
  ?resource3 <https://kopflos.described.at/renderer> ?resource26.
  ?resource3 <https://kopflos.described.at/handler> ?resource34.
  ?resource6 sh:path ?resource7.
  ?resource6 <https://kopflos.described.at/handler> ?resource8.
  ?resource8 <https://code.described.at/implementedBy> ?resource10.
  ?resource10 rdf:type ?resource12.
  ?resource10 <https://code.described.at/link> ?resource13.
  ?resource18 <https://code.described.at/implementedBy> ?resource20.
  ?resource20 rdf:type ?resource22.
  ?resource20 <https://code.described.at/link> ?resource23.
  ?resource26 <https://code.described.at/implementedBy> ?resource28.
  ?resource28 rdf:type ?resource30.
  ?resource28 <https://code.described.at/link> ?resource31.
  ?resource34 <https://code.described.at/implementedBy> ?resource36.
  ?resource36 rdf:type ?resource38.
  ?resource36 <https://code.described.at/link> ?resource39.
  ?resource34 <https://kopflos.described.at/method> ?resource42.
  ?resource51 <https://code.described.at/implementedBy> ?resource53.
  ?resource53 rdf:type ?resource55.
  ?resource53 <https://code.described.at/link> ?resource56.
  ?resource68 <https://code.described.at/implementedBy> ?resource70.
  ?resource70 rdf:type ?resource72.
  ?resource70 <https://code.described.at/link> ?resource73.
}
WHERE {
  {
    SELECT ?resource1 ?resource2 ?resource68 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>.
      { ?resource1 <https://kopflos.described.at/api> ?resource2. }
      UNION
      { ?resource1 <https://kopflos.described.at/resourceLoader> ?resource68. }
    }
  }
  UNION
  {
    SELECT ?resource3 ?resource2 ?resource51 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      { ?resource3 schema:isPartOf ?resource2. }
      UNION
      { ?resource2 <https://kopflos.described.at/resourceLoader> ?resource51. }
    }
  }
  UNION
  {
    SELECT ?resource3 ?resource4 ?resource5 ?resource6 ?resource18 ?resource26 ?resource34 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource3 schema:isPartOf ?resource2.
      { ?resource3 sh:targetClass ?resource4. }
      UNION
      { ?resource3 sh:targetNode ?resource5. }
      UNION
      { ?resource3 sh:property ?resource6. }
      UNION
      { ?resource3 <https://kopflos.described.at/resourceLoader> ?resource18. }
      UNION
      { ?resource3 <https://kopflos.described.at/renderer> ?resource26. }
      UNION
      { ?resource3 <https://kopflos.described.at/handler> ?resource34. }
    }
  }
  UNION
  {
    SELECT ?resource6 ?resource7 ?resource8 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource3 schema:isPartOf ?resource2;
        sh:property ?resource6.
      { ?resource6 sh:path ?resource7. }
      UNION
      { ?resource6 <https://kopflos.described.at/handler> ?resource8. }
    }
  }
  UNION
  {
    SELECT ?resource8 ?resource10 ?resource12 ?resource13 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource3 schema:isPartOf ?resource2;
        sh:property ?resource6.
      ?resource6 <https://kopflos.described.at/handler> ?resource8.
      ?resource8 <https://code.described.at/implementedBy> ?resource10.
      {
        ?resource10 rdf:type ?resource12.
        BIND(?resource12 AS ?resource9)
      }
      UNION
      {
        ?resource10 <https://code.described.at/link> ?resource13.
        BIND(?resource13 AS ?resource9)
      }
    }
  }
  UNION
  {
    SELECT ?resource18 ?resource20 ?resource22 ?resource23 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource3 schema:isPartOf ?resource2;
        <https://kopflos.described.at/resourceLoader> ?resource18.
      ?resource18 <https://code.described.at/implementedBy> ?resource20.
      {
        ?resource20 rdf:type ?resource22.
        BIND(?resource22 AS ?resource19)
      }
      UNION
      {
        ?resource20 <https://code.described.at/link> ?resource23.
        BIND(?resource23 AS ?resource19)
      }
    }
  }
  UNION
  {
    SELECT ?resource26 ?resource28 ?resource30 ?resource31 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource3 schema:isPartOf ?resource2;
        <https://kopflos.described.at/renderer> ?resource26.
      ?resource26 <https://code.described.at/implementedBy> ?resource28.
      {
        ?resource28 rdf:type ?resource30.
        BIND(?resource30 AS ?resource27)
      }
      UNION
      {
        ?resource28 <https://code.described.at/link> ?resource31.
        BIND(?resource31 AS ?resource27)
      }
    }
  }
  UNION
  {
    SELECT ?resource34 ?resource36 ?resource38 ?resource39 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource3 schema:isPartOf ?resource2;
        <https://kopflos.described.at/handler> ?resource34.
      ?resource34 <https://code.described.at/implementedBy> ?resource36.
      {
        ?resource36 rdf:type ?resource38.
        BIND(?resource38 AS ?resource35)
      }
      UNION
      {
        ?resource36 <https://code.described.at/link> ?resource39.
        BIND(?resource39 AS ?resource35)
      }
    }
  }
  UNION
  {
    SELECT ?resource34 ?resource42 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource3 schema:isPartOf ?resource2;
        <https://kopflos.described.at/handler> ?resource34.
      ?resource34 <https://kopflos.described.at/method> ?resource42.
    }
  }
  UNION
  {
    SELECT ?resource51 ?resource53 ?resource55 ?resource56 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/api> ?resource2.
      ?resource2 <https://kopflos.described.at/resourceLoader> ?resource51.
      ?resource51 <https://code.described.at/implementedBy> ?resource53.
      {
        ?resource53 rdf:type ?resource55.
        BIND(?resource55 AS ?resource52)
      }
      UNION
      {
        ?resource53 <https://code.described.at/link> ?resource56.
        BIND(?resource56 AS ?resource52)
      }
    }
  }
  UNION
  {
    SELECT ?resource68 ?resource70 ?resource72 ?resource73 WHERE {
      ?resource1 rdf:type <https://kopflos.described.at/Config>;
        <https://kopflos.described.at/resourceLoader> ?resource68.
      ?resource68 <https://code.described.at/implementedBy> ?resource70.
      {
        ?resource70 rdf:type ?resource72.
        BIND(?resource72 AS ?resource69)
      }
      UNION
      {
        ?resource70 <https://code.described.at/link> ?resource73.
        BIND(?resource73 AS ?resource69)
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant