Hey folks,
I am using latest version of the neo4j graphql library v3.22.0 .
I have two graph DB and have a graphql associated with each of the DB , which I am federating using apollo federation gateway.
The problem is that there is one type definition called PATENT that is common in both the DB's and they are joined on the basis of a property called 'app_num'
This is the type def file for Biblio-DB
type PATENT @key(fields : "app_num") @shareable {
actual_disposal_type: String
aia: String
app_num: String!
app_status: String
app_status_date: String
attorney_docket_no: String
confirmation_no: String
disposal_type: String
entity_status: String
filing_date: String
issue_date: String
location: String
patent_no: String
publication_date: String
publication_no: String
title: String
usc_class: String
usc_subclass: String
has_applicants: [APPLICANT!]! @relationship(type: "IS_APPLICANT_OF", direction: IN)
has_attorneys: [ATTORNEY!]! @relationship(type: "IS_ASSOCIATED_TO_PATENT", direction: IN)
has_examiner: [EXAMINER!]! @relationship(type: "EXAMINED", direction: IN)
has_law_firm: [LAW_FIRM!]! @relationship(type: "IS_ASSOCIATED_TO", direction: IN)
has_continuities: [CONTINUITY_DATA!]! @relationship(type: "HAS_CONTINUITY", direction: OUT)
has_file_history : [FILE_NODE!]! @relationship(type: "HAS_FILE", direction: OUT)
has_gau : [GAU!]! @relationship(type: "HAS_GAU", direction: OUT)
has_priority_claims : [PRIORITY_CLAIM!]! @relationship(type: "HAS_PRIORITY_CLAIM", direction: OUT)
has_prosecutions: [PROSECUTION_NODE!]! @relationship(type: "HAS_PROSECUTION", direction: OUT)
has_term_adjustments: [TERM_ADJUSTMENTS!]! @relationship(type: "HAS_TERM_ADJUSTMENTS", direction: OUT)
has_inventors: [INVENTOR!]! @relationship(type: "INVENTED", direction: IN)
has_application_type: [APP_TYPE!]! @relationship(type: "IS_OF_TYPE", direction: OUT)
has_parents: [PATENT!]! @relationship(type: "IS_PARENT_OF", direction: IN, properties: "IsParentOfProperties")
has_children: [PATENT!]! @relationship(type: "IS_PARENT_OF", direction: OUT, properties: "IsParentOfProperties")
}
I have only added the relevant information from the schema file
This is the type def file for Assignment-DB
extend schema @link(url: "https://specs.apollo.dev/federation/v2.0",
import: ["@key", "@shareable"])
type PATENT @key(fields: "app_num") @shareable{
app_num: String!
has_assignments: [ASSIGNMENT!]! @relationship(type: "HAS_ASSIGNMENT", direction: OUT)
}
type ASSIGNEE {
address: String
city: String
country: String
is_assignee_of_assignments: [ASSIGNMENT!]! @relationship(type: "IS_ASSIGNEE_OF", direction: OUT)
name: String!
postcode: String
state: String
}
type ASSIGNMENT {
has_assignees: [ASSIGNEE!]! @relationship(type: "IS_ASSIGNEE_OF", direction: IN)
has_assignors: [ASSIGNOR!]! @relationship(type: "IS_ASSIGNOR_OF", direction: IN, properties: "IsAssignorOfProperties")
conveyance_text: String
correspondent: String
correspondent_address: String
country: String
frame_no: String
id: String!
has_patents: [PATENT!]! @relationship(type: "HAS_ASSIGNMENT", direction: IN)
recorded_date: String
reel_no: String
}
type ASSIGNOR {
is_assignor_of_assignments: [ASSIGNMENT!]! @relationship(type: "IS_ASSIGNOR_OF", direction: OUT, properties: "IsAssignorOfProperties")
name: String!
}
interface IsAssignorOfProperties @relationshipProperties {
execution_date: String
}
extend schema @mutation(operations: [])
Everything works fine if we use app_num
for querying various types of data.
But I want that I can put a where condition on properties like 'patent_no' or the 'publication_no' from the biblio-db to fetch the assignment data.
For clarity,
query Patents($where: PATENTWhere) {
patents(where: $where) {
app_status
has_assignments {
conveyance_text
has_patents {
app_num
app_status
has_assignments {
conveyance_text
}
}
}
}
}
I can use this type of query to fetch data if we use app_num
in the "where" variable, I want the same functionality, but I want to pass patent_no
or publication_no
in "where" variable.
I think the library only writes "where" logic for the @shareable types only for the fields that are mentioned with the @key directive.
But If I mention any field like "patent_no" which does not exist in the assignment DB it gives an error while making an executable schema.
Shouldn't it fetch the app_num through the logic of biblio-db and then when it has the app_num then it should pass it to the assignment-db and fetch the corresponding data?
Am I missing something because it seems like an obvious feature to me?
Best Regards,
Aman Negi