Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Infer schema fails after a few node types #3

Open
wolfgang-ldc opened this issue Jun 26, 2020 · 5 comments
Open

Infer schema fails after a few node types #3

wolfgang-ldc opened this issue Jun 26, 2020 · 5 comments
Assignees
Labels
bug Something isn't working someone is working on it

Comments

@wolfgang-ldc
Copy link

I have a database with >80 different labels/node types. When I use the "Infer Schema" option it generates the schema for a few (~18) types initially but then stops.
GraphQL_errorr.txt

It appears to work fine with a smaller, less complex database.

@ed42311
Copy link

ed42311 commented Jul 20, 2020

Hey @wolfgang-ldc that's an impressive dataset.

A few questions so we can run some debugging:

  • What OS are you running on?
  • Is the type definition editor populated with your full schema or does it appear to be missing types?
  • Last but not least can you share a schema.gql file and we can run through it and debug on our end?

Thanks!

@ed42311 ed42311 self-assigned this Jul 20, 2020
@ed42311 ed42311 added needs triage question Further information is requested bug Something isn't working labels Jul 20, 2020
@wolfgang-ldc
Copy link
Author

wolfgang-ldc commented Jul 20, 2020 via email

@ed42311
Copy link

ed42311 commented Jul 22, 2020

Whew! Nice! Alright I'll take a look. Thanks for sharing @wolfgang-ldc

@johnymontana
Copy link
Contributor

I was able to reproduce this using this Cypher statement to populate a database:

UNWIND range(0,120) AS i
CALL apoc.create.node(['a'+toString(i)], {foobar: i}) YIELD node AS n1
CALL apoc.create.node(['a'+toString(i+1)], {foobaz: i+1}) YIELD node AS n2
CALL apoc.create.relationship(n1, 'foobarzrel', {},n2 ) YIELD rel
CALL apoc.create.relationship(n1, 'r'+toString(i), {},n2 ) YIELD rel AS rel2
RETURN COUNT(*)

Then running inferSchema in GraphQL Architect. In the editor after 416 lines the GraphQL type defs are cutoff here:

type a50 {
   _id: Long!
   foobar: Int
   foobaz: Int
   r50: [a51] @relation(name: "r50", direction: OUT)
   a49s: [a49] @rela

resulting in a GraphQL syntax error.

I'm guessing that there is a limit in the number of characters being picked up from the executeNode process actually runningthe inferSchema process. Because of the large number of "multivalent" relationships in the schema the inferSchema process produces a large number of info log lines along with the schema.

@ed42311 ed42311 added someone is working on it and removed needs triage question Further information is requested labels Aug 7, 2020
@ed42311
Copy link

ed42311 commented Aug 7, 2020

hmmm... @johnymontana

unable to reproduce

  1. New local graph v4.1.1(latest)
  2. Install APOC
  3. Ran:
UNWIND range(0,120) AS i
CALL apoc.create.node(['a'+toString(i)], {foobar: i}) YIELD node AS n1
CALL apoc.create.node(['a'+toString(i+1)], {foobaz: i+1}) YIELD node AS n2
CALL apoc.create.relationship(n1, 'foobarzrel', {},n2 ) YIELD rel
CALL apoc.create.relationship(n1, 'r'+toString(i), {},n2 ) YIELD rel AS rel2
RETURN COUNT(*)

in neo4j browser
4. Open Architect
5. press infer schema ( which is telling, because the schema should be loaded )

  • types stay the same in the editor
  • outputs a bunch of errors in the UI log
INFO :: Initializing your Neo4j Schema

INFO :: This may take a few moments depending on the size of your DB

ERR :: RelID :`foobarzrel` for label set a0 has > 1 target type (a1,a10,a100,a11,a12,a13,a14,a15,a16,a17,a18,a19,a2,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a3,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a4,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a5,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a6,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a7,a70,a71,a72,a73,a74,a75,a76,a77,a78,a79,a8,a80,a81,a82,a83,a84,a85,a86,a87,a88,a89,a9,a90,a91,a92,a93,a94,a95,a96,a97,a98,a99); skipping

ERR :: RelID :`foobarzrel` for label set a1 has > 1 target type (a1,a10,a100,a11,a12,a13,a14,a15,a16,a17,a18,a19,a2,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a3,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a4,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a5,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a6,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a7,a70,a71,a72,a73,a74,a75,a76,a77,a78,a79,a8,a80,a81,a82,a83,a84,a85,a86,a87,a88,a89,a9,a90,a91,a92,a93,a94,a95,a96,a97,a98,a99); skipping

this goes on for n times...

ERR :: RelID :`foobarzrel` for label set a100 has > 1 origin type (a0,a1,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a2,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a3,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a4,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a5,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a6,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a7,a70,a71,a72,a73,a74,a75,a76,a77,a78,a79,a8,a80,a81,a82,a83,a84,a85,a86,a87,a88,a89,a9,a90,a91,a92,a93,a94,a95,a96,a97,a98,a99); skipping

ERR :: Relationship Neo4jRelationship {
  id: ':`foobarzrel`',
  type: 'relationship',
  properties: {},
  relType: 'foobarzrel',
  links: [
    { from: [Array], to: [Array] },
    ...agian n times
    { from: [Array], to: [Array] }
  ]
} is not univalent and is not yet supported

SUCCESS :: Received type defs
Type Defs Saved
INFO :: Infer Schema Done

Exploratory

Restarting Architect yields an editor with:


# These type definitions have been generated from your Neo4j database.

# Here are some Neo4j specific scalars that you can use to map to native Neo4j types:
scalar Point
scalar Date
scalar DateTime
scalar Long

# Edit these GraphQL type definitions below to change your GraphQL API
# You can add custom logic defined with Cypher using the @cypher GraphQL schema directive
# You can refer to the docs at https://grandstack.io
type a0 {
   _id: Long!
   foobar: Int!
   r0: [a1] @relation(name: "r0", direction: OUT)
}

type a1 {
   _id: Long!
   foobar: Int
   foobaz: Int
   r1: [a2] @relation(name: "r1", direction: OUT)
   a0s: [a0] @relation(name: "r0", direction: IN)
}

type n....

type a121 {
   _id: Long!
   foobaz: Int!
   a120s: [a120] @relation(name: "r120", direction: IN)
}

and like a lot of empty lines...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working someone is working on it
Projects
None yet
Development

No branches or pull requests

3 participants