|
Version: 1.1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biomoby.shared.extended.ServiceInstanceParser
public class ServiceInstanceParser
An example of how to use this class is below:
import org.biomoby.shared.MobyService;
import org.biomoby.shared.Utils;
import org.biomoby.shared.extended.ServiceInstanceParser;
...
ServiceInstanceParser p = new ServiceInstanceParser(
"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances");
MobyService[] services = p.getMobyServicesFromRDF();
if (!p.isRDFValid()) {
System.out.println("One or more services in the RDF were invalid");
System.out.println("The errors are the following:");
System.out.println(Utils.format(p.getErrors(),2));
}
System.out.println("The valid services are:");
for (int i = 0; i < services.length; i++) {
System.out.println((services[i]));
}
This would output the following a textual description of service instances in the document
| Constructor Summary | |
|---|---|
ServiceInstanceParser()
Default constructor - need to set the URL for the RDF document that describes the service ontology using setURL(String url) or setURL(URL url) |
|
ServiceInstanceParser(String url)
Parameterized Constructor that takes in a string argument that is the url for the RDF document that describes the service ontology. |
|
ServiceInstanceParser(URL url)
Parameterized Constructor that takes in a url for the RDF document that describes the service ontology. |
|
| Method Summary | |
|---|---|
String |
getErrors()
|
MobyService[] |
getMobyServicesFromRDF()
|
MobyService[] |
getMobyServicesFromRDF(com.hp.hpl.jena.rdf.model.Model model)
|
MobyService[] |
getMobyServicesFromRDF(String rdf)
|
URL |
getUrl()
|
boolean |
isRDFValid()
Method to check whether an RDF document contained only valid services. |
static void |
main(String[] args)
|
void |
setUrl(String url)
|
void |
setUrl(URL url)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServiceInstanceParser()
public ServiceInstanceParser(String url)
throws MobyException
url - a string representation for the URL that resolves to the RDF
document that describes the service ontology
MobyException - thrown if the url is malformed
public ServiceInstanceParser(URL url)
throws MobyException
url - the URL that resolves to the RDF document that describes the
service ontology
MobyException - thrown if the url is malformed| Method Detail |
|---|
public MobyService[] getMobyServicesFromRDF()
throws MobyException
MobyException - thrown if the location of the RDF document describing the
service ontology is invalid or if there is a parsing error
public MobyService[] getMobyServicesFromRDF(com.hp.hpl.jena.rdf.model.Model model)
throws MobyException
model - a Model containing the Moby services that you would like to
extract
MobyException - if there is a parsing error
public MobyService[] getMobyServicesFromRDF(String rdf)
throws MobyException
rdf - a valid RDF document to be parsed into moby services
MobyException - if there are any parsing errors
public void setUrl(URL url)
throws MobyException
url - the URL that resolves to the RDF document that describes the
service ontology
MobyException - thrown if the url is malformed
public void setUrl(String url)
throws MobyException
url - the string represention of the URL that resolves to the RDF
document that describes the service ontology.
MobyException - thrown if the url is malformedpublic URL getUrl()
public boolean isRDFValid()
public String getErrors()
public static void main(String[] args)
throws MobyException,
MalformedURLException,
IOException
MobyException
MalformedURLException
IOException
|
Version: 1.1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||