org.opentox.toxotis.core.component
Class Dataset

java.lang.Object
  extended by org.opentox.toxotis.core.OTComponent<T>
      extended by org.opentox.toxotis.core.OTOnlineResource<T>
          extended by org.opentox.toxotis.core.OTPublishable<Dataset>
              extended by org.opentox.toxotis.core.component.Dataset
All Implemented Interfaces:
Serializable, IOnlineResource, IOTComponent, IStAXWritable

public class Dataset
extends OTPublishable<Dataset>

A dataset provides access to chemical compounds and their features (e.g. structural, physical-chemical, biological, toxicological properties)

Author:
Pantelis Sopasakis, Charalampos Chomenides
See Also:
Serialized Form

Field Summary
static String COMPOUND_URI
           
 
Fields inherited from class org.opentox.toxotis.core.OTOnlineResource
XSD_DATATYPE_LINKS
 
Fields inherited from class org.opentox.toxotis.core.OTComponent
meta, RDF_ABOUT, RDF_RDF, RDF_RESOURCE, RDF_TYPE
 
Constructor Summary
Dataset()
          Dummy constructor for a dataset.
Dataset(List<DataEntry> dataEntries)
          Create a new Dataset object providing a list of data entries.
Dataset(VRI uri)
          Constructor for a Dataset object providing its URI.
 
Method Summary
 com.hp.hpl.jena.ontology.Individual asIndividual(com.hp.hpl.jena.ontology.OntModel model)
          The OpenTox component as an individual.
 Task calculateDescriptors(VRI descriptorCalculationAlgorithm, AuthenticationToken token)
           
 int countCompounds()
           
 int countFeatures()
           
 boolean equals(Object obj)
           
 Set<Feature> getContainedFeatures()
          All features in the dataset.
 Set<VRI> getContainedFeatureUris()
          The set of all feature URIs in the dataset.
 List<DataEntry> getDataEntries()
           
 Set<FeatureValue> getFeatureValues()
           
 weka.core.Instances getInstances()
          

Creates and returns a weka.core.Instances object from the data contained in this Dataset.

 long getTimeDownload()
           
 long getTimeInstancesConversion()
           
 long getTimeParse()
           
 int hashCode()
           
protected  Dataset loadFromRemote(VRI uri, AuthenticationToken token)
          Loads an OpenTox component from a remote location identified by its uri and parses it into an instance of T.
 Task publishOnline(AuthenticationToken token)
          Publish the component to a standard (default) server.
 Task publishOnline(VRI vri, AuthenticationToken token)
          Publish the component to a proper server identified by the uri of the publishing service provided in this method.
 void setDataEntries(List<DataEntry> dataEntries)
           
 void writeRdf(XMLStreamWriter writer)
          Due to the large size of some dataset objects, it is advisable to use this method for serializing dataset objects to RDF/XML rather than the method OntModel#write(OutputStream).
 
Methods inherited from class org.opentox.toxotis.core.OTPublishable
publish, publish
 
Methods inherited from class org.opentox.toxotis.core.OTOnlineResource
download, download, download, download, downloadImage, loadFromRemote, loadFromRemote
 
Methods inherited from class org.opentox.toxotis.core.OTComponent
addOntologicalClasses, asOntModel, endRdfWriter, getMeta, getOntologicalClasses, getUri, initRdfWriter, isEnabled, setEnabled, setMeta, setOntologicalClasses, setUri, writeAnnotationProperty, writeClass, writeDatatypeProperty, writeMetaDataProperties, writeObjectProperty, writeRdf, writeRdf, writeSuperClassRelationships
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opentox.toxotis.core.IOTComponent
addOntologicalClasses, asOntModel, getMeta, getOntologicalClasses, getUri, isEnabled, setEnabled, setMeta, setOntologicalClasses
 

Field Detail

COMPOUND_URI

public static final String COMPOUND_URI
See Also:
Constant Field Values
Constructor Detail

Dataset

public Dataset(VRI uri)
        throws ToxOtisException
Constructor for a Dataset object providing its URI.

Parameters:
uri - The URI of the created Dataset
Throws:
ToxOtisException - In case the provided URI is not a valid dataset URI according to the OpenTox specifications.

Dataset

public Dataset()
Dummy constructor for a dataset. Creates an empty dataset.


Dataset

public Dataset(List<DataEntry> dataEntries)
Create a new Dataset object providing a list of data entries.

Parameters:
dataEntries -
Method Detail

getFeatureValues

public Set<FeatureValue> getFeatureValues()

writeRdf

public void writeRdf(XMLStreamWriter writer)
              throws XMLStreamException
Due to the large size of some dataset objects, it is advisable to use this method for serializing dataset objects to RDF/XML rather than the method OntModel#write(OutputStream). It has been shown that this method performs much faster (about 7,5 times faster on a dataset of 21 features and 1000 compounds).

Parameters:
writer - XML Stream Writer used for the serialization of the dataset object.
Throws:
XMLStreamException - In case the serialization is not possible due to syntax errors.

publishOnline

