NAME

NNexus::Job - Low-level API for servicing Job Requests to NNexus

SYNOPSIS

use NNexus::Job;
$job = NNexus::Job->new(
  db=>$db,
  body=>$body,
  format=>$format,
  function=>$function,
  domain=>$domain);

$job->execute;

$response = $job->response;
$result = $job->result;
$message = $job->message;
$status = $job->status;

DESCRIPTION

This class serves as an encapsulation for users' NNexus requests, driven by a minimal API.

METHODS

$job = NNexus::Job->new(%options);

Creates a new job object, customized via an options hash. Admissible options are:

  • body: The textual payload to be autolinked/indexed/etc.

  • format: The format of the given body. Supported: tex|html

  • function: Operation to be performed. Currently supported:

    • linkentry: Autolinks a given body returning a result in the same format

    • indexentry: Indexes a given web resource (URL), given by the "url" option

  • url

    • for function "indexentry": URL at which to begin an indexing job

    • for function "linkentry": URL to record for change management and invalidation

  • domain: Domain to use as the reference knowledge base for autolinking/indexing

  • anntation: serialization format for annotation (links, JSON, RDFa)

  • embed: boolean for embedded or stand-off annotations

  • db: An initialized NNexus::DB object (typically internal)

  • verbosity: boolean switching verbose logging on and off

  • dom: (optional) overrides the Mojo::DOM object for the given url (function='indexentry')

  • should_update: boolean switching between updating all indexed objects (default) or only indexing new objects instead. (function='indexentry')

$job->execute;

Executes the job prepared by the new method.

$response = $job->response;

Retrieves the job result. Returns a hash ref with three fields:

  • result: the job result (e.g. a payload for a linking job)

  • message: a human-readable description of the job

  • status: a machine-readable status report

$result = $job->result;

Shorthand for $job->response->{result}

$status = $job->status;

Shorthand for $job->response->{status}

$message = $job->message;

Shorthand for $job->response->{message}

SEE ALSO

NNexus, nnexus, NNexus::Manual

AUTHOR

Deyan Ginev <d.ginev@jacobs-university.de>

COPYRIGHT

Research software, produced as part of work done by 
the KWARC group at Jacobs University Bremen.
Released under the MIT License (MIT)