Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update README with RDF Query notes #163

Merged
merged 2 commits into from
Dec 10, 2020
Merged

Conversation

bucanero
Copy link
Contributor

@bucanero bucanero commented Dec 10, 2020

This PR adds query RDF response notes

Fixes DGRAPH-2355


This change is Reviewable

Add query RDF response notes
@bucanero bucanero added the area/documentation Documentation related issues. label Dec 10, 2020
@CLAassistant
Copy link

CLAassistant commented Dec 10, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@abhimanyusinghgaur abhimanyusinghgaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @bucanero)


README.md, line 438 at r1 (raw file):

calling `queryRDFWithVars()`.

... calling either queryRDF() or queryRDFWithVars()


README.md, line 441 at r1 (raw file):

**Note**: If you are querying for `uid` values only, use a JSON format response

nice!


README.md, line 447 at r1 (raw file):

Quoted 6 lines of code…
Mutation mu =
    Mutation.newBuilder()
        .setCommitNow(true)
        .setSetJson(ByteString.copyFromUtf8(jsonData.toString()))
        .build();
Response muRes = dgraphAsyncClient.newTransaction().mutate(mu).join();

we can remove these lines, let's only show how to query.


README.md, line 458 at r1 (raw file):

Quoted 4 lines of code…
// Verify data as expected
assertEquals(muRes.getUidsMap().values().size(), 1);
String uid = (String) muRes.getUidsMap().values().toArray()[0];
assertEquals(response.getRdf().toStringUtf8(), "<" + uid + "> <name> \"Alice\" .\n");

for documentation we can write in a similar manner to the running a query section as follows:

// Print results
System.out.println(response.getRdf().toStringUtf8());
(--- code block ends here --- with ```)

This should print (assuming Alice's uid is 0x2):

<0x2> <name> "Alice" .

@bucanero bucanero merged commit 3b4423c into master Dec 10, 2020
@bucanero bucanero deleted the bucanero/rdf-queries-doc branch December 10, 2020 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Documentation related issues.
Development

Successfully merging this pull request may close these issues.

3 participants