public Task publishOnline(VRI vri,
                          AuthenticationToken token)
                   throws ServiceInvocationException
Description copied from class: OTPublishable
Publish the component to a proper server identified by the uri of the publishing service provided in this method. The resource will be posted to the server in RDF format (application/rdf+xml).

Specified by:
publishOnline in class OTPublishable<Dataset>
Parameters:
vri - URI of the service that is responsible for the publication of this kind of resources.
token - Provide an authentication token. If you think that the service does not require auhtentication/authorization, you can leave this field null or you can provide an empty authentication token. If the provided URI already contains an authentication token (as the URL parameter tokenid) it will be replaced by the new token provided to this method.
Returns:
A Task for monitoring the progress of your request. If the service returns the URI of the resource right away and does not return a task, then the object you will receive from this method will now have an identifier, its status will be set to Completed, its progress will be set to 100% and the URI of the created resource will be available applying the method Task.getResultUri() on the returned task. In any case, the service's response will be wrapped in a Task object.
Throws:
ServiceInvocationException

publishOnline

public Task publishOnline(AuthenticationToken token)
                   throws ServiceInvocationException
Description copied from class: OTPublishable
Publish the component to a standard (default) server. The resource will be posted to the server in RDF format (application/rdf+xml). If you want to specify at which server the resource should be posted, use the other method.

Specified by:
publishOnline in class OTPublishable<Dataset>
Parameters:
token - Provide an authentication token. If you think that the service does not require auhtentication/authorization, you can leave this field null or you can provide an empty authentication token.If the provided URI already contains an authentication token (as the URL parameter tokenid) it will be replaced by the new token provided to this method.
Returns:
A Task for monitoring the progress of your request. If the service returns the URI of the resource right away and does not return a task, then the object you will receive from this method will now have an identifier, its status will be set to Completed, its progress will be set to 100% and the URI of the created resource will be available applying the method Task.getResultUri() on the returned task. In any case, the service's response will be wrapped in a Task object.
Throws:
ServiceInvocationException - In case of invalid credentials, if the POSTed resource is not acceptable by the remote service (returns a status code 400), communication error occur with the remote server or other connection problems or the access to the service was denied (401 or 403).
See Also:
alternative method

getDataEntries

public List<DataEntry> getDataEntries()

setDataEntries

public void setDataEntries(List<DataEntry> dataEntries)

asIndividual

public com.hp.hpl.jena.ontology.Individual asIndividual(com.hp.hpl.jena.ontology.OntModel model)
Description copied from interface: IOTComponent
The OpenTox component as an individual.

Parameters:
model - The ontological model to which the individual belongs.
Returns:
The OpenTox component as an individual of a data model.

loadFromRemote

protected Dataset loadFromRemote(VRI uri,
                                 AuthenticationToken token)
                          throws ServiceInvocationException
Description copied from class: OTOnlineResource
Loads an OpenTox component from a remote location identified by its uri and parses it into an instance of T. This method is protected and should be implemented by all subclasses of OTOnlineResource. The method is invoked by its public counterpart OTOnlineResource.loadFromRemote(org.opentox.toxotis.util.aa.AuthenticationToken) which accesses the remote location providing an authentication token.

Specified by:
loadFromRemote in class OTOnlineResource<Dataset>
Parameters:
uri - Identifier of the location from where the component should be downloaded and parsed
token - Token provided
Returns:
Parsed instance of the component.
Throws:
ServiceInvocationException

getContainedFeatures

public Set<Feature> getContainedFeatures()
All features in the dataset.

Returns:
A set of Feature

getContainedFeatureUris

public Set<VRI> getContainedFeatureUris()
The set of all feature URIs in the dataset.

Returns:
A set of VRIs

getInstances

public weka.core.Instances getInstances()

Creates and returns a weka.core.Instances object from the data contained in this Dataset. The Instances object created has the following specific structure: The first element in each Instance is always the Compound's URI. It is identified by the keyword compound_uri. Following that comes a sequence of all Features contained the Dataset's DataEntries, described as either String,Numeric or Nominal. If a compound doesn't possess a value for a specific Feature, or the value is unreadable or unacceptable (e.g. a String value is present when a Numeric is expected), a missing value is placed instead. If a Feature is tagged as both Numeric|String and Nominal, the Nominal property wins. If it is tagged as both Numeric and String, the String property wins.

Returns:
Weka Instances from the data contained in this Dataset.

countCompounds

public int countCompounds()

countFeatures

public int countFeatures()

getTimeDownload

public long getTimeDownload()

getTimeInstancesConversion

public long getTimeInstancesConversion()

getTimeParse

public long getTimeParse()

calculateDescriptors

public Task calculateDescriptors(VRI descriptorCalculationAlgorithm,
                                 AuthenticationToken token)
                          throws ServiceInvocationException
Throws:
ServiceInvocationException

equals

public boolean equals(Object obj)
Overrides:
equals in class OTComponent<Dataset>

hashCode

public int hashCode()
Overrides:
hashCode in class OTComponent<Dataset>


Copyright © 2011-2012 OpenTox. All Rights Reserved.