public ServiceCall < QueryRelationsResponse > queryRelations ( QueryRelationsOptions queryRelationsOptions ) { Validator . notNull ( queryRelationsOptions , "queryRelationsOptions cannot be null" ) ; String [ ] pathSegments = { "v1/environments" , "collections" , "query_relations" } ; String [ ] pathParameters = { queryRelationsOptions . environmentId ( ) , queryRelationsOptions . collectionId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "discovery" , "v1" , "queryRelations" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( queryRelationsOptions . entities ( ) != null ) { contentJson . add ( "entities" , GsonSingleton . getGson ( ) . toJsonTree ( queryRelationsOptions . entities ( ) ) ) ; } if ( queryRelationsOptions . context ( ) != null ) { contentJson . add ( "context" , GsonSingleton . getGson ( ) . toJsonTree ( queryRelationsOptions . context ( ) ) ) ; } if ( queryRelationsOptions . sort ( ) != null ) { contentJson . addProperty ( "sort" , queryRelationsOptions . sort ( ) ) ; } if ( queryRelationsOptions . filter ( ) != null ) { contentJson . add ( "filter" , GsonSingleton . getGson ( ) . toJsonTree ( queryRelationsOptions . filter ( ) ) ) ; } if ( queryRelationsOptions . count ( ) != null ) { contentJson . addProperty ( "count" , queryRelationsOptions . count ( ) ) ; } if ( queryRelationsOptions . evidenceCount ( ) != null ) { contentJson . addProperty ( "evidence_count" , queryRelationsOptions . evidenceCount ( ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( QueryRelationsResponse . class ) ) ; }
Knowledge Graph relationship query .