Posts Tagged - graphQL

RDF and SPARQL

RDF (Resource Description Framework) - modelo de datos para representar datos como grafos (datos interconectados). Está dirigido y etiquetado para representar la información en la web.

SPARQL - query language estandarizado para consulta de grafos RDF.

Cuando trabajan ambos juntos, RDF y SPARQL te permiten construir aplicaciones de grafos.

What’s an RDF Graph?

This just means data represented using the RDF data model. This is what an example of such graph may look like

An RDF grahp is a directed graph consisting of nodes which are connected together by crearly labelled relationships with directionality. These relationships are known as edges. These edges connect one node to another.

Read More

Introduction to GraphQL

What’s GraphQL?

A query language to build & query APIs. Invented by facebook in 2012, to solve its complexity in REST APIs.

It’s a good fit for companies where there’re tons of data we’d need otherwise to access through REST APIs. It’s not a replacement for REST, it’s an alternative for projects with large data sets.

GraphQL vs REST APIs

REST API

underfetching

Let’s say we want to retrieve the posts for a user and then, the comments and likes for a user’s post. In a REST API we’d have the following:

api/users/{id}/posts
api/users/{id}/posts/{postId}/comments
api/users/{id}/posts/{postId}/likes

With a single endpoint we cannot retrieve all the data. We need to call multiple endpoints to have all data we need.

overfetching

Let’s say I want to iterate the PostDescription for one user posts history. If I call the following endpoint it will give to me way more data than I need:

api/users/{id}/posts

gives back:

PostDescription UserId UserImage PostId PostCreationTime PostLocation etc.

This is way more data than I need to iterate and useless to me.

Read More