I have a JSON object which is the result set of a SPARQL query. I would like to use it to create a QueryResult object in SPARQLWrapper. Is this possible?
Related
var query = firebase.firestoreDb?.collection("myData")
?.document("myBooks")
?.collection("science")
if (sampleQns != ""){
query = query?.whereEqualTo("sampleQns", "yes")
}
if (diagram != ""){
query?.whereEqualTo("diagram", "yes")
}
query?.get()
I get type mismatch error(inferred type is Query? but CollectionReference? was expected) if I code like this...
The following variable:
var query = firebase.firestoreDb?.collection("myData")
?.document("myBooks")
?.collection("science")
Is of type CollectionReference which extends Query class. There is no way in Kotlin in which you can save an object of type Query into an object of type CollectionReference, hence that type mismatch.
However, you can save an object of type CollectionReference into a variable Query, and this is because a CollectionReference is actually a Query without filters.
As also #PeterHaddad mentioned in his comment, you should explicitly define the query to be of type Firestore Query:
var query: Query = firebase.firestoreDb?.collection("myData")
?.document("myBooks")
?.collection("science")
I'm trying to run a query by using a user input. The query is run in a database which has multiple columns (practically a vlookup). The query is run and the output is an array of values.
How do I get the value of only one value (scalar output to put in alert)?
Thanks
I've tried to use methods familiar to java in order to call one field in an array without any success.
i.e. output_array[0]
// define input
// var custno = app.pageFragments.Add_SalesOrder.children.Form1.children.Form1Body.children.CustomerNo_Input;
var custno = 'ENC';
// define location of output
var outputWidget = app.pageFragments.Add_SalesOrder.children.Form1.children.Form1Body.children.CustomerName_Input;
// define datasource
var datasource = app.datasources.SalesOrder;
// query
datasource.query.filters.CustomerNo._startsWith = custno.value;
// load query
datasource.load();
alert(datasource[0]);
I expect to get the first entry in the array but instead I get 'Undefined'.
If you look at the datasource documentation, you'll find out that the datasource is NOT an array, but instead an object. Since you are looking for the first result of the query, then you should access the items property of the datasource. That is an array and you can then just access the zero index of the array to get what you need.
alert(datasource.items[0]);
I am using below code for retrieving some object based on creation date
String query = ContentCleaningUtil.buildQuery(fileNamePattern, uTCTimeString);
OperationContext opCon = session.createOperationContext();
opCon.setLoadSecondaryTypeProperties(true);
opCon.setMaxItemsPerPage(1000);
ItemIterable<QueryResult> results = session.query(query, false, opCon);
I am getting empty results.
The query String is:
SELECT * FROM cmis:document WHERE cmis:name LIKE '%.zip' AND cmis:creationDate > TIMESTAMP '2018-09-01T22:56:44.248Z'
But when I am firing same query in alfresco node browser setting query as cmis-alfresco, it is returning 2 desired objects.
In both case I am using store workspace://Spacestore
Can anyone please help on this.
Is it possible to add constraint to a dynamodb query expression that states that a GSI should be not null?
Can somebody provide examples.
Is possible to construct a query like the one below?
new DynamoDBQueryExpression<XXX>()
.withHashKeyValues(YYY).withKeyConditionExpression(GSI != NULL);
Note:
Please let me know if this is possible in during query and not during filter time?
if you're like me and you landed on this page while finding the answer to the above question, here's the thread you need to see
How do you query for a non-existent (null) attribute in DynamoDB
The DynamoDB String attribute can't have NULL or empty string.
When you try to insert NULL, the API should throw the below exception:-
java.lang.IllegalArgumentException: Input value must not be null
When you try to insert empty string, the API should throw the below exception:-
com.amazonaws.AmazonServiceException: One or more parameter values were invalid: An AttributeValue may not contain an empty string
If you want to add additional filters on some attributes (i.e. attributes other than hash or range key), you can use the below syntax (i.e. withFilterExpression).
Not equals operator is "<>"
Map<String, AttributeValue> eav = new HashMap<String, AttributeValue>();
eav.put(":val1", new AttributeValue().withS("Some value"));
DynamoDBQueryExpression<XXX> queryExpression = new DynamoDBQueryExpression<XXX>();
queryExpression.withHashKeyValues(hashKeyValues);
queryExpression.withFilterExpression("docType <> :val1").withExpressionAttributeValues(eav);
I am trying to use this method to call a stored procedure.
var abc = await db.Database.ExecuteSqlCommandAsync(sql, parameters)
I see plenty of information on how to return data using parameters and that works okay. But I cannot find anything that tells me what is returned from the call?
Can someone tell me what will be put into abc and how can it be used?
As per
MSDN Database.ExecuteSqlCommandAsync Method (String, Object[])
it returns Task<int>. Here it is shown:
public Task<int> ExecuteSqlCommandAsync(
string sql,
params Object[] parameters
)
Return Value
Type: System.Threading.Tasks.Task<Int32>
A task that represents the asynchronous operation. The task result contains the result returned by the database after executing the command.
Now it depends on what you have in your sql query (sql param in your case). But for example, if you have a simple DELETE query like:
DELETE student WHERE papertype = 'science'
it will return the number of rows affected by the command. It's not a production level query so please ignore it's quality but you get the idea!