/** * Send a request with embedded plain text document, * Request output as GATE JSON and use the defauls set of annotation selectors. */ private static void processInlineDocument() { ProcessingRequest pr = new ProcessingRequest(); pr.document = ("Tiruchirappalli is the " + "fourth largest city in the Indian state of " + "Tamil Nadu and is the administrative headquarters " + "of Tiruchirappalli District. Its recorded " + "history begins in the 3rd century BC, " + "when it was under the rule of the Cholas. " + "The city has also been ruled by the Pandyas, " + "Pallavas, Vijayanagar Empire, Nayak Dynasty, " + "the Carnatic state and the British. " + "It played a crucial role in the Carnatic Wars " + "(1746–63) between the British and the French " + "East India companies. During British rule, the city " + "was popular for the Trichinopoly cigar, its unique brand " + "of cheroot. Monuments include the Rockfort (pictured), the " + "Ranganathaswamy temple and the Jambukeswarar temple. " + "It is an important educational centre in Tamil Nadu, " + "housing nationally recognised institutions such as the " + "Indian Institute of Management and the National " + "Institute of Technology."); pr.documentType = ("text/plain"); apiExecutor.processRequest(pr.toJSON(), S4ServiceClient.APPLICATION_JSON_HEADER, S4ServiceClient.APPLICATION_JSON_HEADER); }
/** * Execute one SPARQL query over GDBaaS */ private static String uploadDataToGDBaaS() { apiExecutor = new S4ServiceClient("https://rdf.s4.ontotext.com/{userId}/{databaseName}/repositories/{repositoryName}/statements", keyId, password); String query = "INSERT DATA ..."; query = System.Web.HttpUtility.UrlEncode(query, Encoding.UTF8); return(apiExecutor.processRequest("update=" + query, S4ServiceClient.SPARQL_ACCEPT_HEADER, S4ServiceClient.SPARQL_CONTENT_TYPE)); }
/** * Execute one SPARQL query over GDBaaS */ private static String processGDBaaSRequest() { apiExecutor = new S4ServiceClient("https://rdf.s4.ontotext.com/{userId}/{databaseName}/repositories/{repositoryName}", keyId, password); String query = "Select * {?s ?p ?o} limit 5"; query = System.Web.HttpUtility.UrlEncode(query, Encoding.UTF8); return(apiExecutor.processRequest("query=" + query, S4ServiceClient.SPARQL_ACCEPT_HEADER, S4ServiceClient.SPARQL_CONTENT_TYPE)); }
/** * Execute one SPARQL query over GDBaaS */ private static String processGDBaaSRequest() { apiExecutor = new S4ServiceClient("https://rdf.s4.ontotext.com/{userId}/{databaseName}/repositories/{repositoryName}", keyId, password); String query = "Select * {?s ?p ?o} limit 5"; query = System.Web.HttpUtility.UrlEncode(query, Encoding.UTF8); return apiExecutor.processRequest("query=" + query, S4ServiceClient.SPARQL_ACCEPT_HEADER, S4ServiceClient.SPARQL_CONTENT_TYPE); }
/** * Execute one SPARQL query over GDBaaS */ private static String uploadDataToGDBaaS() { apiExecutor = new S4ServiceClient("https://rdf.s4.ontotext.com/{userId}/{databaseName}/repositories/{repositoryName}/statements", keyId, password); String query = "INSERT DATA ..."; query = System.Web.HttpUtility.UrlEncode(query, Encoding.UTF8); return apiExecutor.processRequest("update=" + query, S4ServiceClient.SPARQL_ACCEPT_HEADER, S4ServiceClient.SPARQL_CONTENT_TYPE); }