@ Override public boolean serviceExists ( URI serviceUri ) throws ServiceException { if ( serviceUri == null || ! serviceUri . isAbsolute ( ) ) { log . warn ( "The Service URI is either absent or relative. Provide an absolute URI" ) ; return false ; } URI graphUri ; try { graphUri = getGraphUriForElement ( serviceUri ) ; } catch ( URISyntaxException e ) { log . warn ( "The namespace of the URI of the message content is incorrect." , e ) ; return Boolean . FALSE ; } if ( graphUri == null ) { log . warn ( "Could not obtain a graph URI for the element. The URI may not be managed by the server - " + serviceUri ) ; return Boolean . FALSE ; } String queryStr = new StringBuilder ( ) . append ( "ASK { \n" ) . append ( "GRAPH <" ) . append ( graphUri . toASCIIString ( ) ) . append ( "> {" ) . append ( "<" ) . append ( serviceUri . toASCIIString ( ) ) . append ( "> <" ) . append ( RDF . type . getURI ( ) ) . append ( "> <" ) . append ( MSM . Service ) . append ( "> }\n}" ) . toString ( ) ; Query query = QueryFactory . create ( queryStr ) ; QueryExecution qe = QueryExecutionFactory . sparqlService ( this . graphStoreManager . getSparqlQueryEndpoint ( ) . toASCIIString ( ) , query ) ; MonitoredQueryExecution qexec = new MonitoredQueryExecution ( qe ) ; try { return qexec . execAsk ( ) ; } finally { qexec . close ( ) ; } }
Determines whether a service is known to the registry