query-c0d4c6b24567eade17480c9bf79f8942

rq turtle/ttl

BIND, BOUND, IFThese three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable). "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND, BOUND, IFThese three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable). "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND,‏ BOUND,‏ IF (איגוד, תיחום, ברירה)בשלוש יכולות אלו משתמשים בדרך כלל בשילוב זו עם זו, נתחיל בהסבר על שלושתן ואז נעבור לכמה דוגמאות. אפשר להשתמש כדי להקצות את תוצאת הביטוי למשתנה (בדרך כלל משתנה חדש אבל אפשר גם לדרוס קיימים). ‪BIND(ביטוי AS ?variable).‬בפסוקית . OPTIONAL (שקר)). שימושי מאוד למשתנים שהוקמו על ידי פסוקית false (אמת) או true בודק אם משתנה תחום לערך (מחזיר BOUND(?variable). "terrible" יפוענח ל־IF(false, "great", "terrible"), ו־"yes" יפוענח ל־IF(true, "yes", "no"). כלומר, false מפוענח ל־condition אם elseExpression, ול־true (תנאי) מפוענח לכדי condition אם thenExpression מפוענח לכדי IF(condition,thenExpression,elseExpression) אפשר להשתמש כדי לאגד את תוצאות חלק מהחישוב למשתנה חדש. זאת יכולה להיות תוצאת ביניים של חישוב גדול יותר או פשוט תוצאה ישירות של השאילתה. למשל, כדי לאתר את גיל הנידונים לעונש מוות: BINDב־ BIND, BOUND, IF These three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable) . "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND、BOUND、IFこれらの3つの機能は、組み合わせて使用されることが多いので、最初に3つすべてを説明し、次にいくつかの例を示します。 句を使用して、式の結果を変数(通常は新しい変数ですが、既存の変数を上書きすることもできます)に割り当てることができます。 BIND(expression AS?variable).句で導入された変数に役立ちます。 OPTIONALを返します)。これは主に、falseまたはtrueは、変数が値にバインドされているかどうかをテストします(BOUND(?variable)と評価されます。 "terrible"はIF(false,"great","terrible")と評価され、"yes"はIF(true,"yes","no")と評価されます。 つまり、elseExpressionと評価された場合はfalseがconditionと評価され、thenExpressionと評価された場合はtrueがconditionは、IF(condition,thenExpression,elseExpression)は、いくつかの計算の結果を新しい変数にバインドするために使用できます。これは、より大きな計算の中間結果である場合もあれば、クエリの直接の結果である場合もあります。例えば、死刑の被害者の年齢を取得するには: BIND BIND, BOUND, IF These three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable) . "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND, BOUND, IF These three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable) . "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND, BOUND, IF These three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable) . "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND, BOUND, IF These three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable) . "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND, BOUND, IF These three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable) . "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND BIND、BOUND、IF These three features are often used in conjunction, so I’ll first explain all three of them and then show you some examples. clause can be used to assign the result of an expression to a variable (usually a new variable, but you can also overwrite existing ones). BIND(expression AS ?variable).A clause. OPTIONAL). It’s mostly useful on variables that are introduced in an false or true tests if a variable has been bound to a value (returns BOUND(?variable) . "terrible" evaluates to IF(false, "great", "terrible"), and "yes" evaluates to IF(true, "yes", "no"). That is, false evaluates to condition if elseExpression, and to true evaluates to condition if thenExpression evaluates to IF(condition,thenExpression,elseExpression) can be used to bind the results of some calculation to a new variable. This can be an intermediate result of a larger calculation or just directly a result of the query. For example, to get the age of victims of capital punishment: BIND

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?person ?personLabel ?age
WHERE
{
  ?person wdt:P31 wd:Q5;
          wdt:P569 ?born;
          wdt:P570 ?died;
          wdt:P1196 wd:Q8454.
  BIND(?died - ?born AS ?ageInDays).
  BIND(?ageInDays/365.2425 AS ?ageInYears).
  BIND(FLOOR(?ageInYears) AS ?age).
  # or, as one expression:
  #BIND(FLOOR((?died - ?born)/365.2425) AS ?age).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?age"):::projected v4("?ageInDays") v5("?ageInYears") v2("?born") v3("?died") v1("?person"):::projected c6(["wd:Q8454"]):::iri c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;"]):::literal c2(["wd:Q5"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P569"--> v2 v1 --"wdt:P570"--> v3 v1 --"wdt:P1196"--> c6 bind0[/"?died - ?born"/] v3 --o bind0 v2 --o bind0 bind0 --as--o v4 bind1[/"?ageInDays / '365.2425^^xsd:decimal'"/] v4 --o bind1 bind1 --as--o v5 bind2[/"numeric-floor(?ageInYears)"/] v5 --o bind2 bind2 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end