Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

A couple of weeks ago I've heard about the Google Knowledge Graph API for the first time. All of you who followed my work in the last years probably know that I'm interested in all kind of public APIs and Graph Databases. Obviously I've started to play around with this API immediatelly.

As described on I've registered my user and got an API key.

My first call:

  "@context": {
    "@vocab": "",
    "goog": "",
    "EntitySearchResult": "goog:EntitySearchResult",
    "detailedDescription": "goog:detailedDescription",
    "resultScore": "goog:resultScore",
    "kg": ""
  "@type": "ItemList",
  "itemListElement": [
      "@type": "EntitySearchResult",
      "result": {
        "@id": "kg:/m/015lhm",
        "name": "Chuck Norris",
        "@type": [
        "description": "Martial Artist",
        "image": {
          "contentUrl": "",
          "url": ""
        "detailedDescription": {
          "articleBody": "Carlos Ray \"Chuck\" Norris is an American martial artist, actor, film producer and screenwriter. After serving in the United States Air Force, he began his rise to fame as a martial artist, and has since founded his own school, Chun Kuk Do.\n",
          "url": "",
          "license": ""
        "url": ""
      "resultScore": 729.463074

Not really "Knowledge Graph" style. Where is the linked data like movies etc.?

Back to the homepage. Et voilà, better read before you judge:

"Note: The Knowledge Graph Search API returns only individual matching entities, rather than graphs of interconnected entities. If you need the latter, we recommend using data dumps from Wikidata instead."

But why Google calls it "Knowledge Graph Search" then? Hopefully they'll change their minds in the near future...

Nevertheless, I've created a new ABAP Open Source project to use the Google Knowledge Graph Search: zGKGS

Google Knowledge Graph Search API for ABAP

With just a few lines of code you get nice results:

DATA(google_knowledge_graph_search) = NEW zcl_gkgs_api( i_api_key = 'Your_API_Key' ).

    i_query     = 'sap'
    i_limit     = 5
    e_results   = DATA(results)


  cl_demo_output=>begin_section( title = <result>->get_result( )->get_description( ) ).

  IF <result>->get_result( )->get_image( ) IS BOUND.
    cl_demo_output=>write_html( html = |<image src="{ <result>->get_result( )->get_image( )->get_content_url( ) }"/>| ).

  cl_demo_output=>write_text( <result>->get_result( )->get_detailed_description( )->get_article_body( ) ).
  cl_demo_output=>end_section( ).


cl_demo_output=>display( ).

How does it work? Well, the most interesting part of zGKGS is my next open source project: SchemA

SchemA: The ABAP framework

What is

" is a collaborative, community activity with a mission to create, maintain, and promote schemas for structured data on the Internet, on web pages, in email messages, and beyond."

It's a project sponsored by Google, Microsoft, Yahoo and Yandex and runs under the hood of W3C. More information you can find on the homepage of

Based on the objects, I've created an OO framework in ABAP. Let's look at an example:

DATA(organization) = NEW zcl_schema_organization( ).

organization->set_legal_name( 'SAP SE' ).
organization->set_founding_date( '19720401' ).
organization->set_address( NEW #( ) ).
organization->get_address( )->set_address_country( 'DE' ).
organization->get_address( )->set_address_locality( 'Walldorf' ).

DATA(founder) = organization->get_founder( ).
INSERT NEW zcl_schema_person( ) INTO TABLE founder ASSIGNING FIELD-SYMBOL(<founder>).
<founder>->set_name( 'Claus Wellenreuther' ).
INSERT NEW zcl_schema_person( ) INTO TABLE founder ASSIGNING <founder>.
<founder>->set_name( 'Hans-Werner Hector' ).
INSERT NEW zcl_schema_person( ) INTO TABLE founder ASSIGNING <founder>.
<founder>->set_name( 'Klaus Tschira' ).
INSERT NEW zcl_schema_person( ) INTO TABLE founder ASSIGNING <founder>.
<founder>->set_name( 'Dietmar Hopp' ).
INSERT NEW zcl_schema_person( ) INTO TABLE founder ASSIGNING <founder>.
<founder>->set_name( 'Hasso Plattner' ).
organization->set_founder( founder ).

cl_demo_output=>display_json( organization->get_json( ) ).

If (hopefully) everything works fine you'll get a response in JSON-LD (linked data) format:

   "name":"Claus Wellenreuther"
   "name":"Hans-Werner Hector"
   "name":"Klaus Tschira"
   "name":"Dietmar Hopp"
   "name":"Hasso Plattner"
"legalName":"SAP SE"

To validate the output, you can copy the string and paste it into the JSON-LD playground page on .

Need help

If you look at the page you'll see, that there are hundreds of objects to be created in ABAP. If you want to support the SchemA project, please go to the project wiki under and read the instructions (will be created soon). Thank you!

These projects are created under NW7.50 SP1 and tested under NW740 SP10 but the target version should be NW7.40 SP8, so please let me know if there are some syntax errors.


The next time your supplier of choice asks you in which format they can expect your purchase order, just response with: :wink: