[MOBY-guts] biomoby commit
Gary Schiltz
gss at pub.open-bio.org
Wed Sep 14 22:06:55 UTC 2005
gss
Wed Sep 14 18:06:55 EDT 2005
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools
In directory pub.open-bio.org:/tmp/cvs-serv17172/src/org/semanticmoby/ref/tools
Modified Files:
InvocationBroker.java KeywordFinder.java KeywordList.java
URIInvestigator.java KeywordQuery.java DiscoveryQuery.java
Log Message:
Changed to work after major API overhaul
moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools InvocationBroker.java,1.2,1.3 KeywordFinder.java,1.2,1.3 KeywordList.java,1.1,1.2 URIInvestigator.java,1.2,1.3 KeywordQuery.java,1.2,1.3 DiscoveryQuery.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/InvocationBroker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/InvocationBroker.java 2005/03/21 21:42:01 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/InvocationBroker.java 2005/09/14 22:06:55 1.3
@@ -16,7 +16,7 @@
/**
* This class is used to invoke and display the results of Semantic
- * MOBY providers.
+ * MOBY services.
*/
public class InvocationBroker
{
@@ -55,64 +55,64 @@
this.out = out;
}
- private String rdfxmlString(MOBYProvider provider)
+ private String rdfxmlString(MOBYService service)
{
StringWriter writer = new StringWriter();
- provider.getModel().write(writer);
+ service.getJenaModel().write(writer);
return writer.toString();
}
- private String n3String(MOBYProvider provider)
+ private String n3String(MOBYService service)
{
StringWriter writer = new StringWriter();
- provider.getModel().write(writer, "N3");
+ service.getJenaModel().write(writer, "N3");
return writer.toString();
}
/**
- * Handle a request to invoke a provider at a given URI.
- * If the provider requires inputs, and the provider has
+ * Handle a request to invoke a service at a given URI.
+ * If the service requires inputs, and the service has
* a valid inputURI property, redirect to the URI that is
- * the value of the property. If the provider requires input
+ * the value of the property. If the service requires input
* and has no inputURI property, then build a simple input
* GUI from scratch.
* <br><br>
- * If the provider doesn't require any inputs, then do an HTTP
- * POST to the provider URI, passing the graph as a parameter.
+ * If the service doesn't require any inputs, then do an HTTP
+ * POST to the service URI, passing the graph as a parameter.
*/
- public void invokeURI(String providerURI)
+ public void invokeURI(String serviceURI)
{
- // Try to retrieve and parse a provider graph from the URI;
+ // Try to retrieve and parse a service graph from the URI;
// on failure, print a message and return.
//
- MOBYProvider canonicalProvider = null;
+ MOBYService service = null;
try
{
Model model = ModelFactory.createDefaultModel();
- model.read(providerURI);
+ model.read(serviceURI);
Parser parser = new Parser(model);
- canonicalProvider = parser.parseProvider();
+ service = parser.parseService();
}
catch (Throwable t)
{
- out.println("No valid provider could be found at");
- out.print("<a href=\"" + providerURI + "\">");
- out.print(" "); out.println(providerURI); out.println("</a>");
+ out.println("No valid service could be found at");
+ out.print("<a href=\"" + serviceURI + "\">");
+ out.print(" "); out.println(serviceURI); out.println("</a>");
return;
}
- if (requiresInputs(canonicalProvider))
+ if (requiresInputs(service))
{
- // Since the provider requires input, either redirect to its
+ // Since the service requires input, either redirect to its
// inputURI (if it has one) or build a simple GUI for it.
//
try
{
- String inputURI = getInputURI(canonicalProvider);
+ String inputURI = getInputURI(service);
if (inputURI == null) {
- buildInputGUI(canonicalProvider);
+ buildInputGUI(service);
}
else
{
@@ -128,23 +128,23 @@
if (status == HttpStatus.SC_OK) {
response.sendRedirect(inputURI);
} else {
- buildInputGUI(canonicalProvider);
+ buildInputGUI(service);
}
}
} catch (Throwable t) {
- buildInputGUI(canonicalProvider);
+ buildInputGUI(service);
}
}
else // No input required
{
try
{
- // Invoke the provider
+ // Invoke the service
//
HTTPRequest rqst =
- HTTPRequest.newPostRequest(canonicalProvider.getURI());
+ HTTPRequest.newPostRequest(service.getURI());
rqst.addParameter(MOBY.GRAPH_PARAMETER_NAME,
- rdfxmlString(canonicalProvider));
+ rdfxmlString(service));
HTTPResponse resp = rqst.send();
// Check the status
@@ -158,16 +158,16 @@
Model model = ModelFactory.createDefaultModel();
model.read(resp.getBodyAsStream(), "");
Parser parser = new Parser(model);
- MOBYProvider resultsProvider = parser.parseProvider();
+ MOBYService resultsService = parser.parseService();
- String outputURI = getOutputURI(resultsProvider);
+ String outputURI = getOutputURI(resultsService);
if (outputURI == null)
{
// No output URI was specified, so build a generic
// display of the results
//
- buildOutputGUI(resultsProvider);
+ buildOutputGUI(resultsService);
}
else
{
@@ -186,7 +186,7 @@
// by trying to invoke it.
//
rqst = HTTPRequest.newPostRequest(outputURI);
- String graphString = rdfxmlString(resultsProvider);
+ String graphString = rdfxmlString(resultsService);
rqst.addParameter(
MOBY.GRAPH_PARAMETER_NAME, graphString);
resp = rqst.send();
@@ -204,22 +204,22 @@
// The output URI returned a status other than
// 200 OK, so fall back to a default output GUI
//
- buildOutputGUI(resultsProvider);
+ buildOutputGUI(resultsService);
}
}
catch (Throwable t)
{
- buildOutputGUI(resultsProvider);
+ buildOutputGUI(resultsService);
}
}
} else {
- out.println("Sorry - an error occurred invoking the provider");
+ out.println("Sorry - an error occurred invoking the service");
}
}
catch (Throwable t)
{
- out.println("Sorry - an error occurred invoking the provider");
+ out.println("Sorry - an error occurred invoking the service");
return;
}
}
@@ -243,57 +243,55 @@
dispatcher.forward(request, response);
}
- private String getInputURI(MOBYProvider provider)
+ private String getInputURI(MOBYService service)
{
try {
- Model model = provider.getModel();
- Statement stmt = model.listStatements(
- provider.getResource(), MOBY.inputURI,
- (String) null).nextStatement();
+ Model model = service.getJenaModel();
+ Statement stmt =
+ model.getProperty(service.getResource(), MOBY.inputURI);
return stmt.getString();
} catch (Throwable t) {
return null;
}
}
- private String getOutputURI(MOBYProvider provider)
+ private String getOutputURI(MOBYService service)
{
try {
- Model model = provider.getModel();
- Statement stmt = model.listStatements(
- provider.getResource(), MOBY.outputURI,
- (String) null).nextStatement();
+ Model model = service.getJenaModel();
+ Statement stmt =
+ model.getProperty(service.getResource(), MOBY.outputURI);
return stmt.getString();
} catch (Throwable t) {
return null;
}
}
- public void buildInputGUI(MOBYProvider provider)
+ public void buildInputGUI(MOBYService service)
{
- out.println("This provider has not provided a valid URL for");
+ out.println("This service has not provided a valid URL for");
out.println("gathering its required inputs.");
}
- public void buildOutputGUI(MOBYProvider provider)
+ public void buildOutputGUI(MOBYService service)
throws IOException, ServletException
{
HttpSession session = request.getSession(true);
session.setAttribute("n3Graph",
- n3String(provider)
+ n3String(service)
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll("\"", """));
session.setAttribute("rdfxmlGraph",
- rdfxmlString(provider)
+ rdfxmlString(service)
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll("\"", """));
redirectToPage("/jsp/display.jsp");
}
- private boolean requiresInputs(MOBYProvider provider)
+ private boolean requiresInputs(MOBYService service)
{
- return getInputURI(provider) != null;
+ return getInputURI(service) != null;
}
}
\ No newline at end of file
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordFinder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordFinder.java 2005/03/21 21:42:01 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordFinder.java 2005/09/14 22:06:55 1.3
@@ -12,15 +12,15 @@
public class KeywordFinder
{
/**
- * The MOBY provider for which to find keywords
+ * The MOBY service for which to find keywords
*/
- private MOBYProvider provider;
+ private MOBYService service;
/**
- * The underlying Jena model on which the MOBY provider
+ * The underlying Jena model on which the MOBY service
* is based
*/
- private Model providerModel;
+ private Model serviceModel;
/**
* A keyword list object to hold the keywords that are
@@ -29,17 +29,17 @@
private KeywordList keywords = null;
/**
- * Construct an instance for the given provider and model
+ * Construct an instance for the given service and model
*/
- public KeywordFinder(MOBYProvider provider, Model providerModel)
+ public KeywordFinder(MOBYService service)
{
- this.provider = provider;
- this.providerModel = providerModel;
+ this.service = service;
+ this.serviceModel = service.getJenaModel();
}
/**
* Retrieve, if necessary, and return the keywords associated
- * with the provider.
+ * with the service.
*/
public KeywordList getKeywords()
throws Exception
@@ -53,21 +53,20 @@
}
/**
- * Collect keywords for the provider
+ * Collect keywords for the service
*/
private void collectKeywords()
{
- // Add keywords from classes that the provider is asserted to
- // be an instance of (i.e. provider rdf:type <some type>)
+ // Add keywords from classes that the service is asserted to
+ // be an instance of (i.e. service rdf:type <some type>)
//
- Resource res = provider.getResource();
- keywords.addProviderKeywords(getKeywordsFor(res));
+ Resource res = service.getResource();
+ keywords.addServiceKeywords(getKeywordsFor(res));
// Add keywords from subjects and objects of each
// operatesOn subgraph
//
- MOBYCollection coll = provider.getOperatesOn();
- for (Iterator it = coll.iterator(); it.hasNext();)
+ for (Iterator it = service.getOperatesOn(); it.hasNext();)
{
MOBYGraphNode node = (MOBYGraphNode) it.next();
addGraphKeywordsFor(node);
@@ -104,10 +103,11 @@
MOBYSubject subject = (MOBYSubject) node;
keywords.addSubjectKeywords(
getKeywordsFor(subject.getResource()));
- Iterator it = subject.getDirectMappings().iterator();
+ Iterator it = subject.getDirectMappings();
while (it.hasNext())
{
- MOBYGraphNode node2 = (MOBYGraphNode) it.next();
+ Object obj = it.next();
+ MOBYGraphNode node2 = (MOBYGraphNode) obj;
addObjectKeywordsFor(node2);
}
}
@@ -123,6 +123,11 @@
}
}
+ // TODO: Note that in some cases, this doesn't work,
+ // when node is a MOBYObject that has no defining
+ // statement (see the discussion in the class doc for
+ // its parent class MappingObject). So, this as well
+ // as addSubjectKeywordsFor() needs to be fixed
private void addObjectKeywordsFor(MOBYGraphNode node)
{
if (node instanceof MOBYObject)
@@ -153,9 +158,9 @@
// Iterate over the resource's rdf:type properties
//
- StmtIterator it = providerModel.listStatements(
- res, RDF.type, (RDFNode) null);
-
+ StmtIterator it =
+ serviceModel.listStatements(res, RDF.type, (RDFNode) null);
+
while (it.hasNext())
{
Statement s1 = it.nextStatement();
@@ -163,7 +168,7 @@
// If the value of the rdf:type property is a resource
//
- if (node.canAs(Resource.class))
+ if ((res != null) && (node.canAs(Resource.class)))
{
Resource classNode = (Resource) node.as(Resource.class);
@@ -188,7 +193,7 @@
}
}
- if (res.canAs(Bag.class))
+ if ((res != null) && (res.canAs(Bag.class)))
{
Bag bag = (Bag) res.as(Bag.class);
for (Iterator it2 = bag.iterator(); it2.hasNext();)
@@ -236,40 +241,4 @@
return list;
}
-
- public static void main(String[] args)
- throws Exception
- {
- Model model = ModelFactory.createDefaultModel();
-// model.read("http://brebiou.cshl.org:8080/get-individuals");
- model.read("http://www.semanticmoby.org/examples/hello-world");
- Parser parser = new Parser(model);
- MOBYProvider provider = parser.parseProvider();
- KeywordFinder kf = new KeywordFinder(provider, model);
- KeywordList list = kf.getKeywords();
-
- System.out.print("Provider keywords: ");
- for (Iterator it = list.getProviderKeywords(); it.hasNext();) {
- System.out.print("\"");
- System.out.print(it.next().toString());
- System.out.print("\" ");
- }
- System.out.println();
-
- System.out.print("Subject keywords: ");
- for (Iterator it = list.getSubjectKeywords(); it.hasNext();) {
- System.out.print("\"");
- System.out.print(it.next().toString());
- System.out.print("\" ");
- }
- System.out.println();
-
- System.out.print("Object keywords: ");
- for (Iterator it = list.getObjectKeywords(); it.hasNext();) {
- System.out.print("\"");
- System.out.print(it.next().toString());
- System.out.print("\" ");
- }
- System.out.println();
- }
}
\ No newline at end of file
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordList.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordList.java 2004/11/22 22:58:40 1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordList.java 2005/09/14 22:06:55 1.2
@@ -6,20 +6,20 @@
public class KeywordList
{
- private Set providerKeywords = new HashSet();
+ private Set serviceKeywords = new HashSet();
private Set subjectKeywords = new HashSet();
private Set objectKeywords = new HashSet();
- public void addProviderKeyword(String keyword) {
- providerKeywords.add(keyword);
+ public void addServiceKeyword(String keyword) {
+ serviceKeywords.add(keyword);
}
- public void addProviderKeywords(List keywords) {
- providerKeywords.addAll(keywords);
+ public void addServiceKeywords(List keywords) {
+ serviceKeywords.addAll(keywords);
}
- public Iterator getProviderKeywords() {
- return providerKeywords.iterator();
+ public Iterator getServiceKeywords() {
+ return serviceKeywords.iterator();
}
public void addSubjectKeyword(String keyword) {
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2005/03/21 21:42:01 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/URIInvestigator.java 2005/09/14 22:06:55 1.3
@@ -16,7 +16,7 @@
import com.hp.hpl.jena.rdf.model.Model;
/**
- * This class is used to investigate URIs that potentially contain MOBY graphs.
+ * This class is used to investigate URLs that potentially contain MOBY graphs.
* Multiple instances can exist, each investigating a different URL. Keeping a
* map of URL->instance mappings in the instances class variable is a simple
* way to prevent multiple instances from investigating the same URL at any one
@@ -36,7 +36,7 @@
* The URL that is to be investigated for possible inclusion in the
* metadata repository.
*/
- private String providerURI;
+ private String serviceURL;
private final static Log syncLog = LogFactory.getLog("SYNC");
@@ -47,17 +47,17 @@
* investigated, then this call is a NO-OP.
* @param providerURL the URL to investigate
*/
- public synchronized static void investigate(String providerURL)
+ public synchronized static void investigate(String serviceURL)
{
synchronized (instances)
{
- if (instances.get(providerURL) != null) {
- syncLog.warn("Already investigating " + providerURL);
+ if (instances.get(serviceURL) != null) {
+ syncLog.warn("Already investigating " + serviceURL);
return;
}
- URIInvestigator investigator = new URIInvestigator(providerURL);
- instances.put(providerURL, investigator);
+ URIInvestigator investigator = new URIInvestigator(serviceURL);
+ instances.put(serviceURL, investigator);
investigator.start();
}
}
@@ -66,9 +66,9 @@
* Create an instance for investingating the given provider URL
* @param providerURL the URL to investigate
*/
- private URIInvestigator(String providerURL)
+ private URIInvestigator(String serviceURL)
{
- this.providerURI = providerURL;
+ this.serviceURL = serviceURL;
}
/**
@@ -108,7 +108,7 @@
//
synchronized (instances)
{
- instances.remove(providerURI);
+ instances.remove(serviceURL);
}
}
}
@@ -137,18 +137,20 @@
boolean alreadyRegistered = false;
try {
- lastModifiedDate = manager.getLastModifiedDate(providerURI);
+ lastModifiedDate = manager.getLastModifiedDate(serviceURL);
alreadyRegistered = (lastModifiedDate != null);
}
catch (StorageException e)
{
- syncLog.error("Couldn't check for last modified date of provider URL " + providerURI, e);
+ syncLog.error(
+ "Couldn't check for last modified date of provider URL " +
+ serviceURL, e);
return;
}
// Helper class for making the HTTP GET call
//
- HTTPRequest request = HTTPRequest.newGetRequest(providerURI);
+ HTTPRequest request = HTTPRequest.newGetRequest(serviceURL);
// If there was a last modified date, then request that the graph only
// be sent if it has been modified since that date
@@ -170,7 +172,7 @@
}
catch (HTTPException e)
{
- syncLog.warn("Couldn't reach suggested provider " + providerURI);
+ syncLog.warn("Couldn't reach suggested provider " + serviceURL);
return;
}
@@ -181,7 +183,7 @@
// The resource has not been modified since it was
// registered, so there is nothing to do but log a message.
//
- syncLog.info("IN-SYNC : " + providerURI);
+ syncLog.info("IN-SYNC : " + serviceURL);
break;
case HttpServletResponse.SC_NOT_FOUND:
@@ -190,9 +192,9 @@
// from the database.
//
if (alreadyRegistered) {
- deregisterProvider(manager, true);
+ deregisterService(manager, true);
} else {
- syncLog.info("IGNORED : " + providerURI + " doesn't exist");
+ syncLog.info("IGNORED : " + serviceURL + " doesn't exist");
}
break;
@@ -203,11 +205,12 @@
//
lastModifiedDate = null;
- // Try to parse the Last-Modified header to store in the database
+ // Try to parse the Last-Modified header to store in the DB
//
String dateString = "";
try {
- dateString = response.getHeaderValue(MOBY.LAST_MODIFIED_HEADER);
+ dateString =
+ response.getHeaderValue(MOBY.LAST_MODIFIED_HEADER);
lastModifiedDate = DateParser.parseDate(dateString);
}
catch (HTTPException e)
@@ -216,7 +219,7 @@
// retrievable, but register the graph anyway
//
syncLog.warn("Unable to get Last-Modified date for "
- + providerURI + "; using current date");
+ + serviceURL + "; using current date");
lastModifiedDate = new Date();
}
catch (Throwable t)
@@ -224,8 +227,9 @@
// Log a message about the last modified date not being
// parsable, but register the graph anyway
//
- syncLog.warn("Unparsable Last-Modified date " + "(\"" + dateString +
- "\") for " + providerURI + "; ignoring");
+ syncLog.warn(
+ "Unparsable Last-Modified date " + "(\"" + dateString +
+ "\") for " + serviceURL + "; ignoring");
}
// The client sent back a graph; so try to parse it. If the
@@ -238,38 +242,41 @@
}
catch (HTTPException e)
{
- syncLog.error("Couldn't retrieve graph from " + providerURI);
+ syncLog.error("Couldn't retrieve graph from " + serviceURL);
return;
}
- MOBYProvider provider = null;
+ MOBYService service = null;
try {
Parser parser = Parser.forInputStream(in, Parser.LANGUAGE_RDF_XML);
- provider = parser.parseProvider();
+ service = parser.parseService();
}
catch (Throwable t) {
System.err.println("Parse error: " + t);
}
// De-register the provider, printing a removal message if
- // a provider couldn't be parsed
+ // a service couldn't be parsed
//
- deregisterProvider(manager, provider==null);
+ deregisterService(manager, service==null);
- // If a provider was parsed, then register it
+ // If a service was parsed, then register it
//
- if (provider != null)
+ if (service != null)
{
try
{
- manager.registerProvider(provider, lastModifiedDate);
+ manager.registerProvider(service, lastModifiedDate);
// Log a message about successfully registering the graph:
//
- syncLog.info((alreadyRegistered ? "UPDATED : " : "ADDED : ") + providerURI);
+ syncLog.info(
+ (alreadyRegistered ? "UPDATED : " : "ADDED : ") +
+ serviceURL);
}
catch (StorageException e) {
- syncLog.error("Error storing graph for " + providerURI, e);
+ syncLog.error(
+ "Error storing graph for " + serviceURL, e);
}
}
@@ -280,21 +287,21 @@
// Log a message about the failed attempt to contact the URL
//
syncLog.error("Status " + status + " received while trying " +
- "to contact provider " + providerURI);
+ "to contact provider " + serviceURL);
break;
}
}
- private void deregisterProvider(StorageManager manager, boolean removing)
+ private void deregisterService(StorageManager manager, boolean removing)
{
try {
- manager.deregisterProvider(providerURI);
+ manager.deregisterProvider(serviceURL);
if (removing) {
- syncLog.info("REMOVED : " + providerURI);
+ syncLog.info("REMOVED : " + serviceURL);
}
}
catch (StorageException e) {
- syncLog.error("Unable to de-register provider " + providerURI, e);
+ syncLog.error("Unable to de-register provider " + serviceURL, e);
}
}
}
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordQuery.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordQuery.java 2005/03/21 21:42:01 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/KeywordQuery.java 2005/09/14 22:06:55 1.3
@@ -44,7 +44,7 @@
while (rs.next()) {
String uri = rs.getString("provider_uri");
- MOBYProvider provider = providerAt(uri, model);
+ MOBYService provider = serviceAt(uri, model);
if (provider != null) {
matching.add(provider);
}
@@ -65,7 +65,7 @@
return matching;
}
- private MOBYProvider providerAt(String uri, Model model)
+ private MOBYService serviceAt(String uri, Model model)
{
Model providerModel = ModelFactory.createDefaultModel();
Resource provider = providerModel.createResource(uri);
@@ -74,7 +74,7 @@
try {
Parser parser = new Parser(providerModel);
- return parser.parseProvider();
+ return parser.parseService();
} catch (Throwable t) {
return null;
}
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/DiscoveryQuery.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/DiscoveryQuery.java 2005/03/21 21:42:01 1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/DiscoveryQuery.java 2005/09/14 22:06:55 1.3
@@ -46,7 +46,7 @@
/**
* The graph that serves as a template for providers that match.
*/
- private MOBYProvider queryProvider;
+ private MOBYService queryProvider;
/**
* Flag indicating which statements should be returned: URI_ONLY,
@@ -65,17 +65,17 @@
*/
private int lastBnodeNumber;
- public static DiscoveryQuery newMinimalStmtsQuery(MOBYProvider provider)
+ public static DiscoveryQuery newMinimalStmtsQuery(MOBYService provider)
{
return new DiscoveryQuery(provider, MINIMAL_STMTS);
}
- public static DiscoveryQuery newQueryStmtsQuery(MOBYProvider provider)
+ public static DiscoveryQuery newQueryStmtsQuery(MOBYService provider)
{
return new DiscoveryQuery(provider, QUERY_STMTS);
}
- public static DiscoveryQuery newReachableStmtsQuery(MOBYProvider provider)
+ public static DiscoveryQuery newReachableStmtsQuery(MOBYService provider)
{
return new DiscoveryQuery(provider, REACHABLE_STMTS);
}
@@ -87,7 +87,7 @@
* @param statementsToReturn which statements should be returned: URI_ONLY,
* QUERY_STMTS_ONLY, or ALL_STMTS (use the static constants on this class).
*/
- private DiscoveryQuery(MOBYProvider queryProvider, int statementsToReturn)
+ private DiscoveryQuery(MOBYService queryProvider, int statementsToReturn)
{
this.queryProvider = queryProvider;
this.statementsToReturn = statementsToReturn;
@@ -103,14 +103,14 @@
lastBnodeNumber = 0;
}
- public MOBYProviderSet findMatchingGraphs()
+ public MOBYServiceSet findMatchingGraphs()
{
init();
Model dbModel = null;
try
{
- Model queryModel = ((MOBYProvider) queryProvider).getModel();
+ Model queryModel = ((MOBYService) queryProvider).getJenaModel();
String queryString = buildQueryString(queryModel);
StorageManager manager = new StorageManager();
dbModel = manager.openDBModel();
@@ -128,14 +128,14 @@
}
results.close();
- MOBYProviderSet returnSet = new MOBYProviderSet();
+ MOBYServiceSet returnSet = new MOBYServiceSet();
for (Iterator it = matching.iterator(); it.hasNext();)
{
Object next = it.next();
- MOBYProvider mp = buildGraphModel(dbModel,
+ MOBYService mp = buildGraphModel(dbModel,
queryModel, (ResultBinding) next);
- returnSet.addProvider(mp);
+ returnSet.addService(mp);
}
return returnSet;
@@ -244,8 +244,9 @@
* @param binding bindings for variables
* @return
*/
- private MOBYProvider buildGraphModel(
+ private MOBYService buildGraphModel(
Model dbModel, Model queryModel, ResultBinding binding)
+ throws NonCanonicalException
{
// Create a default model to return
//
@@ -279,7 +280,7 @@
// Parse and return a MOBY provider using the adjusted model
//
Parser parser = new Parser(adjusted);
- return parser.parseProvider();
+ return parser.parseService();
}
/**
@@ -319,7 +320,7 @@
//
try {
Statement providerTypeStmt = original.listStatements(
- null, RDF.type, MOBY.Provider).nextStatement();
+ null, RDF.type, MOBY.Service).nextStatement();
minimal.add(providerTypeStmt);
Resource subject = providerTypeStmt.getSubject();
@@ -370,7 +371,7 @@
//
try {
Statement providerTypeStmt = original.listStatements(
- null, RDF.type, MOBY.Provider).nextStatement();
+ null, RDF.type, MOBY.Service).nextStatement();
Resource subject = providerTypeStmt.getSubject();
Util.addReachableStmts(dbModel, reachable, subject, subject.getURI());
}
More information about the MOBY-guts
mailing list