In the following, the available REST services are described. There are 3 services available:
closest-concepts
,
get-vector
, and get-similarity
.
This service allows you to receive the numeric vectors for a certain lemma.
General structure of the REST call:
[GET] /rest/get-vector/<data_set>/<concept_name>
data_set
wordnet
wiktionary
dbpedia
alod
concept_name
The name of the concept you want to query for. If the concept cannot be found, the response will be empty. You do not need to ask for URIs, you can enter normal words like in the Web UI example.
In the following, an example is given for the concept sleep on data set wiktionary.
[GET] /rest/get-vector/wiktionary/sleep
When fired, the server will return the answer in JSON format where the vector is an array of floating point numbers:
{ "uri": "http://kaiko.getalp.org/dbnary/eng/sleep", "vector": [0.7935478,0.34723923,0.6721639,-0.019810459,-0.15017982,-0.6243264,-0.12236662,-0.45387602,0.88100827,-0.28415465,0.06035456,-0.13745455,0.21021213,-0.4092506,-0.061596267,0.5861578,0.65926766,-0.15599288,0.43347695,-0.45958757,0.31304064,-0.6751225,-0.017463384,0.46841672,0.039200056,0.116382174,-0.5076254,-0.18703738,-0.823005,-0.15496953,-0.12748022,0.73010737,-0.288432,-0.26590946,-0.56788224,0.67838734,0.7749626,-0.17082359,-0.38352302,0.25298098,-0.81514674,0.013122524,-0.82460135,0.11330452,-0.3370851,0.0750213,0.03187572,-0.7630315,0.029597264,0.32893032,-0.7369179,0.2047105,-0.57796407,-0.5617954,-0.16874518,0.39666107,-0.5156271,0.4798895,0.5170347,0.104611985,0.21432407,0.028089866,-0.4059123,-0.08961445,0.25963566,0.01504139,-0.15827355,0.17774658,-0.40097132,-0.3485971,-0.12102055,0.3062626,-0.58234006,-0.67561424,0.32306927,0.28528386,-0.7200238,-0.20671526,-0.19572467,-0.04241313,0.35764676,-0.27391458,-0.23864652,0.20495647,0.2486413,0.06953669,-0.31402144,0.15615517,0.8122481,0.8732661,0.030728064,-0.9308624,0.0662439,0.44217756,-0.28581846,-0.29992914,-0.050776254,0.45802504,0.07236431,0.10936561,0.8660568,0.41807482,0.644739,0.6975536,-0.06680537,-0.05787043,-0.13926376,0.8385125,0.10218436,-0.00065822946,0.46765438,-0.5235384,-0.6096736,0.27325904,0.2916407,0.7088933,0.5346554,0.5097416,-0.7378224,0.9523104,-0.15857977,0.56043935,0.244562,-0.7396658,-0.32645068,-0.5682357,-0.11000771,0.28649834,-0.088837944,0.92170155,0.2300782,0.3837539,-0.21443196,-0.19370763,-0.10761596,0.88256204,-0.15428877,0.020173963,0.084682204,-0.22501446,0.52027756,0.1325686,-0.29835093,0.24490991,0.66941124,-0.1940972,-0.5034381,0.9181467,0.08704886,0.15519622,0.27265885,0.28283232,1.35786,-0.08965901,0.10675029,0.19761175,0.42335218,-0.8561375,-0.60805464,0.44388428,-0.13991822,-0.19750583,-0.6483285,-0.8404759,-0.79907274,0.4605258,0.3959063,0.19671535,-0.14238136,-0.06885724,-0.375293,-0.08343569,0.43800595,0.28118718,0.22373658,-0.0033631523,0.35825244,0.069509275,0.38863903,0.34926373,-0.7152305,-0.3854102,-0.059116643,0.6608139,0.1602191,-0.34308404,0.46839887,-0.5431763,0.34474742,0.065850824,0.4314087,-0.24815631,-0.31247425,0.2245021,-0.06618229,0.838385,-1.3544155,0.28741232,1.0400295,-0.28453875]}For the wordnet data set, multiple vectors might be returned depending on the part of speech of the vector:
[GET] /rest/get-vector/wordnet/sleep
{ "result": [{"uri": "wn-lemma:sleep#sleep-v",
"vector":
[-0.49828112,-0.108135976,-0.20539452,1.213664,-0.5575017,-0.16172783,0.3793976,-0.00066978176,-0.17287019,-0.59889287,0.11858537,0.32874525,-0.5791718,0.1418848,-0.43693748,1.001931,-0.06999392,-0.23818398,-0.46768212,0.46032366,-0.18184167,-0.19920458,-0.43928307,0.33680043,0.39127073,0.6760334,-0.59175986,-0.04601479,-0.10169759,0.3528951,0.21312667,-0.11538065,0.13878311,0.0800816,0.11320385,-0.8111051,-0.25400758,0.3112132,-0.38247964,0.22494605,-0.05214491,0.11303755,0.01755011,-0.38033822,-0.38460252,0.78054625,0.41050994,-0.011213408,-0.23196948,0.26044783,-0.1483032,0.22014797,0.1489398,0.52760345,-0.48407394,-0.047461268,0.119148925,0.7769975,-0.48904565,0.33267274,0.44878006,-0.11036211,-0.09461127,0.24891433,0.7329821,-0.19576493,-0.19895227,-1.4125232,0.49932772,-0.56706995,-0.3047483,0.7009845,0.1452038,-0.1746493,0.26112768,0.651966,-0.90453744,0.54699534,0.20954973,0.45581734,-0.11107032,0.8068425,0.09902544,0.07336642,0.45884457,0.29801682,0.4369496,-0.24427179,-0.44674248,-0.04636466,-0.048555687,-0.05136479,-0.052214272,0.44188556,-0.40679306,0.24123041,0.18949576,0.67890936,-0.32910496,0.21674417,0.4152804,0.3326186,-0.10870729,0.014363483,-0.03477271,0.34373623,-0.20381494,-0.03593162,0.36170825,0.2327241,-0.68393004,0.4991351,0.6805309,0.3472195,-0.18735142,-0.49111438,-0.12537183,-0.030123554,-0.41959277,-0.22174083,-0.023490231,-0.11283351,-0.3837524,0.07887577,0.0061684437,-0.43809485,0.04400128,0.07159627,-0.27828392,0.09962994,0.34864154,-0.15716627,-0.16658252,0.0031965617,0.24083234,-0.23151249,-0.11265132,-0.2502271,-0.08045123,-0.03720554,0.24005176,0.10269402,0.34843773,-0.2224601,0.2019702,0.5876644,-0.4195897,-0.13264741,0.19080764,-0.376689,-0.29342937,-0.63270855,-0.28950873,-0.26928264,0.003593132,0.8897567,-0.5462638,-0.37421972,-0.009260218,0.30802608,-0.7976355,0.46878484,0.1778865,0.013548684,-0.35992604,0.44195074,0.18384461,0.2585864,-0.07804032,0.10142447,0.16755825,0.2014216,0.5606803,-0.16223906,-0.26840892,-0.026140675,-0.027188564,-0.4152893,0.35509413,0.50867176,0.33656353,-0.049583953,0.027092118,-0.41683906,-0.7625801,0.3526725,0.015679767,0.16629721,0.20267381,0.25295275,1.0449364,0.34981364,-0.41647425,-0.16566278,-0.362375,0.32589254,0.29861647,-0.064705126,0.037446123,0.11951483]},
{"uri": "wn-lemma:sleep#sleep-n",
"vector":
[-0.088241085,0.15326148,-0.19255559,1.0661398,-0.059722405,0.035734512,-0.07968644,-0.18951139,-0.4705959,-0.44680777,0.2536324,0.05067906,0.025717836,-0.12936217,-0.47420436,0.7780619,0.19387881,0.74841607,-0.47501695,0.25396156,-0.30887493,-0.26532328,-0.17619503,0.008770028,-0.13018659,0.4908138,-0.6728384,-0.21262363,-0.041756,-0.00582622,0.3348555,-0.112338185,0.03420628,0.10332694,-0.28413603,-0.65482956,0.12295129,0.057152957,0.03763476,-0.06499345,-0.22542289,0.48316804,0.37467,-0.08323449,0.08865295,0.44746247,0.41328415,-0.3133151,-0.15974756,0.25805056,0.07433502,0.34426427,0.49077952,0.30561844,-0.1686531,-0.30485192,0.42509204,0.09100246,-0.5407857,-0.13590157,-0.14818418,0.16737829,-0.0870441,0.29523978,0.433621,-0.21593603,-0.26953435,-0.93798673,0.025192581,-0.05485965,-0.19152546,0.12792642,0.17557725,-0.20590682,0.036555026,0.5459339,-0.13698304,0.20538919,0.2734462,0.506366,0.2312061,0.672844,-0.055212323,-0.2603576,0.52759457,0.58784366,0.20234747,-0.31241485,-0.5378828,0.4020905,-0.24246228,-0.103085056,0.41265443,0.15083842,-0.18914211,-0.00072468957,0.20333448,0.4303447,-0.5103681,0.16604984,0.43625215,0.20244563,-0.35481396,0.25377974,-0.6205846,0.5025386,0.040644154,-0.18106303,0.015293554,0.26154605,-0.62335366,0.19371948,0.103519954,0.14863142,-0.50793636,-0.4372266,0.03690311,-0.15599515,-0.18069573,-0.51614165,-0.053675275,0.38253072,-0.5613389,-0.15027153,0.34336296,-0.12314055,0.13658573,0.22830278,0.025927257,0.33434573,0.082274616,-0.031751346,-0.6434827,-0.2286534,0.61949176,-0.92899597,-0.21480478,0.4922682,-0.18608624,0.23575728,-0.13713558,0.17835623,0.04262052,0.011598014,-0.5137892,0.96906763,-0.5141165,0.16822578,-0.646022,-0.015238133,-0.23614095,-0.14851785,-0.654947,-0.5183261,-0.38243818,0.25094718,-0.84829384,-0.42066413,0.51483375,0.22597066,-0.5734032,0.3530834,0.5126445,-0.0748965,-0.30602625,0.34926972,-0.3252022,0.420629,-0.23471667,-0.052271523,0.377569,0.5918693,0.81416833,-0.36756116,-0.22202858,-0.027595168,-0.6094219,-0.389808,-0.17715326,0.25590128,0.17994235,0.5182919,0.436511,-0.4223034,-0.76286846,0.07689928,0.3009435,-0.0621059,0.0134910345,0.2863313,0.7051465,0.13258947,-0.5315987,-0.13301317,-0.083012365,0.430609,0.3198612,-0.10997877,0.30370405,-0.28179568]}]
}
This service allows you to receive the numeric vector similarity for two given lemmas.
General structure of the
REST call:
[GET] /rest/get-similarity/<data_set>/<concept_name_1>/<concept_name_2>
data_set
wordnet
wiktionary
dbpedia
alod
concept_name_1
concept_name_2
[GET] /rest/get-similarity/alod/king/queen
When fired, the server will return the answer in JSON format where the similarity is returned as a floating point number:
{ "result" : 0.5687762651854058 }This service is also used for the Web UI demo.
General structure of the REST call:
[GET] /rest/closest-concepts/<data_set>/<top_n>/<concept_name>
data_set
wordnet
wiktionary
dbpedia
alod
top_n
concept_name
In the following, an example is given for the concept sleep on data set wiktionary . The 10 closest concepts shall be returned:
[GET] /rest/closest-concepts/wiktionary/10/sleep
When fired, the server will return the answer in JSON format:
{"result":[{"concept":"http://kaiko.getalp.org/dbnary/eng/sleep","score":1},{"concept":"http://kaiko.getalp.org/dbnary/eng/shut-eye","score":0.8186817477549158}, {"concept":"http://kaiko.getalp.org/dbnary/eng/slumber","score":0.7709401272832646},{"concept":"http://kaiko.getalp.org/dbnary/eng/saw_wood","score":0.7634760538108614}, {"concept":"http://kaiko.getalp.org/dbnary/eng/saw_logs","score":0.7551617987366845},{"concept":"http://kaiko.getalp.org/dbnary/eng/catnap","score":0.7313411291570826}, {"concept":"http://kaiko.getalp.org/dbnary/eng/snooze","score":0.7308778501775014},{"concept":"http://kaiko.getalp.org/dbnary/eng/rheum","score":0.6954013149849927}, {"concept":"http://kaiko.getalp.org/dbnary/eng/rest","score":0.6923312186663374},{"concept":"http://kaiko.getalp.org/dbnary/eng/doze","score":0.691527738756718}]}This service allows you to generate RDF2Vec Light vectors for the specified URIs.
[GET] /rest/rdf2vec-light/dbpedia/number_of_walks/training_mode/dimensions
Important: The specified concepts have to be set in the header of the request using variable name entities
.
You can find an extensive python example on GitHub.
data_set
dbpedia
number_of_walks
training_mode
cbow
sg
dimensions
Are you missing something or did you spot an error? Do not hesitate to contact us.