pt.ua.bioinformatics.coeus.api
Class API

java.lang.Object
  extended by pt.ua.bioinformatics.coeus.api.API

public class API
extends java.lang.Object

COEUS API handler class.

Main API class for internal Java usage, use this or internal when building new data access methods!


Constructor Summary
API()
           
 
Method Summary
 boolean addStatement(com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate, boolean object)
          Adds the given triple statement to COEUS model
 boolean addStatement(com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate, com.hp.hpl.jena.rdf.model.Resource object)
          Adds the given triple statement to COEUS model.
 boolean addStatement(com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate, java.lang.String object)
          Adds the given triple statement to COEUS model
 com.hp.hpl.jena.rdf.model.Resource createResource(java.lang.String uri)
          Creates a new Resource in COEUS SDB.
 java.lang.String getIndividual(java.lang.String individual, java.lang.String format)
          Gets all properties associated with a given individual.
 com.hp.hpl.jena.rdf.model.InfModel getInferredModel()
           
 Internal getInternal()
           
 org.json.simple.parser.JSONParser getJsonparser()
           
 com.hp.hpl.jena.rdf.model.Model getModel()
           
 com.hp.hpl.jena.rdf.model.Resource getResource(java.lang.String uri)
          Gets information for a given Resource in COEUS SDB.
 java.lang.String getTriple(java.lang.String sub, java.lang.String pred, java.lang.String obj, java.lang.String format)
          Gets triple-based information according to given parameters.
 java.lang.String labelToItem(java.lang.String label)
          Extracts an item identifier from an Item label.
 java.lang.String select(java.lang.String query, java.lang.String format, boolean inferred)
          Perform a SPARQL SELECT query to COEUS SDB with multiple output formats support.
 com.hp.hpl.jena.query.ResultSet selectRS(java.lang.String query, boolean inferred)
          Perform a SPARQL SELECT query to COEUS SDB.
 void setInferredModel(com.hp.hpl.jena.rdf.model.InfModel inferredModel)
           
 void setInternal(Internal internal)
           
 void setJsonparser(org.json.simple.parser.JSONParser jsonparser)
           
 void setModel(com.hp.hpl.jena.rdf.model.Model model)
           
 java.lang.String uriToItem(java.lang.String uri)
          Extracts an item identifier from a full URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

API

public API()
Method Detail

getJsonparser

public org.json.simple.parser.JSONParser getJsonparser()

setJsonparser

public void setJsonparser(org.json.simple.parser.JSONParser jsonparser)

getInternal

public Internal getInternal()

setInternal

public void setInternal(Internal internal)

getInferredModel

public com.hp.hpl.jena.rdf.model.InfModel getInferredModel()

setInferredModel

public void setInferredModel(com.hp.hpl.jena.rdf.model.InfModel inferredModel)

getModel

public com.hp.hpl.jena.rdf.model.Model getModel()

setModel

public void setModel(com.hp.hpl.jena.rdf.model.Model model)

selectRS

public com.hp.hpl.jena.query.ResultSet selectRS(java.lang.String query,
                                                boolean inferred)
Perform a SPARQL SELECT query to COEUS SDB.

Parameters:
query - the SPARQL query (no prefixes).
format - the response format (csv, xml, json/js, rdf)
inferred - true to query on inferred model, false to query on simple model.
Returns:

select

public java.lang.String select(java.lang.String query,
                               java.lang.String format,
                               boolean inferred)
Perform a SPARQL SELECT query to COEUS SDB with multiple output formats support.

Parameters:
query - the SPARQL query (no prefixes).
format - the response format (csv, xml, json/js, rdf)
inferred - true to query on inferred model, false to query on simple model.
Returns:

getIndividual

public java.lang.String getIndividual(java.lang.String individual,
                                      java.lang.String format)
Gets all properties associated with a given individual.

Parameters:
individual - the individual COEUS id _.
format - the response format.
Returns:

getTriple

public java.lang.String getTriple(java.lang.String sub,
                                  java.lang.String pred,
                                  java.lang.String obj,
                                  java.lang.String format)
Gets triple-based information according to given parameters.

Parameters:
sub - the subject (defaults to s, sub, subject).
pred - the predicate (defaults to p, pred, predicate).
obj - the object (defaults to o, obj, object).
format - the response format.
Returns:

addStatement

public boolean addStatement(com.hp.hpl.jena.rdf.model.Resource subject,
                            com.hp.hpl.jena.rdf.model.Property predicate,
                            com.hp.hpl.jena.rdf.model.Resource object)
Adds the given triple statement to COEUS model.

Parameters:
subject - a Resource for to the statement subject.
predicate - a Property for the statement predicate.
object - a Resource for the statement object.
Returns:
success of the operation.

addStatement

public boolean addStatement(com.hp.hpl.jena.rdf.model.Resource subject,
                            com.hp.hpl.jena.rdf.model.Property predicate,
                            java.lang.String object)
Adds the given triple statement to COEUS model

Parameters:
subject - a Resource for to the statement subject.
predicate - a Property for the statement predicate.
object - a String for the statement object.
Returns:
success of the operation.

addStatement

public boolean addStatement(com.hp.hpl.jena.rdf.model.Resource subject,
                            com.hp.hpl.jena.rdf.model.Property predicate,
                            boolean object)
Adds the given triple statement to COEUS model

Parameters:
subject - a Resource for to the statement subject.
predicate - a Property for the statement predicate.
object - a boolean value for the statement object.
Returns:
success of the operation.

getResource

public com.hp.hpl.jena.rdf.model.Resource getResource(java.lang.String uri)
Gets information for a given Resource in COEUS SDB. TODO: shouldn't this be in Internal?

Parameters:
uri - the desired Resource URI.
Returns:
the loaded Resource.

createResource

public com.hp.hpl.jena.rdf.model.Resource createResource(java.lang.String uri)
Creates a new Resource in COEUS SDB.

Parameters:
uri - the URI for the new Resource.
Returns:
the newly created Resource.

uriToItem

public java.lang.String uriToItem(java.lang.String uri)
Extracts an item identifier from a full URI.

Parameters:
uri -
Returns:

labelToItem

public java.lang.String labelToItem(java.lang.String label)
Extracts an item identifier from an Item label.

Parameters:
uri -
Returns: