Skip to content

tamaloa/majortom_connector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MaJorToM-Connector

This gem provides easy access to any MaJorToM-Server.

Requirements

Install

  • sudo gem install majortom_connector (mandatory)

  • Copy the majortom-server.yml from the examples folder into the config folder of your Rails app and configure it to your needs (optional).

Usage

This documentation describes the use of majortom_connector version 0.0.3.

  1. Before executing any request, you must connect to the server with

    c = MajortomConnector.connect "base_iri_or_map_id"
    
  2. In case you did not provide and edit the config/majortom-server.yml you can configure the connector by calling

    c.config.(host|port|context|api_key|map_id) = your_value
  3. Check the completeness of your configuration with

    c.ready?
    

    or check, whether the configured server actually responds with

    c.established?
    
  4. Start the topic map madness.

    • Get the id of the map you are connected with

      c.topic_map_id
      
    • Get all maps that are on the server

      c.list_maps
      
    • Find the id of a map with given base locator

      c.find_topic_map_id_by_base_iri(base_iri)
      
    • Get all topics of the connected map*

      c.topics
      
    • Fire a TMQL query against the server*

      c.tmql(query)
      
    • Fire a SPARQL query against the server

      c.sparql(query)
      
    • Do a search in the fulltext index of the map that was created while loading

      c.search(query)
      
    • Receive an XTM or CTM serialization of your map with

      c.to_xtm and c.to_ctm
      
    • In case you want to clear the query cache, you can call

      c.clear_cache
      
  5. Get your data from the connector by calling

    data = c.request.result
    

The result object has several values:

  • http_status, http_message and http_body represent the data from the HTTP response

  • code says, whether all went fine (if it’s 0) or not

  • message has a message from the server for you (‘OK’ or any error message)

  • data contains the actual data that was returned from the server if no error occured

External documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%