You can translate the question and the replies:

Complex filtering on blocks with labels

Hello, I am creating an app where teachers can search for resources. Each resource is tagged with topics which are used to flter results. I have a complex use case and am looking for some advice For example: * Resource 1 is tagged with topic "Maths". Topic "Maths" has topic label "Subject" with is tier 1 * Resource 2 is tagged with topic "Algebra". Topic "Algebra" has topic label "Unit" with is tier 2 * Resource 2 is tagged with topic "2019". Topic "2019" has topic label "Year" with is tier 1 * Resource 2 is tagged with topic "Calculator". Topic "Calculator" has topic label "Question Type" with is tier 1 * Resource 3 is tagged with topic "Algebra". Topic "Algebra" has topic label "Unit" with is tier 2 * Resource 3 is tagged with topic "2018". Topic "2018" has topic label "Year" with is tier 1 I am trying to write a query which allows the user to get all resources which contain the provided topics. For example: - Get me all resources which are tagged with topic "2019" and topic "Algebra". This should return only Resource 2 as it has both these tags - Get me all resources which are tagged with topic "Algebra". This should return Resource 2 and Resource 3 as they both are tagged with topic "Algebra" My current attempt fails to do this as it does not differntiate between the topics. My query is shown below: ```graphQl query FilterBlocks($topicIds: [bigint!]) { block( where: {tags: {topic_id: {_in: $topicIds, _is_null: false} } } ) { id tags { id topic { id title } } type block ... } } ``` Any advice on how to go about this would be much appreciated
user
15-03-2022 18:47:36 -0400
code

1 Answer

Hi, On looking at your question, I understand that you want to retrieve resources data through a GraphQL request based on the input tag. In such a case, you can achieve this with Denodo, if you were able to get the Resources and tags data from the source and integrating with Denodo. Denodo supports access to various forms of data such as database tables, Delimited files, Excel, JSON, XML, etc.. For more information, you can check the [Creating Data Sources and Base Views](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_data_sources_and_base_views/creating_data_sources_and_base_views#creating-data-sources-and-base-views) section of the Virtual DataPort Administration Guide. Once the data is retrieved from the source, you can then expose it as a GraphQL service. With this, you can get the resources data based on the input tags by using the GraphQL code. For this, take a look at the [Denodo GraphQL Service](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/restful_architecture/graphql_service/graphql_service#denodo-graphql-service) and its subsections. Hope this helps!
Denodo Team
16-03-2022 08:56:13 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here