forked from semsol/arc2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core (fix): improved toUTF8 and getUTF8Char methods / Class (add): i…
…mproved camelCase method, added deCamelCase method / Reader (fix): improved auth and port handling / Resource (fix): nasty typo fixed in setProp method (thx to Stephane Corlosquet) / getFormat (fix): improved SPARQL results detection / TurtleParser (fix): improved WS/non-WS handling around CURIEs (thx to Stephane Corlosquet) / RDFJSONSerializer (fix): improved escaping (thx to Gareth Jones) / RDFXMLSerializer (fix): improved QName generation / RemoteStore (fix): memory leaked (thx to Paul Houle) / DeleteQueryHandler (fix): less greedy triple deletion when datatype or language are declared (thx to Nicholas Rawlings) / LoadQueryHandler (tweak): getOComp now always keeps some trailing chars for improved sorting of URIs / SelectQueryHandler (fix): improved cleanup of temp tables in case of unexpected MySQL errors
- Loading branch information
Benjamin Nowack
committed
Feb 23, 2010
1 parent
4e06cb5
commit e699756
Showing
12 changed files
with
87 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* @author Benjamin Nowack <[email protected]> | ||
* @license http://arc.semsol.org/license | ||
* @package ARC2 | ||
* @version 2009-10-16 | ||
* @version 2010-01-18 | ||
*/ | ||
|
||
function ARC2_getFormat($v, $mtype = '', $ext = '') { | ||
|
@@ -15,6 +15,7 @@ function ARC2_getFormat($v, $mtype = '', $ext = '') { | |
$r = (!$r && preg_match('/\/rdf\+xml/', $mtype)) ? 'rdfxml' : $r; | ||
$r = (!$r && preg_match('/\/(x\-)?turtle/', $mtype)) ? 'turtle' : $r; | ||
$r = (!$r && preg_match('/\/rdf\+n3/', $mtype)) ? 'n3' : $r; | ||
$r = (!$r && preg_match('/\/sparql-results\+xml/', $mtype)) ? 'sparqlxml' : $r; | ||
/* xml sniffing */ | ||
if ( | ||
!$r && | ||
|
@@ -23,7 +24,7 @@ function ARC2_getFormat($v, $mtype = '', $ext = '') { | |
/* has an xmlns:* declaration or a matching pair of tags */ | ||
(preg_match('/\sxmlns\:?/', $v) || preg_match('/\<([^\s]+).+\<\/\\1\>/s', $v)) && | ||
/* not a typical ntriples/turtle/n3 file */ | ||
!preg_match('/\.\s*$/s', $v) | ||
!preg_match('/[\>\"\']\s*\.\s*$/s', $v) | ||
) { | ||
while (preg_match('/^\s*\<\?xml[^\r\n]+\?\>\s*/s', $v)) { | ||
$v = preg_replace('/^\s*\<\?xml[^\r\n]+\?\>\s*/s', '', $v); | ||
|
@@ -41,7 +42,7 @@ function ARC2_getFormat($v, $mtype = '', $ext = '') { | |
$r = (!$r && preg_match('/^\s*\<opml\s/s', $v)) ? 'opml' : $r; | ||
$r = (!$r && preg_match('/^\s*\<html[\s|\>]/is', $v)) ? 'html' : $r; | ||
$r = (!$r && preg_match('/^\s*\<sparql\s+[^\>]+http\:\/\/www\.w3\.org\/2005\/sparql\-results\#/s', $v)) ? 'sparqlxml' : $r; | ||
$r = (!$r && preg_match('/^\s*\<[^\>]+http\:\/\/www\.w3\.org\/2005\/sparql\-results#/s', $v)) ? 'srx' : $r; | ||
$r = (!$r && preg_match('/^\s*\<[^\>]+http\:\/\/www\.w3\.org\/2005\/sparql\-results#/s', $v)) ? 'srx' : $r; | ||
$r = (!$r && preg_match('/^\s*\<[^\s]*RDF[\s\>]/s', $v)) ? 'rdfxml' : $r; | ||
$r = (!$r && preg_match('/^\s*\<[^\>]+http\:\/\/www\.w3\.org\/1999\/02\/22\-rdf/s', $v)) ? 'rdfxml' : $r; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
<?php | ||
/* | ||
homepage: http://arc.semsol.org/ | ||
license: http://arc.semsol.org/license | ||
class: ARC2 RDF/JSON Serializer | ||
author: Benjamin Nowack | ||
version: 2008-07-01 (Fix: Proper jsonEscape method, thx to Keith Alexander) | ||
/** | ||
* ARC2 RDF/JSON Serializer | ||
* | ||
* @author Benjamin Nowack <[email protected]> | ||
* @license http://arc.semsol.org/license | ||
* @homepage <http://arc.semsol.org/> | ||
* @package ARC2 | ||
* @version 2010-02-23 | ||
*/ | ||
|
||
ARC2::inc('RDFSerializer'); | ||
|
@@ -39,12 +40,12 @@ function getTerm($v, $term = 's') { | |
return $this->getTerm($v['value'], $term); | ||
} | ||
if (preg_match('/^\_\:/', $v['value'])) { | ||
return '{ "value" : "' . $v['value']. '", "type" : "bnode" }'; | ||
return '{ "value" : "' . $this->jsonEscape($v['value']) . '", "type" : "bnode" }'; | ||
} | ||
return '{ "value" : "' . $v['value']. '", "type" : "uri" }'; | ||
return '{ "value" : "' . $this->jsonEscape($v['value']) . '", "type" : "uri" }'; | ||
} | ||
/* literal */ | ||
$r = '{ "value" : "' . $this->jsonEscape($v['value']). '", "type" : "literal"'; | ||
$r = '{ "value" : "' . $this->jsonEscape($v['value']) . '", "type" : "literal"'; | ||
$suffix = isset($v['datatype']) ? ', "datatype" : "' . $v['datatype'] . '"' : ''; | ||
$suffix = isset($v['lang']) ? ', "lang" : "' . $v['lang'] . '"' : $suffix; | ||
$r .= $suffix . ' }'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* @author Benjamin Nowack <[email protected]> | ||
* @license http://arc.semsol.org/license | ||
* @package ARC2 | ||
* @version 2009-12-08 | ||
* @version 2010-02-23 | ||
*/ | ||
|
||
ARC2::inc('Class'); | ||
|
@@ -144,16 +144,26 @@ function runQuery($q, $qt = '', $infos = '') { | |
/* ask|load|insert|delete */ | ||
if (in_array($qt, array('ask', 'load', 'insert', 'delete'))) { | ||
$bid = $parser->getBooleanInsertedDeleted(); | ||
switch ($qt) { | ||
case 'ask': return $bid['boolean']; | ||
default: return $bid; | ||
if ($qt == 'ask') { | ||
$r = $bid['boolean']; | ||
} | ||
else { | ||
$r = $bid; | ||
} | ||
} | ||
/* select */ | ||
if (($qt == 'select') && !method_exists($parser, 'getRows')) return $resp; | ||
if ($qt == 'select') return array('rows' => $parser->getRows(), 'variables' => $parser->getVariables()); | ||
elseif (($qt == 'select') && !method_exists($parser, 'getRows')) { | ||
$r = $resp; | ||
} | ||
elseif ($qt == 'select') { | ||
$r = array('rows' => $parser->getRows(), 'variables' => $parser->getVariables()); | ||
} | ||
/* any other */ | ||
return $parser->getSimpleIndex(0); | ||
else { | ||
$r = $parser->getSimpleIndex(0); | ||
} | ||
unset($parser); | ||
return $r; | ||
} | ||
|
||
/* */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
<?php | ||
/* | ||
homepage: http://arc.semsol.org/ | ||
license: http://arc.semsol.org/license | ||
class: ARC2 RDF Store DELETE Query Handler | ||
author: Benjamin Nowack | ||
version: 2009-06-15 (Addition: cleanValueTables method) | ||
/** | ||
* ARC2 RDF Store DELETE Query Handler | ||
* | ||
* @author Benjamin Nowack <[email protected]> | ||
* @license http://arc.semsol.org/license | ||
* @homepage <http://arc.semsol.org/> | ||
* @package ARC2 | ||
* @version 2010-02-23 | ||
*/ | ||
|
||
ARC2::inc('StoreQueryHandler'); | ||
|
@@ -103,8 +104,15 @@ function deleteTriples() { | |
} | ||
else { | ||
$term_id = $this->getTermID($t[$term], $term); | ||
$q .= $q ? ' AND ' : ''; | ||
$q .= 'T.' . $term . '=' . $term_id; | ||
$q .= ($q ? ' AND ' : '') . 'T.' . $term . '=' . $term_id; | ||
/* explicit lang/dt restricts the matching */ | ||
if ($term == 'o') { | ||
$o_lang = $this->v1('o_lang', '', $t); | ||
$o_lang_dt = $this->v1('o_datatype', $o_lang, $t); | ||
if ($o_lang_dt) { | ||
$q .= ($q ? ' AND ' : '') . 'T.o_lang_dt=' . $this->getTermID($o_lang_dt, 'lang_dt'); | ||
} | ||
} | ||
} | ||
} | ||
if ($skip) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters