Exemple #1
0
        public async Task <OntologyInfo> ExecuteGetOntologyInfo(SparqlConnection connection)
        {   // get the ontology info information related to this connection.
            SimpleResultSet interrimResult = null;
            OntologyInfo    retval         = null;

            conf.SetServiceEndpoint(mappingPrefix + ontologyInfoDetailsEndpoint);
            String connectionJsonString = connection.ToJson().ToString();

            this.parameterJson.Add("jsonRenderedSparqlConnection", JsonValue.CreateStringValue(connectionJsonString));

            try
            {   // talk to the service to get the ontology info details.
                //JsonObject obj = (JsonObject)this.Execute().Result;
                JsonObject objExec = (JsonObject)(await this.Execute());

                interrimResult = SimpleResultSet.FromJson(objExec);
                interrimResult.ThrowExceptionIfUnsuccessful();
                // get the actual value from the results
                JsonObject obj = interrimResult.GetResultJsonObject("ontologyInfo");
                // build an oInfo from it.
                retval = new OntologyInfo();
                retval.AddJson(obj);
            }
            finally
            {
                conf.SetServiceEndpoint(null);
                this.parameterJson.Remove("jsonRenderedSparqlConnection");
            }
            // return the OntologyInfo
            return(retval);
        }
Exemple #2
0
        public async Task <SimpleResultSet> ExecuteDispatchFromNodeGroup(NodeGroup ng, JsonObject sparqlConnectionJson, JsonObject edcConstraintsJson, JsonObject runtimeConstraintsJson)
        {
            SimpleResultSet retval = null;

            conf.SetServiceEndpoint(mappingPrefix + dispatchFromNodegroupEndpoint);
            this.parameterJson.Add("jsonRenderedNodeGroup", JsonValue.CreateStringValue(ng.ToJson().ToString()));
            this.parameterJson.Add("sparqlConnection", JsonValue.CreateStringValue(sparqlConnectionJson.ToString()));
            if (edcConstraintsJson != null)
            {
                this.parameterJson.Add("externalDataConnectionConstraints", JsonValue.CreateStringValue(edcConstraintsJson.ToString()));
            }
            if (runtimeConstraintsJson != null)
            {
                this.parameterJson.Add("runtimeConstraints", JsonValue.CreateStringValue(runtimeConstraintsJson.ToString()));
            }
            try
            {
                JsonObject kObj = (JsonObject)(await this.Execute());
                retval = SimpleResultSet.FromJson(kObj);
                retval.ThrowExceptionIfUnsuccessful();
            }
            finally{
                conf.SetServiceEndpoint(null);

                this.parameterJson.Remove("jsonRenderedNodeGroup");
                this.parameterJson.Remove("sparqlConnection");
                this.parameterJson.Remove("externalDataConnectionConstraints");
                this.parameterJson.Remove("runtimeConstraints");
            }

            return(retval);
        }
Exemple #3
0
        public async Task <SimpleResultSet> ExecuteDispatchFilterById(String nodegroupID, String targetObjectSparqlId, JsonObject sparqlConnectionJson, JsonObject edcConstraintsJson, JsonArray runtimeConstraintsJson)
        {
            SimpleResultSet retval = null;

            conf.SetServiceEndpoint(mappingPrefix + dispatchFilterByIdEndpoint);
            this.parameterJson.Add("nodeGroupId", JsonValue.CreateStringValue(nodegroupID));
            this.parameterJson.Add("sparqlConnection", JsonValue.CreateStringValue(sparqlConnectionJson.ToString()));
            this.parameterJson.Add("targetObjectSparqlId", JsonValue.CreateStringValue(targetObjectSparqlId));
            if (edcConstraintsJson != null)
            {
                this.parameterJson.Add("externalDataConnectionConstraints", JsonValue.CreateStringValue(edcConstraintsJson.ToString()));
            }
            if (runtimeConstraintsJson != null)
            {
                this.parameterJson.Add("runtimeConstraints", JsonValue.CreateStringValue(runtimeConstraintsJson.ToString()));
            }

            try
            {
                JsonObject kObj = (JsonObject)(await this.Execute());
                retval = SimpleResultSet.FromJson(kObj);
                retval.ThrowExceptionIfUnsuccessful();
            }
            finally{
                conf.SetServiceEndpoint(null);

                this.parameterJson.Remove("nodeGroupId");
                this.parameterJson.Remove("sparqlConnection");
                this.parameterJson.Remove("externalDataConnectionConstraints");
                this.parameterJson.Remove("runtimeConstraints");
                this.parameterJson.Remove("targetObjectSparqlId");
            }
            return(retval);
        }
        /* execute and get a simple result set */
        public async Task <SimpleResultSet> ExecuteWithSimpleResultReturn()
        {
            if (conf.GetServiceEndpoint() == null || conf.GetServiceEndpoint().Length == 0)
            {
                throw new Exception("Attempting to execute client with no endpoint specified.");
            }
            JsonObject kObj = (JsonObject)(await this.Execute());

            return(SimpleResultSet.FromJson(kObj));
        }
        /* get the last run result as a simple result set */
        protected SimpleResultSet GetRunResultAsSimpleResultSet()
        {
            SimpleResultSet retval = new SimpleResultSet();

            if (this.runResult == null)
            {
                throw new Exception("last service communication resulted in null and cannot be converted");
            }
            retval = SimpleResultSet.FromJson((JsonObject)this.runResult);
            return(retval);
        }
Exemple #6
0
        public async Task <SimpleResultSet> ExecuteGetJobStatus(String jobId)
        {
            SimpleResultSet retval = null;

            conf.SetServiceEndpoint(mappingPrefix + jobStatusEndpoint);
            this.parameterJson.Add("jobID", JsonValue.CreateStringValue(jobId));
            try
            {
                JsonObject kObj = (JsonObject)(await this.Execute());
                retval = SimpleResultSet.FromJson(kObj);
                retval.ThrowExceptionIfUnsuccessful();
            }
            finally
            {
                conf.SetServiceEndpoint(null);
                this.parameterJson.Remove("jobID");
            }

            return(retval);
        }