MaJorToM-Connector¶ ↑
This gem provides easy access to any MaJorToM-Server.
Requirements¶ ↑
-
MultiJSON - github.com/intridea/multi_json
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.4.
-
Before executing any request, you must connect to the server with
c = MajortomConnector.connect "base_iri_or_map_id"
-
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
-
Check the completeness of your configuration with
c.ready?
or check, whether the configured server actually responds with
c.established?
-
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
-
-
Get your data from the connector by calling
data = c.request.result
The result object has several values:
-
http_status
,http_message
andhttp_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¶ ↑
-
You can find the JTMQR result format there: code.google.com/p/tmql/wiki/JTMQR