Child element doesn't except property value - qml

I have a property defined inside QML i.e. txt_margin and txt_size to be passed on to child element (i.e. Text) but the child item doesn't update with this new value.
Here is portion of my code
Row {
. . .
readonly property int txt_margin: 4
readonly property int txt_size: 15
. . .
Rectangle {
. . .
. . .
. . .
Text {
. . .
. . .
font.pixelSize: txt_size // This doesn't work
anchors.leftMargin: txt_margin // This doesn't work
}
}
}

Related

Sparql query to get only top-most elements matching criteria

I have multiple trees where nodes are linked with hasParent and each node has some particular color. I need to filter a tree by a color and extract the topmost elements (exclude nested elements after filtering).
Here is an example of my data:
The result I need is: [A, B, I].
I know how to implement basic tree filter that returns [A, B, I, J, L, O]:
SELECT DISTINCT ?s WHERE {
?s <http://looneytunes-graph.com/color> "yellow"^^xsd:string
}
Is there a way to implement such additional filtering? or do I need to rethink my solution and use something else instead of graph db (AWS Neptune)?
I'm testing it with https://sparql-playground.sib.swiss/data and the following data:
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://looneytunes-graph.com/A> <http://looneytunes-graph.com/color> "yellow"^^xsd:string .
<http://looneytunes-graph.com/B> <http://looneytunes-graph.com/color> "yellow"^^xsd:string .
<http://looneytunes-graph.com/C> <http://looneytunes-graph.com/color> "green"^^xsd:string .
<http://looneytunes-graph.com/D> <http://looneytunes-graph.com/color> "red"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/A> .
<http://looneytunes-graph.com/E> <http://looneytunes-graph.com/color> "blue"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/A> .
<http://looneytunes-graph.com/F> <http://looneytunes-graph.com/color> "blue"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/B> .
<http://looneytunes-graph.com/G> <http://looneytunes-graph.com/color> "green"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/B> .
<http://looneytunes-graph.com/H> <http://looneytunes-graph.com/color> "red"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/C> .
<http://looneytunes-graph.com/I> <http://looneytunes-graph.com/color> "yellow"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/C> .
<http://looneytunes-graph.com/J> <http://looneytunes-graph.com/color> "yellow"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/D> .
<http://looneytunes-graph.com/K> <http://looneytunes-graph.com/color> "green"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/D> .
<http://looneytunes-graph.com/L> <http://looneytunes-graph.com/color> "yellow"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/F> .
<http://looneytunes-graph.com/M> <http://looneytunes-graph.com/color> "red"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/G> .
<http://looneytunes-graph.com/N> <http://looneytunes-graph.com/color> "blue"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/G> .
<http://looneytunes-graph.com/O> <http://looneytunes-graph.com/color> "yellow"^^xsd:string ;
<http://looneytunes-graph.com/hasParent> <http://looneytunes-graph.com/I> .
SELECT DISTINCT ?s WHERE {
?s <http://looneytunes-graph.com/color> "yellow"^^xsd:string .
FILTER NOT EXISTS {
?s hasParent+ [<http://looneytunes-graph.com/color> "yellow"^^xsd:string] .
}
}
With this query you are filtering out the nodes having (a parent node having a parent node having...) a yellow parent node.

Specification of how MIN/MAX aggregators deal with unbound optional values

The aggregators min and max skip unbound values, at least in Virtuoso and Stardog. Could somebody point me to where this is defined in the SPARQL 1.1 specification?
For example given:
insert data {
<http://s1> <http://p1> <http://o1> .
<http://o1> <http://p2> <http://o2> .
<http://x> <http://p1> <http://y> .
}
the query:
select (min(?o2) as ?min) {
?s <http://p1> ?o1 .
optional { ?o1 <http://p2> ?o2 }
}
returns <http://o2>, ignoring the unbound value for ?o2 for ?s = <http://x>.

in microbit how to make variable save?

i want make reading variable led in a button and b.
and button c(a+b) show variable led.
if i push the button a b b a than show the led a b b a
but can only show when i push the last button
so help me
how to make?
(Button.AB, function () {
showImage(0)
})
(Button.A, function () {
images.createImage(
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
)
})
input.onButtonPressed(Button.B, function () {
mos = images.createImage(
. . . . .
. . . . .
# # # # #
. . . . .
. . . . .
)
})
let mos: Image = null
images.createImage(
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
)
there just read only push last button

SPARQL query for retrieving all object properties about one individual (in Protege)

I have data for 20 breeds as individual and their costs, energy level, adaptability level, hypoallergenic, and the purposes of having them as object properties. I want to retrieve all object properties in individual.
so far this is my query:
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT *
WHERE {
?dog dog:hasAdaptability ?adaptability .
?dog dog:hasCost ?cost .
?dog dog:hasEnergy ?energy .
?dog dog:hasHypoallergenic ?hypoallergenic .
?dog dog:hasPurpose ?purpose .
}
the result show all the breeds (individual) with all the object properties
this is screenshot of the result
I need to select just 1 breed (individual) and object properties of that breed.
I already try this query but the result was: no matches found.
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT *
WHERE {
?dog dog:hasBreeds dog:Basenji .
?dog dog:hasAdaptability ?adaptability .
?dog dog:hasCost ?cost .
?dog dog:hasEnergy ?energy .
?dog dog:hasHypoallergenic ?hypoallergenic .
?dog dog:hasPurpose ?purpose .
}
Try this...
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT *
WHERE {
VALUES ?dog { dog:Basenji } .
?dog dog:hasAdaptability ?adaptability .
?dog dog:hasCost ?cost .
?dog dog:hasEnergy ?energy .
?dog dog:hasHypoallergenic ?hypoallergenic .
?dog dog:hasPurpose ?purpose .
}
Note that you can use variables for properties too. This query will fetch them all, even if you change your ontology :
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT * WHERE {
dog:Basenji ?property ?value
}
Alternatively, you can use the BIND operator to assign the breed you want to retrieve to a variable.
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT * WHERE {
BIND (dog:Basenji AS ?dog)
?dog ?property ?value
}

WikiData SPARQL Query Fails, requires CONTAINS to work

The query below works when I include the line that uses CONTAINS for the filter, but fails if I simply check if the value (LCASE) is equal to "donald trump" (it is).
Use this line, and it works:
FILTER(CONTAINS(LCASE(?idLabel), "donald trump") ).
Use this line, and it fails:
FILTER(LCASE(?idLabel) = "donald trump") .
The output for the query that WORKS has idLabel = "Donald Trump"
SPARQL Query:
SELECT DISTINCT ?id ?idLabel ?PV WHERE {
?id wdt:P106 ?V0. VALUES ?V0 { wd:Q39631 } .
OPTIONAL {
?id rdfs:label ?idLabel .
FILTER(LANG(?idLabel) = 'en') .
} .
# Filter on Label
# WORKS:
FILTER(CONTAINS(LCASE(?idLabel), "donald trump") ).
# DOES NOT WORK
#FILTER(LCASE(?idLabel) = "donald trump") .
# subselect on instance type
{
SELECT ?id WHERE {
?id wdt:P31/wdt:P279* ?PV . VALUES(?PV) {(wd:Q5) } .
}
} .
}
Try it here
My question is WHY the second option does NOT work ?
(And yes, I'm looking for the surgeon Donald Trump, not that other guy)
The labels in Wikidata have language tags, thus, the label literal is
"Donald Trump"#en
and the string after LCASE will be
"donald trump"#en
Indeed CONTAINS works here.
You have to use STR function to get the lexical form, i.e. just
"Donald Trump"
Solution:
FILTER(LCASE(STR(?idLabel)) = "donald trump") .