Introduction

Dydra is a cloud-based RDF database service that provides a SPARQL endpoint and REST API. This article explains how to programmatically register RDF data using the Dydra API.

Prerequisites

  • Dydra account
  • API key
  • Node.js environment (v16 or higher recommended, when using Node.js)

Note: The code examples in this article use the following as samples:

  • Account name: your-account
  • Repository name: your-repository
  • API key: your_api_key_here

When actually using these, replace them with your own Dydra account information.

API Basic Information

Endpoint Structure

SSS:PPtAAaUhRRtRtQQeLtLLm:pesQUnh:uptt/edst/ra:pdytsy:e/:d:s/r/t/as/ad.pstycapedoramrmqrea/lqn.yltco(souG(mrEP(/-TOP{a)SOacTScc)Tco/ouGunEntTt//}yD/oE{uLrrEe-TprEoe)spiotsoirtyo}ry

Authentication

Dydra uses Bearer token authentication:

Authorization:BearerYOUR_API_KEY

Implementation Methods

The Dydra API can be accessed using various methods including curl, Python, and Node.js. Each method is introduced below.

Method 1: curl Implementation (Simplest)

With curl, data registration is possible immediately without any programming language.

Basic Authentication

#eexxAppPooIrrttDDYYDDRRAA__ABPAIS_EK_EUYR=L"=y"ohutrt_pasp:i/_/kdeyyd_rhae.rceo"m/your-account/your-repository"

Registering Data in Turtle Format

#cudr--"alHH-$td{a-""aD.XACtYtuoaDtPtn-RlOhtbASoei_TrnnBitaA\z-rSaTyEty_ip@UoedRn:aL:t}taBe.sexttattar/lteteru\mre$tn{ltDesY""DR\A_API_KEY}"\

Example data.ttl:

@@eppxrr:eedffodeeiiccxxxxut::mesfedertixcnmol:ttsree0:aS<r0tgihm1ieztstLet:alopec2:<ea0/hx"t4/t:i8etDo5xpon7a:c6m/u"p/m"o.lpeseun;f.rt:ol/r.;/gprrgojdecc/tt/efrimlse/.>pdf";

Registering Inline Data

ceuxr--:"lHH-t$deee{-""asxxDXACtt::Yuoa0naDPtn0agROht'1meASoe@e_Trnpa3Bitr"0A\z-eeJSaTfxoEtyi:h_ipxPnUoeeRn:erDL:xso}t:oe/Ben"sex<tath;;ar/ttetterupmr:e$t/n{l/tDeesY"x"DaR\mAp_lAeP.Io_rKgE/Y>}"\

Registering with SPARQL UPDATE

cPI}uRN"r--ESG}"lHH-FER\$dIRAe{-""aXTPxDXACtH:deYuoadDdcxDPtncA<ot:ROht"tThcesASoePeAturt_TrnRrtmmoBitEm{pesrA\z-Fs:n:aSaTI:/ttgEtyX/0ie_ip<e0tLUoeehx2loRn:xtaecL::tmaa}app\t/Bp<:le"iseph/exopalt/.:naritpoDrecpur\qra:rgc"lt/l/u"s"$i.dm3{eooe;:Dnxrcn/Y/agut/Dsm/mbRppde;uAalcnc_retkAq.tsePloe>tI-rr/_ugm{dKp/soEd>/cYa>.}tp"ed"f\".

Executing SPARQL Queries

#cuGr--"ElHH-$Td{-""aDGAAtYucaD\tc-RheuAopr_rtlBi:eAznSaacEtpo_ipdUoleRniL:c"}aq/Btuseiepaorarnyre/=qrsSlpE"$aL{rEDqCYlTD-RrAe_sWAuHPlEItR_sEK+Ej{Ys}o?"ns"?p?o}LIMIT10"\

Deleting Data

cD}uE"r--Le"lHH-Ex\$dT:{-""aEdDXACtoYuoaWcDPtnHuROht"EmASoePRe_TrnREnBitEtA\z-F{0SaTI0EtyX1_ipUoee?Rn:xpL::}a?/Bp<osephpaltaritrecpqra:lt/"$i{eDnxY/aDsmRppAal_reAq.PloI-r_ugKp/Ed>Ya}t"e"

Registering in JSON-LD Format

c}u'r--"}"""""lHH-@,@@de$dc""itcx{-""aoeddyt:DXACtnxc"pefYuoat"t:eriDPtne:e"mlROht'xr":seASoe{t"me:S_Trn"hsx"tiBit:t":eizA\z-t:dxteSaT{po:l"Ety:"cDe:_ip/huo"Uoe/tmc:1Rn:eteu0L:xpnm"2}aa:teJ4/Bpm/0nS0sepp/0tO0tallp3"N0arieu",-tec.r,LeraolDmtr.e$igDn{orotDn"gcsY/,/u"DldmRdceA+/n_jttAse"Por,Inm_"sK/E\"Y}"\

curl Script Example

A shell script for registering multiple files consecutively:

Authorization:BearerYOUR_API_KEY

0

Checking Responses

Authorization:BearerYOUR_API_KEY

1

Method 2: Python Implementation

Authorization:BearerYOUR_API_KEY

2

Method 3: Node.js/TypeScript Implementation

Basic Setup

First, install the required packages:

Authorization:BearerYOUR_API_KEY

3

Save the API key in an environment variable file (.env):

Authorization:BearerYOUR_API_KEY

4

Dydra Client Class Implementation

Authorization:BearerYOUR_API_KEY

5

Node.js Usage Examples

Basic Data Registration

Authorization:BearerYOUR_API_KEY

6

Registration with SPARQL UPDATE

Authorization:BearerYOUR_API_KEY

7

Searching Data

Authorization:BearerYOUR_API_KEY

8

Comparison of Implementation Methods

MethodAdvantagesDisadvantagesRecommended Use
curlNo environment setup needed, immediate execution, automatable with shell scriptsComplex logic is difficult, weak error handlingQuick tests, simple batch processing, CI/CD pipelines
PythonReadable, rich libraries, integration with data analysisLower type safetyData analysis, script processing, machine learning integration
Node.js/TSType safety, good async processing, Web API integrationInitial setup requiredWeb applications, large-scale systems, production environments

Summary

By using the Dydra API, you can flexibly and programmatically manage RDF data.

Guidelines for Choosing an Implementation Method

Use curl (shell scripts) when:

  • Quick testing and validation
  • Automation in CI/CD pipelines
  • Minimizing environment setup
  • Simple batch processing

Use Python when:

  • Integration with data analysis
  • Integration with machine learning pipelines
  • Complex data transformation processing
  • Prototyping in Jupyter Notebooks

Use Node.js/TypeScript when:

  • Web application development
  • Type safety is important
  • Large-scale systems
  • Long-term production environment operation

Important Points

  1. API key management: Use environment variables, don’t hardcode in code
  2. Error handling: Retry logic and appropriate logging
  3. Rate limiting: Set appropriate delays between requests
  4. Validation: Check RDF syntax before data registration
  5. Batch processing: Split and process large volumes of data

Next Steps

Use the patterns introduced in this article to build a robust RDF data management system.

References