diff --git a/library/Erfurt/Store.php b/library/Erfurt/Store.php index af8ec69e..e5f06ff0 100644 --- a/library/Erfurt/Store.php +++ b/library/Erfurt/Store.php @@ -795,6 +795,15 @@ public function getSearchPattern($stringSpec, $graphUris, $options = array()) // TODO stringSpec should be more than simple string (parse for and/or/xor etc...) $stringSpec = (string) $stringSpec; + if (strpbrk($stringSpec, '\'') === false) { + $parts = explode(' ', $stringSpec); + $stringSpec = ''; + foreach ($parts as $word) { + $stringSpec.= '\'' . $word . '\' AND '; + } + // Remove the last AND (including whitespace) + $stringSpec = substr($stringSpec, 0, strlen($stringSpec)-5); + } $options = array_merge( array( diff --git a/library/Erfurt/Store/Adapter/Virtuoso.php b/library/Erfurt/Store/Adapter/Virtuoso.php index 6c601206..987db08c 100644 --- a/library/Erfurt/Store/Adapter/Virtuoso.php +++ b/library/Erfurt/Store/Adapter/Virtuoso.php @@ -514,7 +514,7 @@ public function getSearchPattern($stringSpec, $graphUris, $options) */ new Erfurt_Sparql_Query2_Function( $bifContains, - array($objectVariable, new Erfurt_Sparql_Query2_RDFLiteral($stringSpec, null, '"\'')) + array($objectVariable, new Erfurt_Sparql_Query2_RDFLiteral($stringSpec)) ) ) )