Concept Of Nearest Neighbors

From an RDF Graph and a text file containing the target nodes, apply the Partitioning Algorithm to find the nearest neighbor

Parameters :

<rdfFilePath> <targetNodesFile> [--t=<time_limit>] [--d=<description_depth_limit>] [--v=<verbose_mode>]

The RDF File's format is automatically recognized, make sure it has the right extension
The text file must contain one URI per line, these URI will all be used for a different partition with the same parameters


--d=<description_depth_limit> : How far from the target node a node must be at most to describe it. default=1
--t=<time_limit> : Sets a time limit for the algorithm in seconds. If set to 0, no time limit. default = 0. IT IS VERY DEPRECATED TO OMMIT THE TIME LIMIT.
--v=<verbose_mode> : Sets the level of verbosity :
* off : nothing is printed except the final result and error messages
* silent : during execution a line is printed at every iteration of the algorithm, this acts as a watcher to be sure that the algorithm isn't staggering
* verbose : during execution, the algorithm goes in great details to tell what it's doing


Get the results of your partition in the results-<time>.json file created at the end of the algorithm


If you don't have a RDF file at your disposition, you can copy this inside a .ttl file :
@prefix : <> .
@prefix rdf: <> .
@prefix rdfs: <>.
:man rdfs:subClassOf :human.
:woman rdfs:subClassOf :human.
:corgi rdfs:subClassOf :dog.
:human rdfs:subClassOf :living.
:dog rdfs:subClassOf :living.
:George a :man ;
:parent :William, :Kate .
:Harry a :man ;
:parent :Charles, :Diana.
:William a :man ;
:parent :Charles, :Diana.
:Charles a :man .
:Charlotte a :woman ;
:parent :William, :Kate .
:Kate a :woman .
:Diana a :woman .
:Vulcan a :corgi.
:Candy a :corgi.
and this into a .txt file :

In order to run a job you need to be identified or register a new account.

The following curl command will create a job:

# create a job for this app with the ID 1030
curl -H 'Authorization: Token token=<your private_token>' -X POST
  -F 'job[webapp_id]=1030'
  -F 'job[param]='
  -F 'job[queue]=standard'
  -F 'files[0]=@test.txt'
  -F 'files[1]=@test2.csv'
  -F 'job[file_url]=<my_file_url>'
  -F 'job[dataset]=<my_dataset_name>'

Checkout the result:

curl -H 'Authorization: Token token=<your private_token>' '<job_id>'