weaviate / weaviate-graphql-prototype

weaviate-graphql-prototype
1 stars 2 forks source link

Network Get function #33

Open laura-ham opened 6 years ago

laura-ham commented 6 years ago

Via the P2P network, it will be possible to request ontologies of the Weaviate instances in a network. This means that Things and Actions can be requested directly from these Weaviate instances, with the terminology and definitions of the original ontology. A 'Get' function should be added to the Network design to directly request these Things and Actions. The design of the Get function will be similar to the Get function of the Local GraphQL query.

Proposed is the following:

{
  Network{
    Get{
      <NameOfWeaviate>{
        Things{
          <ClassName>{
            <propertyName>
          }
        }
      }
    }
  }
}

The name of the Weaviate instance, , should be in the GraphQL schema, so are the property names. This makes sure that the property values are retrieved from the intended Weaviate instance. A weaviateName can only have azAZ09 characters, which should be specified and checked in the GraphQL type definition (GraphQL string is not specific enough).

An example query could look like this:

{
  Network{
    Get{
      WeaviateB(where:{
        path: ["Things", "City", "name"],
        operator: Equal,
        valueString: "Amsterdam"
      }){
        Things{
          City{
            name
          }
        }
      }
      WeaviateC(where:{
        path: ["Things", "Place", "identifier"],
        operator: Equal,
        valueString: "Amsterdam"
      }){
        Things{
          Place{
            identifier
          }
        }
      }
    }
  }
}

Note that the filter is present at the level of the WeaviateName, not at the 'Get' level. This is because the filter entries are dependent on ontology definitions. Second note: the incentive to use this function is to Get exact Things/Actions a user is looking for. The name of the Weaviate and propertynames can be found by an introspection, or when the user wants to explore and find similar nodes, a query can first be made by Fetch/Introspect.

laura-ham commented 6 years ago

@bobvanluijt see this issue

bobvanluijt commented 6 years ago

@laura-ham What if one doesn't know the name of the Weaviate?

laura-ham commented 6 years ago

@laura-ham What if one doesn't know the name of the Weaviate?

@bobvanluijt The location of the nodes requested should be known to retrieve the nodes, so this should be provided. The name of the Weaviate is returned (in the beacon) in the Fetch and Introspect query, so one could do a request here first.

bobvanluijt commented 6 years ago

Thanks, @laura-ham, curious to see that in action :-)