summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/SPARQLStore/QueryEngine/Condition/SingletonCondition.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/src/SPARQLStore/QueryEngine/Condition/SingletonCondition.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/src/SPARQLStore/QueryEngine/Condition/SingletonCondition.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/src/SPARQLStore/QueryEngine/Condition/SingletonCondition.php b/www/wiki/extensions/SemanticMediaWiki/src/SPARQLStore/QueryEngine/Condition/SingletonCondition.php
new file mode 100644
index 00000000..a7ba530b
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/src/SPARQLStore/QueryEngine/Condition/SingletonCondition.php
@@ -0,0 +1,55 @@
+<?php
+
+namespace SMW\SPARQLStore\QueryEngine\Condition;
+
+use SMWExpElement;
+
+/**
+ * A SPARQL condition that can match only a single element, or nothing at all.
+ *
+ * @ingroup SMWStore
+ *
+ * @license GNU GPL v2+
+ * @since 1.6
+ *
+ * @author Markus Krötzsch
+ */
+class SingletonCondition extends Condition {
+
+ /**
+ * Pattern string. Anything that can be used as a WHERE condition
+ * when put between "{" and "}". Can be empty if the result
+ * unconditionally is the given element.
+ * @var string
+ */
+ public $condition;
+
+ /**
+ * The single element that this condition may possibly match.
+ * @var SMWExpElement
+ */
+ public $matchElement;
+
+ /**
+ * Whether this condition is safe.
+ * @see SMWSparqlCondition::isSafe().
+ * @var boolean
+ */
+ public $isSafe;
+
+ public function __construct( SMWExpElement $matchElement, $condition = '', $isSafe = false, $namespaces = [] ) {
+ $this->matchElement = $matchElement;
+ $this->condition = $condition;
+ $this->isSafe = $isSafe;
+ $this->namespaces = $namespaces;
+ }
+
+ public function getCondition() {
+ return $this->condition;
+ }
+
+ public function isSafe() {
+ return $this->isSafe;
+ }
+
+}