Index: trunk/extensions/RDFIO/stores/SMW_ARC2Store.php |
— | — | @@ -2,9 +2,9 @@ |
3 | 3 | |
4 | 4 | global $IP; |
5 | 5 | |
6 | | -require_once("$IP/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php"); |
| 6 | +require_once( "$IP/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php" ); |
7 | 7 | |
8 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 8 | +if ( !defined( 'MEDIAWIKI' ) ) { |
9 | 9 | die( 'Not a valid entry point.' ); |
10 | 10 | } |
11 | 11 | |
— | — | @@ -22,28 +22,28 @@ |
23 | 23 | global $wgDBserver, $wgDBname, $wgDBuser, $wgDBpassword, $smwgARC2StoreConfig; |
24 | 24 | |
25 | 25 | /* instantiation */ |
26 | | - $this->arc2store = ARC2::getStore($smwgARC2StoreConfig); |
| 26 | + $this->arc2store = ARC2::getStore( $smwgARC2StoreConfig ); |
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * wraps removeDataForURI |
31 | 31 | * @param $subject |
32 | 32 | */ |
33 | | - function deleteSubject(Title $subject) { |
34 | | - $subject_uri = SMWExporter::expandURI($this->getURI($subject)); |
35 | | - $this->removeDataForURI($subject_uri); |
| 33 | + function deleteSubject( Title $subject ) { |
| 34 | + $subject_uri = SMWExporter::expandURI( $this->getURI( $subject ) ); |
| 35 | + $this->removeDataForURI( $subject_uri ); |
36 | 36 | |
37 | | - return parent::deleteSubject($subject); |
| 37 | + return parent::deleteSubject( $subject ); |
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * deletes triples that have $uri as subject |
42 | 42 | * @param $uri |
43 | 43 | */ |
44 | | - function removeDataForURI($uri) { |
45 | | - $sparqlUpdateText = "DELETE { <".$uri."> ?x ?y . }"; |
46 | | - wfDebugLog('SPARQL_LOG', "===DELETE===\n".$sparqlUpdateText); |
47 | | - $response = $this->do_arc2_query($sparqlUpdateText); |
| 44 | + function removeDataForURI( $uri ) { |
| 45 | + $sparqlUpdateText = "DELETE { <" . $uri . "> ?x ?y . }"; |
| 46 | + wfDebugLog( 'SPARQL_LOG', "===DELETE===\n" . $sparqlUpdateText ); |
| 47 | + $response = $this->do_arc2_query( $sparqlUpdateText ); |
48 | 48 | return $response; |
49 | 49 | } |
50 | 50 | |
— | — | @@ -51,18 +51,18 @@ |
52 | 52 | * Does update. First deletes, then inserts. |
53 | 53 | * @param $data |
54 | 54 | */ |
55 | | - function updateData(SMWSemanticData $data) { |
56 | | - $export = SMWExporter::makeExportData($data); |
57 | | - $subject_uri = SMWExporter::expandURI($export->getSubject()->getName()); |
| 55 | + function updateData( SMWSemanticData $data ) { |
| 56 | + $export = SMWExporter::makeExportData( $data ); |
| 57 | + $subject_uri = SMWExporter::expandURI( $export->getSubject()->getName() ); |
58 | 58 | |
59 | 59 | // remove subject from triple store |
60 | | - $this->removeDataForURI($subject_uri); |
| 60 | + $this->removeDataForURI( $subject_uri ); |
61 | 61 | |
62 | 62 | $triple_list = $export->getTripleList(); |
63 | 63 | |
64 | 64 | $sparqlUpdateText = "INSERT INTO <> {\n"; |
65 | 65 | |
66 | | - foreach ($triple_list as $triple) { |
| 66 | + foreach ( $triple_list as $triple ) { |
67 | 67 | |
68 | 68 | $subject = $triple[0]; |
69 | 69 | $predicate = $triple[1]; |
— | — | @@ -72,23 +72,23 @@ |
73 | 73 | $sub_str = ""; |
74 | 74 | $pre_str = ""; |
75 | 75 | |
76 | | - if ($object instanceof SMWExpLiteral) { |
77 | | - $obj_str = "\"".$object->getName()."\"".(($object->getDatatype() == "") ? "" : "^^<".$object->getDatatype().">"); |
78 | | - } else if ($object instanceof SMWExpResource) { |
79 | | - $obj_str = "<".SMWExporter::expandURI($object->getName()).">"; |
| 76 | + if ( $object instanceof SMWExpLiteral ) { |
| 77 | + $obj_str = "\"" . $object->getName() . "\"" . ( ( $object->getDatatype() == "" ) ? "" : "^^<" . $object->getDatatype() . ">" ); |
| 78 | + } else if ( $object instanceof SMWExpResource ) { |
| 79 | + $obj_str = "<" . SMWExporter::expandURI( $object->getName() ) . ">"; |
80 | 80 | } else { |
81 | 81 | $obj_str = "\"\""; |
82 | 82 | } |
83 | 83 | |
84 | | - if ($subject instanceof SMWExpResource) { |
85 | | - $sub_str = "<".SMWExporter::expandURI($subject->getName()).">"; |
| 84 | + if ( $subject instanceof SMWExpResource ) { |
| 85 | + $sub_str = "<" . SMWExporter::expandURI( $subject->getName() ) . ">"; |
86 | 86 | } |
87 | 87 | |
88 | | - if ($predicate instanceof SMWExpResource) { |
89 | | - $pre_str = "<".SMWExporter::expandURI($predicate->getName()).">"; |
| 88 | + if ( $predicate instanceof SMWExpResource ) { |
| 89 | + $pre_str = "<" . SMWExporter::expandURI( $predicate->getName() ) . ">"; |
90 | 90 | } |
91 | 91 | |
92 | | - $sparqlUpdateText .= $sub_str." ".$pre_str." ".$obj_str." .\n"; |
| 92 | + $sparqlUpdateText .= $sub_str . " " . $pre_str . " " . $obj_str . " .\n"; |
93 | 93 | } |
94 | 94 | $sparqlUpdateText .= "}\n"; |
95 | 95 | |
— | — | @@ -96,22 +96,22 @@ |
97 | 97 | // var_dump(); |
98 | 98 | // TODO Debug-code |
99 | 99 | |
100 | | - wfDebugLog('SPARQL_LOG', "===INSERT===\n".$sparqlUpdateText); |
| 100 | + wfDebugLog( 'SPARQL_LOG', "===INSERT===\n" . $sparqlUpdateText ); |
101 | 101 | |
102 | | - $response = $this->do_arc2_query($sparqlUpdateText); |
| 102 | + $response = $this->do_arc2_query( $sparqlUpdateText ); |
103 | 103 | |
104 | | - return parent::updateData($data); |
| 104 | + return parent::updateData( $data ); |
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Insert new pages into endpoint. Used to import data. |
109 | 109 | * @param $title |
110 | 110 | */ |
111 | | - function insertData(Title $title, $pageid) { |
112 | | - $newpage = SMWDataValueFactory::newTypeIDValue('_wpg'); |
113 | | - $newpage->setValues($title->getDBkey(), $title->getNamespace(), $pageid); |
114 | | - $semdata = $this->getSemanticData($newpage); |
115 | | - $this->updateData($semdata); |
| 111 | + function insertData( Title $title, $pageid ) { |
| 112 | + $newpage = SMWDataValueFactory::newTypeIDValue( '_wpg' ); |
| 113 | + $newpage->setValues( $title->getDBkey(), $title->getNamespace(), $pageid ); |
| 114 | + $semdata = $this->getSemanticData( $newpage ); |
| 115 | + $this->updateData( $semdata ); |
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
— | — | @@ -121,25 +121,25 @@ |
122 | 122 | * @param $pageid |
123 | 123 | * @param $redirid |
124 | 124 | */ |
125 | | - function changeTitle(Title $oldtitle, Title $newtitle, $pageid, $redirid=0) { |
| 125 | + function changeTitle( Title $oldtitle, Title $newtitle, $pageid, $redirid = 0 ) { |
126 | 126 | |
127 | 127 | // Save it in parent store now! |
128 | 128 | // We need that so we get all information correctly! |
129 | | - $result = parent::changeTitle($oldtitle, $newtitle, $pageid, $redirid); |
| 129 | + $result = parent::changeTitle( $oldtitle, $newtitle, $pageid, $redirid ); |
130 | 130 | |
131 | 131 | // delete old stuff |
132 | | - $old_uri = SMWExporter::expandURI($this->getURI($oldtitle)); |
133 | | - $this->removeDataForURI($old_uri); |
| 132 | + $old_uri = SMWExporter::expandURI( $this->getURI( $oldtitle ) ); |
| 133 | + $this->removeDataForURI( $old_uri ); |
134 | 134 | |
135 | | - $newpage = SMWDataValueFactory::newTypeIDValue('_wpg'); |
136 | | - $newpage->setValues($newtitle->getDBkey(), $newtitle->getNamespace(), $pageid); |
137 | | - $semdata = $this->getSemanticData($newpage); |
138 | | - $this->updateData($semdata); |
| 135 | + $newpage = SMWDataValueFactory::newTypeIDValue( '_wpg' ); |
| 136 | + $newpage->setValues( $newtitle->getDBkey(), $newtitle->getNamespace(), $pageid ); |
| 137 | + $semdata = $this->getSemanticData( $newpage ); |
| 138 | + $this->updateData( $semdata ); |
139 | 139 | |
140 | | - $oldpage = SMWDataValueFactory::newTypeIDValue('_wpg'); |
141 | | - $oldpage->setValues($oldtitle->getDBkey(), $oldtitle->getNamespace(), $redirid); |
142 | | - $semdata = $this->getSemanticData($oldpage); |
143 | | - $this->updateData($semdata,false); |
| 140 | + $oldpage = SMWDataValueFactory::newTypeIDValue( '_wpg' ); |
| 141 | + $oldpage->setValues( $oldtitle->getDBkey(), $oldtitle->getNamespace(), $redirid ); |
| 142 | + $semdata = $this->getSemanticData( $oldpage ); |
| 143 | + $this->updateData( $semdata, false ); |
144 | 144 | |
145 | 145 | return $result; |
146 | 146 | } |
— | — | @@ -148,12 +148,12 @@ |
149 | 149 | * no setup required |
150 | 150 | * @param unknown_type $verbose |
151 | 151 | */ |
152 | | - function setup($verbose = true) { |
153 | | - return parent::setup($verbose); |
| 152 | + function setup( $verbose = true ) { |
| 153 | + return parent::setup( $verbose ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | |
157 | | - function drop($verbose = true) { |
| 157 | + function drop( $verbose = true ) { |
158 | 158 | return parent::drop(); |
159 | 159 | } |
160 | 160 | |
— | — | @@ -162,13 +162,13 @@ |
163 | 163 | * TODO: Deprecated, replaced by do_arc2_query |
164 | 164 | * @param $requestString |
165 | 165 | */ |
166 | | - function do_arc2_post($requestString) { |
| 166 | + function do_arc2_post( $requestString ) { |
167 | 167 | $postdata = http_build_query( |
168 | 168 | array( |
169 | 169 | 'request' => $requestString |
170 | 170 | ) |
171 | 171 | ); |
172 | | - $opts = array('http' => |
| 172 | + $opts = array( 'http' => |
173 | 173 | array( |
174 | 174 | 'method' => 'POST', |
175 | 175 | 'header' => 'Content-type: application/x-www-form-urlencoded', |
— | — | @@ -176,20 +176,20 @@ |
177 | 177 | ) |
178 | 178 | ); |
179 | 179 | |
180 | | - $context = stream_context_create($opts); |
181 | | - $result = file_get_contents(SPARQL_ENDPOINT_UPDATE_URL, false, $context); |
| 180 | + $context = stream_context_create( $opts ); |
| 181 | + $result = file_get_contents( SPARQL_ENDPOINT_UPDATE_URL, false, $context ); |
182 | 182 | return $result; |
183 | 183 | } |
184 | 184 | |
185 | | - |
| 185 | + |
186 | 186 | /** |
187 | 187 | * Communicates with ARC2 RDF Store |
188 | 188 | * @param $requestString |
189 | 189 | */ |
190 | | - function do_arc2_query($requestString) { |
| 190 | + function do_arc2_query( $requestString ) { |
191 | 191 | |
192 | 192 | $q = $requestString; |
193 | | - $rs = $this->arc2store->query($q); |
| 193 | + $rs = $this->arc2store->query( $q ); |
194 | 194 | $result = $rs; |
195 | 195 | |
196 | 196 | // echo( "<pre>" . $this->unhtmlify( $requestString ) . "</pre>" ); |
— | — | @@ -206,8 +206,8 @@ |
207 | 207 | * @return string $outstring |
208 | 208 | */ |
209 | 209 | function unhtmlify( $instring ) { |
210 | | - $outstring = str_replace('<','<',$instring); |
211 | | - $outstring = str_replace('>','>',$outstring); |
| 210 | + $outstring = str_replace( '<', '<', $instring ); |
| 211 | + $outstring = str_replace( '>', '>', $outstring ); |
212 | 212 | return $outstring; |
213 | 213 | } |
214 | 214 | |
— | — | @@ -217,14 +217,14 @@ |
218 | 218 | * @param string $title |
219 | 219 | * @return string $uri |
220 | 220 | */ |
221 | | - protected function getURI($title) { |
| 221 | + protected function getURI( $title ) { |
222 | 222 | $uri = ""; |
223 | | - if($title instanceof Title){ |
224 | | - $dv = SMWDataValueFactory::newTypeIDValue('_wpg'); |
225 | | - $dv->setTitle($title); |
| 223 | + if ( $title instanceof Title ) { |
| 224 | + $dv = SMWDataValueFactory::newTypeIDValue( '_wpg' ); |
| 225 | + $dv->setTitle( $title ); |
226 | 226 | $exp = $dv->getExportData(); |
227 | 227 | $uri = $exp->getSubject()->getName(); |
228 | | - }else{ |
| 228 | + } else { |
229 | 229 | // There could be other types as well that we do NOT handle here |
230 | 230 | } |
231 | 231 | |
Index: trunk/extensions/RDFIO/specials/SpecialARC2Admin.alias.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | $aliases = array(); |
4 | | - |
| 4 | + |
5 | 5 | /** English */ |
6 | 6 | $aliases['en'] = array( |
7 | 7 | 'SpecialARC2Admin' => array( 'ARC2Admin' ), |
Index: trunk/extensions/RDFIO/specials/SpecialARC2Admin_body.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | class SpecialARC2Admin extends SpecialPage { |
9 | 9 | |
10 | 10 | protected $m_issysop; |
11 | | - |
| 11 | + |
12 | 12 | function __construct() { |
13 | 13 | global $wgUser; |
14 | 14 | |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | $this->m_issysop = true; |
18 | 18 | } else { |
19 | 19 | $this->m_issysop = false; |
20 | | - } |
21 | | - |
| 20 | + } |
| 21 | + |
22 | 22 | parent::__construct( 'SpecialARC2Admin' ); |
23 | | - wfLoadExtensionMessages('SpecialARC2Admin'); |
| 23 | + wfLoadExtensionMessages( 'SpecialARC2Admin' ); |
24 | 24 | } |
25 | 25 | |
26 | 26 | function execute( $par ) { |
27 | | - global $wgRequest, $wgOut, $wgDBserver, $wgDBname, $wgDBuser, |
| 27 | + global $wgRequest, $wgOut, $wgDBserver, $wgDBname, $wgDBuser, |
28 | 28 | $wgDBpassword, $smwgARC2StoreConfig, $wgArticlePath, |
29 | 29 | $wgServer, $wgScriptPath, $wgUser; |
30 | 30 | |
— | — | @@ -31,14 +31,14 @@ |
32 | 32 | $output = ""; |
33 | 33 | |
34 | 34 | # Get request data from, e.g. |
35 | | - $rdfio_action = $wgRequest->getText('rdfio_action'); |
| 35 | + $rdfio_action = $wgRequest->getText( 'rdfio_action' ); |
36 | 36 | |
37 | 37 | # instantiation |
38 | | - $store = ARC2::getStore($smwgARC2StoreConfig); |
| 38 | + $store = ARC2::getStore( $smwgARC2StoreConfig ); |
39 | 39 | |
40 | 40 | $output .= "\n===RDF Store Setup===\n'''Status:'''\n\n"; |
41 | 41 | |
42 | | - if (!$store->isSetUp()) { |
| 42 | + if ( !$store->isSetUp() ) { |
43 | 43 | $output .= "* Store is '''not''' set up\n"; |
44 | 44 | if ( $rdfio_action == "setup" ) { |
45 | 45 | if ( !$wgUser->matchEditToken( $wgRequest->getText( 'token' ) ) ) { |
— | — | @@ -48,9 +48,9 @@ |
49 | 49 | $output .= "* Setting up now ...\n"; |
50 | 50 | $store->setUp(); |
51 | 51 | $output .= "* Done!\n"; |
52 | | - } else{ |
| 52 | + } else { |
53 | 53 | $errormessage = "Only sysops can perform this operation!"; |
54 | | - $wgOut->addHTML( RDFIOUtils::formatErrorHTML("Permission Error", $errormessage) ); |
| 54 | + $wgOut->addHTML( RDFIOUtils::formatErrorHTML( "Permission Error", $errormessage ) ); |
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
Index: trunk/extensions/RDFIO/specials/SpecialARC2Admin.i18n.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | $messages = array(); |
4 | | - |
5 | | -$messages['en'] = array( |
| 4 | + |
| 5 | +$messages['en'] = array( |
6 | 6 | 'specialarc2admin' => 'ARC2 RDF Store Admin Page', |
7 | 7 | 'specialarc2admin-desc' => 'Administration page for the ARC2 RDF Store for Semantic MediaWiki', |
8 | 8 | ); |
9 | | - |
| 9 | + |
Index: trunk/extensions/RDFIO/specials/SpecialARC2Admin.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
4 | | -if (!defined('MEDIAWIKI')) { |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) { |
5 | 5 | echo <<<EOT |
6 | 6 | To install my extension, put the following line in LocalSettings.php: |
7 | 7 | require_once( "\$IP/extensions/SMWRDFConnector/SpecialARC2Admin.php" ); |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | 'version' => '0.0.0', |
19 | 19 | ); |
20 | 20 | |
21 | | -$dir = dirname(__FILE__) . '/'; |
| 21 | +$dir = dirname( __FILE__ ) . '/'; |
22 | 22 | |
23 | 23 | $wgAutoloadClasses['SpecialARC2Admin'] = $dir . 'SpecialARC2Admin_body.php'; # Tell MediaWiki to load the extension body. |
24 | 24 | $wgExtensionMessagesFiles['SpecialARC2Admin'] = $dir . 'SpecialARC2Admin.i18n.php'; |
Index: trunk/extensions/RDFIO/specials/SpecialSPARQLEndpoint_body.php |
— | — | @@ -15,12 +15,12 @@ |
16 | 16 | protected $m_outputequivuris; |
17 | 17 | protected $m_haswriteaccess; // User permission |
18 | 18 | protected $m_hasdeleteaccess; // User permission |
19 | | - |
| 19 | + |
20 | 20 | function __construct() { |
21 | 21 | global $wgUser, $rdfiogQueryByOrigURI; |
22 | 22 | |
23 | 23 | parent::__construct( 'SPARQLEndpoint' ); |
24 | | - wfLoadExtensionMessages('SPARQLEndpoint'); |
| 24 | + wfLoadExtensionMessages( 'SPARQLEndpoint' ); |
25 | 25 | $this->m_sparqlendpointconfig = $this->getSPARQLEndpointConfig(); |
26 | 26 | $this->m_sparqlendpoint = ARC2::getStoreEndpoint( $this->m_sparqlendpointconfig ); |
27 | 27 | $this->m_sparqlparser = ARC2::getSPARQLPlusParser(); |
— | — | @@ -31,12 +31,12 @@ |
32 | 32 | $this->m_haswriteaccess = true; |
33 | 33 | } else { |
34 | 34 | $this->m_haswriteaccess = false; |
35 | | - } |
| 35 | + } |
36 | 36 | if ( in_array( 'edit', $userrights ) && in_array( 'delete', $userrights ) ) { |
37 | 37 | $this->m_hasdeleteaccess = true; |
38 | 38 | } else { |
39 | 39 | $this->m_hasdeleteaccess = false; |
40 | | - } |
| 40 | + } |
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
— | — | @@ -47,15 +47,15 @@ |
48 | 48 | |
49 | 49 | $this->setHeaders(); |
50 | 50 | $this->handleRequestData(); |
51 | | - |
| 51 | + |
52 | 52 | $executesparql = true; |
53 | | - |
| 53 | + |
54 | 54 | if ( $this->m_query == '' ) { |
55 | 55 | $this->printHTMLForm(); |
56 | 56 | } else { |
57 | 57 | $this->ensureSparqlEndpointInstalled(); |
58 | 58 | $this->convertURIsInQuery(); |
59 | | - |
| 59 | + |
60 | 60 | if ( $this->m_querytype == 'insert' ) { // TODO |
61 | 61 | if ( $this->checkAllowInsert() ) { |
62 | 62 | $this->importTriplesInQuery(); |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | // TODO Add a "successfully inserted/deleted" message here |
70 | 70 | $this->printHTMLForm(); |
71 | 71 | } else { // We are querying/outputting data, not editing |
72 | | - |
| 72 | + |
73 | 73 | if ( $this->m_outputtype == 'htmltab' ) { |
74 | 74 | $this->printHTMLForm(); |
75 | 75 | if ( $wgRequest->getBool( 'showquery', false ) ) { |
— | — | @@ -146,40 +146,40 @@ |
147 | 147 | * in class variables |
148 | 148 | */ |
149 | 149 | function handleRequestData() { |
150 | | - global $wgRequest, |
| 150 | + global $wgRequest, |
151 | 151 | $rdfiogQueryByOrigURI, |
152 | 152 | $rdfiogQueryByEquivURI, |
153 | 153 | $rdfiogOutputOrigURIs, |
154 | 154 | $rdfiogOutputEquivURIs; |
155 | | - |
| 155 | + |
156 | 156 | $this->m_query = $wgRequest->getText( 'query' ); |
157 | | - |
| 157 | + |
158 | 158 | if ( $rdfiogQueryByOrigURI == '' ) { |
159 | 159 | $this->m_querybyoriguri = $wgRequest->getBool( 'origuri_q' ); // No default value, as to not overwrite configurable setting in LocalSettings.php |
160 | 160 | } else { |
161 | 161 | $this->m_querybyoriguri = $rdfiogQueryByOrigURI; |
162 | 162 | } |
163 | | - |
| 163 | + |
164 | 164 | if ( $rdfiogQueryByEquivURI == '' ) { |
165 | 165 | $this->m_querybyequivuri = $wgRequest->getBool( 'equivuri_q' ); |
166 | 166 | } else { |
167 | 167 | $this->m_querybyequivuri = $rdfiogQueryByEquivURI; |
168 | 168 | } |
169 | | - |
| 169 | + |
170 | 170 | if ( $rdfiogOutputOrigURIs == '' ) { |
171 | 171 | $this->m_outputoriguris = $wgRequest->getBool( 'origuri_o' ); |
172 | 172 | } else { |
173 | 173 | $this->m_outputoriguris = $rdfiogOutputOrigURIs; |
174 | 174 | } |
175 | | - |
| 175 | + |
176 | 176 | if ( $rdfiogOutputEquivURIs == '' ) { |
177 | 177 | $this->m_outputequivuris = $wgRequest->getBool( 'equivuri_o' ); |
178 | 178 | } else { |
179 | 179 | $this->m_outputequivuris = $rdfiogOutputEquivURIs; |
180 | 180 | } |
181 | | - |
| 181 | + |
182 | 182 | $this->m_filtervocab = $wgRequest->getBool( 'filtervocab', false ); |
183 | | - $this->m_filtervocaburl = $wgRequest->getText( 'filtervocaburl'); |
| 183 | + $this->m_filtervocaburl = $wgRequest->getText( 'filtervocaburl' ); |
184 | 184 | $this->m_outputtype = $wgRequest->getText( 'output' ); |
185 | 185 | if ( $this->m_query !== '' ) { |
186 | 186 | $this->m_sparqlparser->parse( $this->m_query, '' ); |
— | — | @@ -189,16 +189,16 @@ |
190 | 190 | } |
191 | 191 | } |
192 | 192 | } |
193 | | - |
| 193 | + |
194 | 194 | function ensureSparqlEndpointInstalled() { |
195 | | - if (!$this->m_sparqlendpoint->isSetUp()) { |
| 195 | + if ( !$this->m_sparqlendpoint->isSetUp() ) { |
196 | 196 | $this->m_sparqlendpoint->setUp(); /* create MySQL tables */ |
197 | 197 | } |
198 | 198 | } |
199 | | - |
| 199 | + |
200 | 200 | /** |
201 | | - * If option is so chosen, convert URIs in the query to |
202 | | - * their corresponding "Original URIs" or "Equivalent URIs" |
| 201 | + * If option is so chosen, convert URIs in the query to |
| 202 | + * their corresponding "Original URIs" or "Equivalent URIs" |
203 | 203 | */ |
204 | 204 | function convertURIsInQuery() { |
205 | 205 | if ( $this->m_querybyoriguri ) { |
— | — | @@ -215,34 +215,34 @@ |
216 | 216 | if ( $s_type === 'uri' ) { |
217 | 217 | $triple['s'] = 's'; |
218 | 218 | $triple['s_type'] = 'var'; |
219 | | - $newtriple = $this->createEquivURITriple( $s, 's' ); |
| 219 | + $newtriple = $this->createEquivURITriple( $s, 's' ); |
220 | 220 | $query_structure['query']['pattern']['patterns'][0]['patterns'][] = $newtriple; |
221 | 221 | } |
222 | 222 | if ( $p_type === 'uri' ) { |
223 | 223 | $triple['p'] = 'p'; |
224 | 224 | $triple['p_type'] = 'var'; |
225 | | - $newtriple = $this->createEquivURITriple( $p, 'p', true ); |
| 225 | + $newtriple = $this->createEquivURITriple( $p, 'p', true ); |
226 | 226 | $query_structure['query']['pattern']['patterns'][0]['patterns'][] = $newtriple; |
227 | 227 | } |
228 | 228 | if ( $o_type === 'uri' ) { |
229 | 229 | $triple['o'] = 'o'; |
230 | 230 | $triple['o_type'] = 'var'; |
231 | | - $newtriple = $this->createEquivURITriple( $o, 'o' ); |
| 231 | + $newtriple = $this->createEquivURITriple( $o, 'o' ); |
232 | 232 | $query_structure['query']['pattern']['patterns'][0]['patterns'][] = $newtriple; |
233 | 233 | } |
234 | 234 | // restore the first triple into its original location |
235 | 235 | $query_structure['query']['pattern']['patterns'][0]['patterns'][0] = $triple; |
236 | | - require_once(__DIR__ . "/bundle/ARC2_SPARQLSerializerPlugin.php"); |
| 236 | + require_once( __DIR__ . "/bundle/ARC2_SPARQLSerializerPlugin.php" ); |
237 | 237 | $sparqlserializer = new ARC2_SPARQLSerializerPlugin(); |
238 | 238 | $query = $sparqlserializer->toString( $query_structure ); |
239 | | - |
| 239 | + |
240 | 240 | $this->setQueryInPost( $query ); |
241 | 241 | # $this->convertEquivURIsToInternalURIsInQuery(); // TODO DEPRECATED |
242 | 242 | } |
243 | 243 | } |
244 | | - |
| 244 | + |
245 | 245 | /** |
246 | | - * Get an array of property URIs from the specified ontology, |
| 246 | + * Get an array of property URIs from the specified ontology, |
247 | 247 | * to function as a filter |
248 | 248 | * @return array $vocab_p_uri_filter |
249 | 249 | */ |
— | — | @@ -264,7 +264,7 @@ |
265 | 265 | } |
266 | 266 | return $vocab_p_uri_filter; |
267 | 267 | } |
268 | | - |
| 268 | + |
269 | 269 | /** |
270 | 270 | * Create an RDF triple that links a wiki page to its corresponding |
271 | 271 | * equivalent URI |
— | — | @@ -292,7 +292,7 @@ |
293 | 293 | ); |
294 | 294 | return $equivuritriple; |
295 | 295 | } |
296 | | - |
| 296 | + |
297 | 297 | /** |
298 | 298 | * Check if writing to wiki is allowed, and handle a number |
299 | 299 | * of exceptions to that, by showing error messages etc |
— | — | @@ -319,7 +319,7 @@ |
320 | 320 | } |
321 | 321 | } |
322 | 322 | } |
323 | | - |
| 323 | + |
324 | 324 | /** |
325 | 325 | * Check if deleting from wiki is allowed, and handle a number |
326 | 326 | * of exceptions to that, by showing error messages etc |
— | — | @@ -340,7 +340,7 @@ |
341 | 341 | } |
342 | 342 | } |
343 | 343 | } |
344 | | - |
| 344 | + |
345 | 345 | /** |
346 | 346 | * Print out the datastructure of the query in preformatted text |
347 | 347 | */ |
— | — | @@ -350,8 +350,8 @@ |
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
354 | | - * Do preparations for getting outputted data as a downloadable file |
355 | | - * rather than written to the current page |
| 354 | + * Do preparations for getting outputted data as a downloadable file |
| 355 | + * rather than written to the current page |
356 | 356 | */ |
357 | 357 | function prepareCreatingDownloadableFile() { |
358 | 358 | global $wgOut; |
— | — | @@ -363,7 +363,7 @@ |
364 | 364 | // and potentially is to be downloaded as a file |
365 | 365 | $this->sendHeadersForOutputType( $this->m_outputtype ); |
366 | 366 | } |
367 | | - |
| 367 | + |
368 | 368 | /** |
369 | 369 | * Print out the HTML Form |
370 | 370 | */ |
— | — | @@ -391,19 +391,19 @@ |
392 | 392 | */ |
393 | 393 | function importTriplesInQuery() { |
394 | 394 | $triples = $this->m_query_parsed['query']['construct_triples']; |
395 | | - $rdfImporter = new RDFIOSMWBatchWriter( $triples, 'triples_array'); |
| 395 | + $rdfImporter = new RDFIOSMWBatchWriter( $triples, 'triples_array' ); |
396 | 396 | $rdfImporter->execute(); |
397 | 397 | } |
398 | | - |
| 398 | + |
399 | 399 | /** |
400 | 400 | * After a query is parsed, delete the parsed data from the wiki |
401 | 401 | */ |
402 | 402 | function deleteTriplesInQuery() { |
403 | 403 | $triples = $this->m_query_parsed['query']['construct_triples']; |
404 | | - $rdfImporter = new RDFIOSMWBatchWriter( $triples, 'triples_array'); |
| 404 | + $rdfImporter = new RDFIOSMWBatchWriter( $triples, 'triples_array' ); |
405 | 405 | $rdfImporter->executeDelete(); |
406 | 406 | } |
407 | | - |
| 407 | + |
408 | 408 | /** |
409 | 409 | * Die and display current errors |
410 | 410 | */ |
— | — | @@ -422,16 +422,16 @@ |
423 | 423 | RDFIOUtils::showErrorMessage( "SPARQL Error", $errormessage ); |
424 | 424 | } |
425 | 425 | } |
426 | | - |
| 426 | + |
427 | 427 | /** |
428 | 428 | * For each URI in the (unparsed) query that is set by an "Original URI" property in |
429 | | - * the wiki, replace it with the page's corresponding URI Resolver URI |
| 429 | + * the wiki, replace it with the page's corresponding URI Resolver URI |
430 | 430 | */ |
431 | 431 | function convertOrigURIsToInternalURIsInQuery() { |
432 | 432 | $query = $this->m_query; |
433 | 433 | $origuris = RDFIOUtils::extractURIs( $this->m_query ); // TODO: Use parsed query instead |
434 | 434 | $count = count( $origuris ); |
435 | | - if ( $count > 1 || ($count > 0 && !RDFIOUtils::contains("URIResolver", $origuris[0])) ) { // The first URI is the URI Resolver one, which always is there |
| 435 | + if ( $count > 1 || ( $count > 0 && !RDFIOUtils::contains( "URIResolver", $origuris[0] ) ) ) { // The first URI is the URI Resolver one, which always is there |
436 | 436 | foreach ( $origuris as $origuri ) { |
437 | 437 | $uri = $this->m_store->getURIForOrigURI( $origuri ); |
438 | 438 | if ( $uri != '' ) { |
— | — | @@ -443,10 +443,10 @@ |
444 | 444 | $this->setQueryInPost( $query ); |
445 | 445 | } |
446 | 446 | } |
447 | | - |
| 447 | + |
448 | 448 | /** |
449 | 449 | * For each URI in the (unparsed) query that is set by an "Equivalent URI" property in |
450 | | - * the wiki, replace it with the page's corresponding URI Resolver URI |
| 450 | + * the wiki, replace it with the page's corresponding URI Resolver URI |
451 | 451 | */ |
452 | 452 | function convertEquivURIsToInternalURIsInQuery() { |
453 | 453 | $equivuris = RDFIOUtils::extractURIs( $this->m_query ); // TODO: Use parsed query instead |
— | — | @@ -464,10 +464,10 @@ |
465 | 465 | $this->setQueryInPost( $query ); |
466 | 466 | } |
467 | 467 | } |
468 | | - |
| 468 | + |
469 | 469 | /** |
470 | 470 | * Convert all URI Resolver URIs which have a corresponding Original URI, |
471 | | - * to that Original URI. |
| 471 | + * to that Original URI. |
472 | 472 | * @param array $triples |
473 | 473 | * @return array $triples |
474 | 474 | */ |
— | — | @@ -488,10 +488,10 @@ |
489 | 489 | } |
490 | 490 | return $triples; |
491 | 491 | } |
492 | | - |
| 492 | + |
493 | 493 | /** |
494 | 494 | * Convert all URI Resolver URIs which have a corresponding Original URI, |
495 | | - * to that Original URI. |
| 495 | + * to that Original URI. |
496 | 496 | * @param array $triples |
497 | 497 | * @return array $triples |
498 | 498 | */ |
— | — | @@ -513,8 +513,8 @@ |
514 | 514 | } |
515 | 515 | } |
516 | 516 | return $output_structure; |
517 | | - } |
518 | | - |
| 517 | + } |
| 518 | + |
519 | 519 | /** |
520 | 520 | * For all property URIs, add triples using equivalent uris for the, |
521 | 521 | * current property uri |
— | — | @@ -529,19 +529,19 @@ |
530 | 530 | $equivuris = $this->m_store->getEquivURIsForURI( $propertyuri, true ); |
531 | 531 | foreach ( $equivuris as $equivuri ) { |
532 | 532 | $newtriple = array( |
533 | | - 's' => $triple['s'], |
| 533 | + 's' => $triple['s'], |
534 | 534 | 'p' => $equivuri, |
535 | 535 | 'o' => $triple['o'] |
536 | 536 | ); |
537 | 537 | $newtriples[] = $newtriple; |
538 | 538 | } |
539 | 539 | } |
540 | | - $triples = array_merge( $triples, $newtriples ); |
| 540 | + $triples = array_merge( $triples, $newtriples ); |
541 | 541 | return $triples; |
542 | 542 | } |
543 | | - |
| 543 | + |
544 | 544 | /** |
545 | | - * For all property URIs and all subject and objects which have URIs, |
| 545 | + * For all property URIs and all subject and objects which have URIs, |
546 | 546 | * add triples using equivalent uris for these URIs (in all combinations |
547 | 547 | * thereof). If $p_uris_filter is set, allow only triples with properties |
548 | 548 | * included in this filter array |
— | — | @@ -556,7 +556,7 @@ |
557 | 557 | // Subject |
558 | 558 | $s_equivuris = array( $triple['s'] ); |
559 | 559 | if ( $triple['s_type'] === 'uri' ) { |
560 | | - $s_uri = $triple['s']; |
| 560 | + $s_uri = $triple['s']; |
561 | 561 | $s_equivuris_temp = $this->m_store->getEquivURIsForURI( $s_uri ); |
562 | 562 | if ( count( $s_equivuris_temp ) > 0 ) { |
563 | 563 | $s_equivuris = $s_equivuris_temp; |
— | — | @@ -576,23 +576,23 @@ |
577 | 577 | $p_equivuris = $p_equivuris_temp; |
578 | 578 | } |
579 | 579 | } |
580 | | - |
| 580 | + |
581 | 581 | // Object |
582 | 582 | $o_equivuris = array( $triple['o'] ); |
583 | 583 | if ( $triple['o_type'] === 'uri' ) { |
584 | | - $o_uri = $triple['o']; |
| 584 | + $o_uri = $triple['o']; |
585 | 585 | $o_equivuris_temp = $this->m_store->getEquivURIsForURI( $o_uri ); |
586 | 586 | if ( count( $o_equivuris_temp ) > 0 ) { |
587 | 587 | $o_equivuris = $o_equivuris_temp; |
588 | 588 | } |
589 | 589 | } |
590 | | - |
| 590 | + |
591 | 591 | // Generate triples |
592 | 592 | foreach ( $s_equivuris as $s_equivuri ) { |
593 | 593 | foreach ( $p_equivuris as $p_equivuri ) { |
594 | 594 | foreach ( $o_equivuris as $o_equivuri ) { |
595 | 595 | $newtriple = array( |
596 | | - 's' => $s_equivuri, |
| 596 | + 's' => $s_equivuri, |
597 | 597 | 'p' => $p_equivuri, |
598 | 598 | 'o' => $o_equivuri |
599 | 599 | ); |
— | — | @@ -603,12 +603,12 @@ |
604 | 604 | } |
605 | 605 | return $newtriples; |
606 | 606 | } |
607 | | - |
| 607 | + |
608 | 608 | function complementSPARQLResultRowsWithEquivURIs( $output_structure, $p_uris_filter = '' ) { |
609 | 609 | $predvarname = $this->getPredicateVariableName(); |
610 | 610 | $variables = $output_structure['result']['variables']; |
611 | 611 | $rows = $output_structure['result']['rows']; |
612 | | - |
| 612 | + |
613 | 613 | $predvarname = 'p'; // TODO DO a real check up |
614 | 614 | $newrows_total = array(); |
615 | 615 | foreach ( $rows as $rowid => $row ) { |
— | — | @@ -651,7 +651,7 @@ |
652 | 652 | $output_structure['result']['rows'] = $newrows_total; |
653 | 653 | return $output_structure; |
654 | 654 | } |
655 | | - |
| 655 | + |
656 | 656 | /** |
657 | 657 | * Convert an ARC triple index array structure into RDF/XML |
658 | 658 | * @param array $tripleindex |
— | — | @@ -668,7 +668,7 @@ |
669 | 669 | } |
670 | 670 | return $rdfxml; |
671 | 671 | } |
672 | | - |
| 672 | + |
673 | 673 | /** |
674 | 674 | * Convert an ARC triples array into RDF/XML |
675 | 675 | * @param array $triples |
— | — | @@ -685,10 +685,10 @@ |
686 | 686 | } |
687 | 687 | return $rdfxml; |
688 | 688 | } |
689 | | - |
| 689 | + |
690 | 690 | /** |
691 | 691 | * Convert all URI Resolver URIs which have a corresponding Original URI, |
692 | | - * to that Original URI. |
| 692 | + * to that Original URI. |
693 | 693 | * @param string $text |
694 | 694 | * @return string $text |
695 | 695 | */ |
— | — | @@ -704,7 +704,7 @@ |
705 | 705 | } |
706 | 706 | return $text; |
707 | 707 | } |
708 | | - |
| 708 | + |
709 | 709 | function getPredicateVariableName() { |
710 | 710 | $predvarname = $this->m_query_parsed['vars'][1]; |
711 | 711 | return $predvarname; |
— | — | @@ -722,15 +722,15 @@ |
723 | 723 | 'db_user' => $wgDBuser, |
724 | 724 | 'db_pwd' => $wgDBpassword, |
725 | 725 | 'store_name' => $smwgARC2StoreConfig['store_name'], |
726 | | - 'endpoint_features' => |
| 726 | + 'endpoint_features' => |
727 | 727 | array( |
728 | | - 'select', |
729 | | - 'construct', |
730 | | - 'ask', |
731 | | - 'describe', |
| 728 | + 'select', |
| 729 | + 'construct', |
| 730 | + 'ask', |
| 731 | + 'describe', |
732 | 732 | # 'load', |
733 | 733 | # 'insert', // This is not needed, since it is done via SMWWriter instead |
734 | | - # 'delete', // This is not needed, since it is done via SMWWriter instead |
| 734 | + # 'delete', // This is not needed, since it is done via SMWWriter instead |
735 | 735 | # 'dump' /* dump is a special command for streaming SPOG export */ |
736 | 736 | ), |
737 | 737 | 'endpoint_timeout' => 60, /* not implemented in ARC2 preview */ |
— | — | @@ -794,7 +794,7 @@ |
795 | 795 | * @param string $query |
796 | 796 | * @return string $htmlForm |
797 | 797 | */ |
798 | | - private function getHTMLForm( $query = '') { |
| 798 | + private function getHTMLForm( $query = '' ) { |
799 | 799 | global $wgArticlePath, $wgUser, $wgRequest; |
800 | 800 | |
801 | 801 | $uriResolverURI = $this->m_store->getURIResolverURI(); |
— | — | @@ -815,22 +815,22 @@ |
816 | 816 | |
817 | 817 | $selected_output_html = $wgRequest->getText( 'output', '' ) == 'htmltab' ? ' selected="selected" ' : ''; |
818 | 818 | $selected_output_rdfxml = $wgRequest->getText( 'output', '' ) == 'rdfxml' ? ' selected="selected" ' : ''; |
819 | | - |
| 819 | + |
820 | 820 | // Make the HTML format selected by default |
821 | 821 | if ( $selected_output_rdfxml == '' ) { |
822 | 822 | $selected_output_html = ' selected="selected" '; |
823 | 823 | } |
824 | 824 | |
825 | | - $htmlForm = '<form method="post" action="' . str_replace('/$1', '', $wgArticlePath) . '/Special:SPARQLEndpoint" |
| 825 | + $htmlForm = '<form method="post" action="' . str_replace( '/$1', '', $wgArticlePath ) . '/Special:SPARQLEndpoint" |
826 | 826 | name="createEditQuery"> |
827 | 827 | <div style="font-size: 10px"> |
828 | | - |
| 828 | + |
829 | 829 | <table border="0"><tbody> |
830 | 830 | <tr><td colspan="3">Enter SPARQL query:</td><tr> |
831 | 831 | <tr><td colspan="3"><textarea cols="80" rows="9" name="query">' . $query . '</textarea></td></tr> |
832 | 832 | <tr> |
833 | 833 | <td style="vertical-align: top; border-right: 1px solid #ccc;"> |
834 | | - |
| 834 | + |
835 | 835 | <table border="0" style="background: transparent; font-size: 11px;"> |
836 | 836 | <tr><td width="160" style="text-align: right">Query by original URIs:</td> |
837 | 837 | <td> |
— | — | @@ -840,11 +840,11 @@ |
841 | 841 | <td> |
842 | 842 | <input type="checkbox" name="equivuri_q" value="1" ' . $checked_equivuri_q . '/> |
843 | 843 | </td></tr> |
844 | | - </table> |
845 | | - |
| 844 | + </table> |
| 845 | + |
846 | 846 | </td> |
847 | 847 | <td width="170" style="vertical-align: top; border-right: 1px solid #ccc;"> |
848 | | - |
| 848 | + |
849 | 849 | <table border="0" style="font-size: 11px; background: transparent;"> |
850 | 850 | <tr><td style="text-align: right">Output original URIs:</td> |
851 | 851 | <td> |
— | — | @@ -855,37 +855,37 @@ |
856 | 856 | <input type="checkbox" name="equivuri_o" id="outputequivuri" value="1" ' . $checked_equivuri_o . ' onChange="toggleDisplay(\'byontology\');" /> |
857 | 857 | </td></tr> |
858 | 858 | </table> |
859 | | - |
| 859 | + |
860 | 860 | </td> |
861 | 861 | <td width="260" style="vertical-align: top;"> |
862 | | - |
| 862 | + |
863 | 863 | <table border="0" style="font-size: 11px; background: transparent;" > |
864 | 864 | <tr><td style="text-align: right" width="180">Output format:</td> |
865 | 865 | <td style="vertical-align: top"> |
866 | | - <select id="output" name="output" onChange="toggleDisplay(\'byontology\');" > |
| 866 | + <select id="output" name="output" onChange="toggleDisplay(\'byontology\');" > |
867 | 867 | <!-- <option value="" >default</option> --> |
868 | 868 | <!-- <option value="json" >JSON</option> --> |
869 | 869 | <!-- <option value="plain" >Plain</option> --> |
870 | | - <!-- <option value="php_ser" >Serialized PHP</option> --> |
| 870 | + <!-- <option value="php_ser" >Serialized PHP</option> --> |
871 | 871 | <!-- <option value="turtle" >Turtle</option> --> |
872 | | - <option value="htmltab" ' . $selected_output_html . '>HTML</option> |
| 872 | + <option value="htmltab" ' . $selected_output_html . '>HTML</option> |
873 | 873 | <option value="xml" >XML Resultset</option> |
874 | | - <option value="rdfxml" ' . $selected_output_rdfxml . '>RDF/XML</option> |
875 | | - <!-- <option value="infos" >Query Structure</option> --> |
| 874 | + <option value="rdfxml" ' . $selected_output_rdfxml . '>RDF/XML</option> |
| 875 | + <!-- <option value="infos" >Query Structure</option> --> |
876 | 876 | <!-- <option value="tsv" >TSV</option> --> |
877 | | - </select> |
| 877 | + </select> |
878 | 878 | </td></tr> |
879 | 879 | <tr> |
880 | 880 | <td colspan="2"> |
881 | 881 | <span style="font-family: arial, helvetica, sans-serif; font-size: 10px; color: #777;">(RDF/XML requires creating triples using <a href="http://www.w3.org/TR/rdf-sparql-query/#construct">CONSTRUCT</a>)</span> |
882 | 882 | </td> |
883 | 883 | </table> |
884 | | - |
| 884 | + |
885 | 885 | </td> |
886 | 886 | </tr> |
887 | 887 | <tr> |
888 | 888 | <td colspan="3"> |
889 | | - |
| 889 | + |
890 | 890 | <div id="byontology" style="display: none; background: #ffd; border: 1px solid #ee7;"> |
891 | 891 | <table border="0" style="font-size: 11px; background: transparent;" > |
892 | 892 | <tr><td style="text-align: right;">Filter by vocabulary:</td> |
— | — | @@ -902,19 +902,19 @@ |
903 | 903 | <td> </td> |
904 | 904 | <td> |
905 | 905 | <span style="font-family: arial, helvetica, sans-serif; font-size: 10px; color: #777">Example: http://xmlns.com/foaf/spec/index.rdf</span> |
906 | | - </td></tr> |
| 906 | + </td></tr> |
907 | 907 | </table> |
908 | | - </div> |
909 | | - |
| 908 | + </div> |
| 909 | + |
910 | 910 | </td> |
911 | 911 | </table> |
912 | 912 | </div> |
913 | | - |
914 | | - <input type="submit" value="Submit">' . Xml::hidden( 'token', $wgUser->editToken() ) . ' |
| 913 | + |
| 914 | + <input type="submit" value="Submit">' . Xml::hidden( 'token', $wgUser->editToken() ) . ' |
915 | 915 | </form>'; |
916 | 916 | return $htmlForm; |
917 | 917 | } |
918 | | - |
| 918 | + |
919 | 919 | /** |
920 | 920 | * Get the javascript used for some functionality in the main SPARQL |
921 | 921 | * querying HTML form |
— | — | @@ -924,10 +924,10 @@ |
925 | 925 | $htmlFormScript = "<script type=\"text/javascript\"> |
926 | 926 | function toggleDisplay(id1) { |
927 | 927 | var bostyle = document.getElementById(id1).style.display; |
928 | | - var fmtsel = document.getElementById('output'); |
| 928 | + var fmtsel = document.getElementById('output'); |
929 | 929 | var fmt = fmtsel.options[fmtsel.selectedIndex].value; |
930 | 930 | var outsel = document.getElementById('outputequivuri'); |
931 | | - if ( outsel.checked && fmt.match('rdfxml') ) { |
| 931 | + if ( outsel.checked && fmt.match('rdfxml') ) { |
932 | 932 | document.getElementById(id1).style.display = 'block'; |
933 | 933 | } else { |
934 | 934 | document.getElementById(id1).style.display = 'none'; |
— | — | @@ -942,13 +942,13 @@ |
943 | 943 | * @return string $query |
944 | 944 | */ |
945 | 945 | function getQuery() { |
946 | | - $query = $wgRequest->getText('query'); |
| 946 | + $query = $wgRequest->getText( 'query' ); |
947 | 947 | return $query; |
948 | 948 | } |
949 | 949 | |
950 | 950 | /** |
951 | | - * Update the query variable in the $_POST object. |
952 | | - * Useful for passing on parsing to ARC, since $_POST is what ARC reads |
| 951 | + * Update the query variable in the $_POST object. |
| 952 | + * Useful for passing on parsing to ARC, since $_POST is what ARC reads |
953 | 953 | * @param string $query |
954 | 954 | */ |
955 | 955 | function setQueryInPost( $query ) { |
— | — | @@ -957,8 +957,8 @@ |
958 | 958 | } |
959 | 959 | |
960 | 960 | /** |
961 | | - * Update the output (type) variable in the $_POST object. |
962 | | - * Useful for passing on parsing to ARC, since $_POST is what ARC reads |
| 961 | + * Update the output (type) variable in the $_POST object. |
| 962 | + * Useful for passing on parsing to ARC, since $_POST is what ARC reads |
963 | 963 | * @param string $type |
964 | 964 | */ |
965 | 965 | function setOutputTypeInPost( $type ) { |
Index: trunk/extensions/RDFIO/specials/SpecialSPARQLEndpoint.i18n.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | $messages = array(); |
4 | 5 | |
5 | 6 | $messages['en'] = array( |
6 | 7 | 'sparqlendpoint' => 'SPARQL Endpoint', |
7 | 8 | 'sparqlendpoint-desc' => 'A SPARQLEndpoint provided by the SMWRDFConnector', |
8 | 9 | ); |
9 | | - |
Index: trunk/extensions/RDFIO/specials/SpecialRDFImport_body.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | protected $m_nsprefix_in_wikititles_entities; |
13 | 13 | protected $m_show_abbrscreen_properties; |
14 | 14 | protected $m_show_abbrscreen_entities; |
15 | | - |
| 15 | + |
16 | 16 | function __construct() { |
17 | 17 | global $wgUser; |
18 | 18 | |
— | — | @@ -20,9 +20,9 @@ |
21 | 21 | $this->m_haswriteaccess = true; |
22 | 22 | } else { |
23 | 23 | $this->m_haswriteaccess = false; |
24 | | - } |
| 24 | + } |
25 | 25 | parent::__construct( 'RDFImport' ); |
26 | | - wfLoadExtensionMessages('RDFImport'); |
| 26 | + wfLoadExtensionMessages( 'RDFImport' ); |
27 | 27 | } |
28 | 28 | |
29 | 29 | function execute( $par ) { |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | |
32 | 32 | $this->setHeaders(); |
33 | 33 | $this->handleRequestData(); |
34 | | - |
| 34 | + |
35 | 35 | if ( $this->m_action == 'Import' ) { |
36 | 36 | if ( !$wgUser->matchEditToken( $this->m_edittoken ) ) { |
37 | 37 | die( 'Cross-site request forgery detected!' ); |
— | — | @@ -68,24 +68,24 @@ |
69 | 69 | $this->outputHTMLForm(); |
70 | 70 | } |
71 | 71 | } |
72 | | - |
| 72 | + |
73 | 73 | /** |
74 | 74 | * Get data from the request object and store it in class variables |
75 | 75 | */ |
76 | 76 | function handleRequestData() { |
77 | 77 | global $wgRequest; |
78 | | - $this->m_action = $wgRequest->getText('action'); |
79 | | - $this->m_dataformat = $wgRequest->getText('dataformat'); |
80 | | - $this->m_importdata = $wgRequest->getText('importdata'); |
| 78 | + $this->m_action = $wgRequest->getText( 'action' ); |
| 79 | + $this->m_dataformat = $wgRequest->getText( 'dataformat' ); |
| 80 | + $this->m_importdata = $wgRequest->getText( 'importdata' ); |
81 | 81 | $this->m_edittoken = $wgRequest->getText( 'token' ); |
82 | 82 | $this->m_nsprefix_in_wikititles_properties = $wgRequest->getBool( 'nspintitle_prop', false ); |
83 | 83 | $this->m_show_abbrscreen_properties = $wgRequest->getBool( 'abbrscr_prop', false ); |
84 | 84 | $this->m_nsprefix_in_wikititles_entities = $wgRequest->getBool( 'nspintitle_ent', false ); |
85 | 85 | $this->m_show_abbrscreen_entities = $wgRequest->getBool( 'abbrscr_ent', false ); |
86 | 86 | } |
87 | | - |
| 87 | + |
88 | 88 | /** |
89 | | - * Create a new SMWBatchWriter object, store it in a class variable, and |
| 89 | + * Create a new SMWBatchWriter object, store it in a class variable, and |
90 | 90 | * set some options, like which ns prefixes to use. |
91 | 91 | */ |
92 | 92 | function initSMWBatchWriter() { |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | $this->m_smwbatchwriter->setUseNSPInTitlesForProperties( $this->m_nsprefix_in_wikititles_properties ); |
95 | 95 | $this->m_smwbatchwriter->setUseNSPInTitlesForEntities( $this->m_nsprefix_in_wikititles_entities ); |
96 | 96 | } |
97 | | - |
| 97 | + |
98 | 98 | /** |
99 | 99 | * Tell the SMWBatchWriter object to execute the import |
100 | 100 | */ |
— | — | @@ -103,13 +103,13 @@ |
104 | 104 | $wgOut->addScript( $this->getExampleDataJs() ); |
105 | 105 | $wgOut->addHTML( $this->getHTMLFormContent() ); |
106 | 106 | } |
107 | | - |
| 107 | + |
108 | 108 | /** |
109 | 109 | * Add more namespace prefixes in the configured namespace mapping |
110 | 110 | */ |
111 | 111 | function addNewNsPrefixes() { |
112 | | - $nss = $wgRequest->getArray('ns',array()); |
113 | | - $nsprefixes = $wgRequest->getArray('nsprefixes',array()); |
| 112 | + $nss = $wgRequest->getArray( 'ns', array() ); |
| 113 | + $nsprefixes = $wgRequest->getArray( 'nsprefixes', array() ); |
114 | 114 | $newnsmappings = array(); |
115 | 115 | $nsid = 0; |
116 | 116 | foreach ( $nss as $ns ) { |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | $this->initSMWBatchWriter(); |
122 | 122 | $this->m_smwbatchwriter->AddNamespacePrefixes( $newnsmappings ); |
123 | 123 | } |
124 | | - |
| 124 | + |
125 | 125 | /** |
126 | 126 | * Output the HTML for the form, to the user |
127 | 127 | */ |
— | — | @@ -129,9 +129,9 @@ |
130 | 130 | $wgOut->addScript( $this->getExampleDataJs() ); |
131 | 131 | $wgOut->addHTML( $this->getHTMLFormContent() ); |
132 | 132 | } |
133 | | - |
134 | | - /** |
135 | | - * For a number of base uri:s, generate the HTML for a screen for |
| 133 | + |
| 134 | + /** |
| 135 | + * For a number of base uri:s, generate the HTML for a screen for |
136 | 136 | * configuring abbreviation for them |
137 | 137 | * @param array $baseuris |
138 | 138 | */ |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | "; |
155 | 155 | return $baseuriscreen; |
156 | 156 | } |
157 | | - |
| 157 | + |
158 | 158 | /** |
159 | 159 | * For an array of unabbreviated entities, generate HTML for a |
160 | 160 | * formatted list of these entities' URIs |
— | — | @@ -203,16 +203,16 @@ |
204 | 204 | \\n\ |
205 | 205 | </rdf:RDF>'; |
206 | 206 | } |
207 | | - |
| 207 | + |
208 | 208 | /** |
209 | 209 | * Generate the main HTML form, if the variable $extraFormContent is set, the |
210 | | - * content of it will be prepended before the form |
| 210 | + * content of it will be prepended before the form |
211 | 211 | * @param string $extraFormContent |
212 | 212 | * @return string $htmlFormContent |
213 | 213 | */ |
214 | 214 | public function getHTMLFormContent( $extraFormContent = '' ) { |
215 | 215 | global $wgRequest, $wgUser, $wgArticlePath; |
216 | | - |
| 216 | + |
217 | 217 | // Abbreviation (and screen) options for properties |
218 | 218 | $checked_nspintitle_properties = $wgRequest->getBool( 'nspintitle_prop', false ) == 1 ? ' checked="true" ' : ''; |
219 | 219 | $checked_abbrscr_properties = $wgRequest->getBool( 'abbrscr_prop', false ) == 1 ? ' checked="true" ' : ''; |
— | — | @@ -222,9 +222,9 @@ |
223 | 223 | $checked_abbrscr_entities = $wgRequest->getBool( 'abbrscr_ent', false ) == 1 ? ' checked="true" ' : ''; |
224 | 224 | |
225 | 225 | $this->m_importdata = $wgRequest->getText( 'importdata', '' ); |
226 | | - |
| 226 | + |
227 | 227 | // Create the HTML form for RDF/XML Import |
228 | | - $htmlFormContent = '<form method="post" action="' . str_replace('/$1', '', $wgArticlePath) . '/Special:RDFImport" |
| 228 | + $htmlFormContent = '<form method="post" action="' . str_replace( '/$1', '', $wgArticlePath ) . '/Special:RDFImport" |
229 | 229 | name="createEditQuery"><input type="hidden" name="action" value="Import"> |
230 | 230 | ' . $extraFormContent . ' |
231 | 231 | <table border="0"><tbody> |
— | — | @@ -233,9 +233,9 @@ |
234 | 234 | </td></tr> |
235 | 235 | <tr><td width="100">Data format:</td> |
236 | 236 | <td> |
237 | | - <select id="dataformat" name="dataformat"> |
238 | | - <option value="rdfxml" selected="selected">RDF/XML</option> |
239 | | - <option value="turtle" >Turtle</option> |
| 237 | + <select id="dataformat" name="dataformat"> |
| 238 | + <option value="rdfxml" selected="selected">RDF/XML</option> |
| 239 | + <option value="turtle" >Turtle</option> |
240 | 240 | </select> |
241 | 241 | </td> |
242 | 242 | <td style="text-align: right; font-size: 10px;"> |
Index: trunk/extensions/RDFIO/specials/SpecialSPARQLEndpoint.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
4 | | -if (!defined('MEDIAWIKI')) { |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) { |
5 | 5 | echo <<<EOT |
6 | 6 | To install my extension, put the following line in LocalSettings.php: |
7 | 7 | require_once( "\$IP/extensions/SMWRDFConnector/SpecialSPARQLEndpoint.php" ); |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | 'version' => '0.0.0', |
19 | 19 | ); |
20 | 20 | |
21 | | -$dir = dirname(__FILE__) . '/'; |
| 21 | +$dir = dirname( __FILE__ ) . '/'; |
22 | 22 | |
23 | 23 | $wgAutoloadClasses['SPARQLEndpoint'] = $dir . 'SpecialSPARQLEndpoint_body.php'; # Tell MediaWiki to load the extension body. |
24 | 24 | $wgExtensionMessagesFiles['SPARQLEndpoint'] = $dir . 'SpecialSPARQLEndpoint.i18n.php'; |
Index: trunk/extensions/RDFIO/specials/SpecialRDFImport.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
4 | | -if (!defined('MEDIAWIKI')) { |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) { |
5 | 5 | echo <<<EOT |
6 | 6 | To install my extension, put the following line in LocalSettings.php: |
7 | 7 | require_once( "\$IP/extensions/SMWRDFConnector/SpecialRDFImport.php" ); |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | 'version' => '0.0.0', |
19 | 19 | ); |
20 | 20 | |
21 | | -$dir = dirname(__FILE__) . '/'; |
| 21 | +$dir = dirname( __FILE__ ) . '/'; |
22 | 22 | |
23 | 23 | $wgAutoloadClasses['RDFImport'] = $dir . 'SpecialRDFImport_body.php'; # Tell MediaWiki to load the extension body. |
24 | 24 | $wgExtensionMessagesFiles['RDFImport'] = $dir . 'SpecialRDFImport.i18n.php'; |
Index: trunk/extensions/RDFIO/INSTALL |
— | — | @@ -1,3 +1,2 @@ |
2 | | -For easily readable install instructions, see: |
| 2 | +For easily readable installation instructions, see: |
3 | 3 | http://www.mediawiki.org/wiki/Extension:RDFIO#Installing_RDFIO |
4 | | - |
Property changes on: trunk/extensions/RDFIO/INSTALL |
___________________________________________________________________ |
Added: svn:eol-style |
5 | 4 | + native |
Index: trunk/extensions/RDFIO/RELEASE-NOTES |
— | — | @@ -12,10 +12,10 @@ |
13 | 13 | ;Numerous fixes to make remote SPARQL querying work |
14 | 14 | |
15 | 15 | * Improved file hierarchy |
16 | | -* Made querying and output of/querying by Original URIs and Equivalent URIs |
| 16 | +* Made querying and output of/querying by Original URIs and Equivalent URIs |
17 | 17 | configurable from LocalSettings.php in SPARQL endpoint (So this can be turned on for remote queries too) |
18 | | -* In total five new configurable settings for LocalSettings.php (see |
19 | | - http://www.mediawiki.org/wiki/Extension:RDFIO#LocalSettings.php_configuration |
| 18 | +* In total five new configurable settings for LocalSettings.php (see |
| 19 | + http://www.mediawiki.org/wiki/Extension:RDFIO#LocalSettings.php_configuration |
20 | 20 | for full list): |
21 | 21 | ** $rdfiogQueryByOrigURI = true; |
22 | 22 | ** $rdfiogOutputOrigURIs = true; |
— | — | @@ -26,21 +26,21 @@ |
27 | 27 | Bioclipse/Jena work |
28 | 28 | |
29 | 29 | |
30 | | -== RDFIO 0.4.0 == |
| 30 | +== RDFIO 0.4.0 == |
31 | 31 | |
32 | 32 | Released on 2010-08-16 |
33 | 33 | |
34 | 34 | * Support for configuring extra namespace prefixes in LocalSettings.php |
35 | 35 | * More options in RDF Import screen |
36 | | -* Output SPARQL resultset as default for remote queries, and HTML for form |
| 36 | +* Output SPARQL resultset as default for remote queries, and HTML for form |
37 | 37 | queries |
38 | | -* Enable output as Original URI/Equivalent URI also for XML Resultset output |
| 38 | +* Enable output as Original URI/Equivalent URI also for XML Resultset output |
39 | 39 | format |
40 | | -* Refactorings (Merged EquivalentURIHandler and SMWBatchWriter classes, Broke |
| 40 | +* Refactorings (Merged EquivalentURIHandler and SMWBatchWriter classes, Broke |
41 | 41 | out RDFIOPageHandler in separate file) |
42 | 42 | * Many bugfixes |
43 | 43 | |
44 | | -== RDFIO 0.3.0 == |
| 44 | +== RDFIO 0.3.0 == |
45 | 45 | |
46 | 46 | Released on 2010-07-30 |
47 | 47 | |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | * Option to query by Equivalent URI |
52 | 52 | * Refined SPARQL Endpoint screen |
53 | 53 | * Option to output all Equivalent URIs (For RDF/XML format only) |
54 | | -* Option to filter properties by ontology (when outputting equivalent URIs) by |
| 54 | +* Option to filter properties by ontology (when outputting equivalent URIs) by |
55 | 55 | specified an URL to an OWL ontology definition. (For RDF/XML format only). |
56 | 56 | * Much improved processing of SPARQL queries |
57 | 57 | * Various refactoring |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | ** Don't delete Original URI properties etc when deleting other facts (r151) |
61 | 61 | ** Fixed error in isURL check (r153) |
62 | 62 | |
63 | | -== RDFIO 0.2.0 == |
| 63 | +== RDFIO 0.2.0 == |
64 | 64 | |
65 | 65 | Released on 2010-07-20 |
66 | 66 | |
— | — | @@ -70,10 +70,9 @@ |
71 | 71 | * Improved code structure and comments |
72 | 72 | * Various small fixes |
73 | 73 | |
74 | | -== RDFIO 0.1.0 == |
| 74 | +== RDFIO 0.1.0 == |
75 | 75 | |
76 | 76 | Released on 2010-07-21 |
77 | 77 | |
78 | 78 | :Summary |
79 | 79 | ;First release |
80 | | - |
Property changes on: trunk/extensions/RDFIO/RELEASE-NOTES |
___________________________________________________________________ |
Added: svn:eol-style |
81 | 80 | + native |
Property changes on: trunk/extensions/RDFIO/COPYING |
___________________________________________________________________ |
Added: svn:eol-style |
82 | 81 | + native |
Index: trunk/extensions/RDFIO/RDFIO.php |
— | — | @@ -1,24 +1,23 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /** |
5 | 4 | * Initializing file for SMW RDFIO extension. |
6 | 5 | * |
7 | 6 | * @file |
8 | 7 | * @ingroup RDFIO |
9 | 8 | */ |
10 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 9 | +if ( !defined( 'MEDIAWIKI' ) ) { |
11 | 10 | die( 'Not an entry point.' ); |
12 | 11 | } |
13 | 12 | |
14 | | -define('RDFIO_VERSION', '0.5.0'); |
15 | | - |
| 13 | +define( 'RDFIO_VERSION', '0.5.0' ); |
| 14 | + |
16 | 15 | global $wgExtensionCredits; |
17 | 16 | |
18 | | -$wgExtensionCredits['other'][]= array( |
| 17 | +$wgExtensionCredits['other'][] = array( |
19 | 18 | 'path' => __FILE__, |
20 | 19 | 'name' => 'RDFIO', |
21 | 20 | 'version' => RDFIO_VERSION, |
22 | | - 'author' => array( '[http://saml.rilspace.org Samuel Lampa]' ), |
| 21 | + 'author' => '[http://saml.rilspace.org Samuel Lampa]', |
23 | 22 | 'url' => 'http://www.mediawiki.org/wiki/Extension:RDFIO', |
24 | 23 | 'description' => 'Extended RDF Import/Export functionality, including SPARQL endpoint, for Semantic MediaWiki' |
25 | 24 | ); |
— | — | @@ -28,7 +27,7 @@ |
29 | 28 | ****************************/ |
30 | 29 | |
31 | 30 | $smwgARC2Path = $smwgIP . '/libs/arc/'; |
32 | | -require_once($smwgARC2Path . '/ARC2.php'); |
| 31 | +require_once( $smwgARC2Path . '/ARC2.php' ); |
33 | 32 | |
34 | 33 | /************************** |
35 | 34 | * ARC2 RDF Store config * |
— | — | @@ -45,24 +44,23 @@ |
46 | 45 | ); |
47 | 46 | $smwgDefaultStore = 'SMWARC2Store'; // Determines database table prefix |
48 | 47 | |
49 | | -require_once("$IP/extensions/RDFIO/stores/SMW_ARC2Store.php"); |
50 | | -require_once("$IP/extensions/RDFIO/specials/SpecialARC2Admin.php"); |
| 48 | +require_once( "$IP/extensions/RDFIO/stores/SMW_ARC2Store.php" ); |
| 49 | +require_once( "$IP/extensions/RDFIO/specials/SpecialARC2Admin.php" ); |
51 | 50 | |
52 | 51 | /************************** |
53 | 52 | * SMWWriter settings * |
54 | 53 | **************************/ |
| 54 | +// @todo FIXME: use auto loader where possible. |
| 55 | +include_once( "$IP/extensions/PageObjectModel/POM.php" ); |
| 56 | +include_once( "$IP/extensions/SMWWriter/SMWWriter.php" ); |
55 | 57 | |
56 | | -include_once("$IP/extensions/PageObjectModel/POM.php"); |
57 | | -include_once("$IP/extensions/SMWWriter/SMWWriter.php"); |
58 | | - |
59 | 58 | /************************** |
60 | 59 | * RDFIO Components * |
61 | 60 | **************************/ |
62 | 61 | |
63 | | -require_once("classes/Utils.php"); |
64 | | -require_once("classes/RDFStore.php"); |
65 | | -require_once("classes/SMWBatchWriter.php"); |
66 | | -require_once("classes/PageHandler.php"); |
67 | | -require_once("specials/SpecialRDFImport.php"); |
68 | | -require_once("specials/SpecialSPARQLEndpoint.php"); |
69 | | - |
| 62 | +require_once( "classes/Utils.php" ); |
| 63 | +require_once( "classes/RDFStore.php" ); |
| 64 | +require_once( "classes/SMWBatchWriter.php" ); |
| 65 | +require_once( "classes/PageHandler.php" ); |
| 66 | +require_once( "specials/SpecialRDFImport.php" ); |
| 67 | +require_once( "specials/SpecialSPARQLEndpoint.php" ); |
Index: trunk/extensions/RDFIO/bundle/ARC2_SPARQLSerializerPlugin.php |
— | — | @@ -11,184 +11,184 @@ |
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | | -ARC2::inc('Class'); |
| 15 | +ARC2::inc( 'Class' ); |
16 | 16 | |
17 | 17 | class ARC2_SPARQLSerializerPlugin extends ARC2_Class { |
18 | 18 | |
19 | | - function __construct($a = '', &$caller) { |
20 | | - parent::__construct($a, $caller); |
| 19 | + function __construct( $a = '', &$caller ) { |
| 20 | + parent::__construct( $a, $caller ); |
21 | 21 | } |
22 | | - |
23 | | - function ARC2_SPARQLSerializerPlugin ($a = '', &$caller) { |
24 | | - $this->__construct($a, $caller); |
| 22 | + |
| 23 | + function ARC2_SPARQLSerializerPlugin ( $a = '', &$caller ) { |
| 24 | + $this->__construct( $a, $caller ); |
25 | 25 | } |
26 | 26 | |
27 | 27 | function __init() { |
28 | 28 | parent::__init(); |
29 | 29 | } |
30 | 30 | |
31 | | - function toString($infos){ |
| 31 | + function toString( $infos ) { |
32 | 32 | $this->infos = $infos; |
33 | | - return self::sparql_info_to_string($infos['query']); |
| 33 | + return self::sparql_info_to_string( $infos['query'] ); |
34 | 34 | } |
35 | 35 | |
36 | | - function sparql_info_to_string($t, $only_triples=false){ |
| 36 | + function sparql_info_to_string( $t, $only_triples = false ) { |
37 | 37 | $string = ''; |
38 | | - if(isset($t['type'])){ |
39 | | - switch($t['type']){ |
| 38 | + if ( isset( $t['type'] ) ) { |
| 39 | + switch( $t['type'] ) { |
40 | 40 | case 'construct': |
41 | | - $string .='CONSTRUCT { '.$this->sparql_info_to_string($t['construct_triples'], true).' } '; |
| 41 | + $string .= 'CONSTRUCT { ' . $this->sparql_info_to_string( $t['construct_triples'], true ) . ' } '; |
42 | 42 | case 'describe': |
43 | 43 | case 'select': |
44 | | - if(in_array($t['type'], array('select','describe'))){ |
45 | | - $string.= ' '.strtoupper($t['type']).' '; |
46 | | - if (isset($t['result_vars'])) foreach($t['result_vars'] as $v){ |
47 | | - $string.= ' ?'.$v['var']; |
| 44 | + if ( in_array( $t['type'], array( 'select', 'describe' ) ) ) { |
| 45 | + $string .= ' ' . strtoupper( $t['type'] ) . ' '; |
| 46 | + if ( isset( $t['result_vars'] ) ) foreach ( $t['result_vars'] as $v ) { |
| 47 | + $string .= ' ?' . $v['var']; |
48 | 48 | } |
49 | | - if (isset($t['result_iris'])) foreach($t['result_iris'] as $v){ |
50 | | - $string.= ' <'.$v['iri'].'> '; |
| 49 | + if ( isset( $t['result_iris'] ) ) foreach ( $t['result_iris'] as $v ) { |
| 50 | + $string .= ' <' . $v['iri'] . '> '; |
51 | 51 | } |
52 | 52 | } |
53 | 53 | case 'ask': |
54 | | - if(!empty($t['dataset'])){ |
55 | | - foreach($t['dataset'] as $dataset){ |
56 | | - $string.= ' FROM '.(($dataset['named'])? 'NAMED ': '').'<'.$dataset['graph'].'> '; |
| 54 | + if ( !empty( $t['dataset'] ) ) { |
| 55 | + foreach ( $t['dataset'] as $dataset ) { |
| 56 | + $string .= ' FROM ' . ( ( $dataset['named'] ) ? 'NAMED ': '' ) . '<' . $dataset['graph'] . '> '; |
57 | 57 | } |
58 | 58 | } |
59 | | - if(!isset($t['pattern'])) var_dump($this->infos); |
60 | | - else $string .= ' WHERE '.$this->sparql_info_to_string($t['pattern']).''; |
| 59 | + if ( !isset( $t['pattern'] ) ) var_dump( $this->infos ); |
| 60 | + else $string .= ' WHERE ' . $this->sparql_info_to_string( $t['pattern'] ) . ''; |
61 | 61 | break; |
62 | 62 | case 'triple': |
63 | | - $string.= $this->triple_to_string($t); |
| 63 | + $string .= $this->triple_to_string( $t ); |
64 | 64 | break; |
65 | 65 | case 'union': |
66 | 66 | $patterns = array(); |
67 | | - foreach($t['patterns'] as $pattern){ |
68 | | - $patterns[]='{'.$this->sparql_info_to_string($pattern, $only_triples).'}'; |
| 67 | + foreach ( $t['patterns'] as $pattern ) { |
| 68 | + $patterns[] = '{' . $this->sparql_info_to_string( $pattern, $only_triples ) . '}'; |
69 | 69 | } |
70 | | - $string .= implode(' UNION ', $patterns); |
| 70 | + $string .= implode( ' UNION ', $patterns ); |
71 | 71 | break; |
72 | 72 | case 'group': |
73 | 73 | case 'triples': |
74 | 74 | case 'optional': |
75 | | - $pattern_string =''; |
76 | | - foreach($t['patterns'] as $pattern){ |
77 | | - $pattern_string.=" ".$this->sparql_info_to_string($pattern, $only_triples)." "; |
| 75 | + $pattern_string = ''; |
| 76 | + foreach ( $t['patterns'] as $pattern ) { |
| 77 | + $pattern_string .= " " . $this->sparql_info_to_string( $pattern, $only_triples ) . " "; |
78 | 78 | } |
79 | | - switch($t['type']){ |
| 79 | + switch( $t['type'] ) { |
80 | 80 | case 'group': |
81 | | - $string.='{ '.$pattern_string.' }'; |
| 81 | + $string .= '{ ' . $pattern_string . ' }'; |
82 | 82 | break; |
83 | 83 | case 'triples': |
84 | | - $string.= $pattern_string; |
| 84 | + $string .= $pattern_string; |
85 | 85 | break; |
86 | 86 | case 'optional': |
87 | | - $string.= (!$only_triples)? 'OPTIONAL { '.$pattern_string.' }' : '{ '.$pattern_string.' }' ; |
88 | | - break; |
| 87 | + $string .= ( !$only_triples ) ? 'OPTIONAL { ' . $pattern_string . ' }' : '{ ' . $pattern_string . ' }' ; |
| 88 | + break; |
89 | 89 | } |
90 | 90 | break; |
91 | 91 | case 'filter': |
92 | | - $string .=(!$only_triples)? "FILTER(".$this->sparql_info_to_string($t['constraint']).")" : ''; |
| 92 | + $string .= ( !$only_triples ) ? "FILTER(" . $this->sparql_info_to_string( $t['constraint'] ) . ")" : ''; |
93 | 93 | break; |
94 | 94 | case 'built_in_call': |
95 | | - $string .=$t['operator'].strtoupper($t['call'])."("; |
96 | | - $args=array(); |
97 | | - foreach($t['args'] as $arg){ $args[]=$this->sparql_info_to_string($arg); |
| 95 | + $string .= $t['operator'] . strtoupper( $t['call'] ) . "("; |
| 96 | + $args = array(); |
| 97 | + foreach ( $t['args'] as $arg ) { $args[] = $this->sparql_info_to_string( $arg ); |
98 | 98 | } |
99 | | - $string .=implode(',', $args).') '; |
| 99 | + $string .= implode( ',', $args ) . ') '; |
100 | 100 | break; |
101 | 101 | case 'var': |
102 | | - $var_string ='?'.$t['value']; |
103 | | - if(isset($t['direction'])) $var_string = strtoupper($t['direction'])."(".$var_string.")"; |
| 102 | + $var_string = '?' . $t['value']; |
| 103 | + if ( isset( $t['direction'] ) ) $var_string = strtoupper( $t['direction'] ) . "(" . $var_string . ")"; |
104 | 104 | $string .= $var_string; |
105 | 105 | break; |
106 | 106 | case 'literal': |
107 | 107 | case 'literal1': |
108 | 108 | case 'literal2': |
109 | | - $string .= $this->term_to_string($t['type'], $t['value']); |
110 | | - if(isset($t['datatype'])) $string .= '^^'.$t['datatype']; |
111 | | - else if (isset($t['lang'])) $string .= '@'.$t['lang']; |
| 109 | + $string .= $this->term_to_string( $t['type'], $t['value'] ); |
| 110 | + if ( isset( $t['datatype'] ) ) $string .= '^^' . $t['datatype']; |
| 111 | + else if ( isset( $t['lang'] ) ) $string .= '@' . $t['lang']; |
112 | 112 | break; |
113 | 113 | case 'expression': |
114 | 114 | $expressions = array(); |
115 | | - foreach($t['patterns'] as $p) { $expressions[]=$this->sparql_info_to_string($p); |
| 115 | + foreach ( $t['patterns'] as $p ) { $expressions[] = $this->sparql_info_to_string( $p ); |
116 | 116 | } |
117 | | - switch($t['sub_type']){ |
| 117 | + switch( $t['sub_type'] ) { |
118 | 118 | case 'relational': |
119 | | - $string.= implode($t['operator'], $expressions); |
| 119 | + $string .= implode( $t['operator'], $expressions ); |
120 | 120 | break; |
121 | 121 | case 'and': |
122 | | - $string.= implode(' && ', $expressions); |
| 122 | + $string .= implode( ' && ', $expressions ); |
123 | 123 | break; |
124 | 124 | case 'or': |
125 | | - $string.= implode(' || ', $expressions); |
| 125 | + $string .= implode( ' || ', $expressions ); |
126 | 126 | break; |
127 | | - |
| 127 | + |
128 | 128 | default: |
129 | | - $string.= implode($t['sub_type'], $expressions); |
| 129 | + $string .= implode( $t['sub_type'], $expressions ); |
130 | 130 | break; |
131 | 131 | } |
132 | | - break; |
| 132 | + break; |
133 | 133 | } |
134 | | - |
| 134 | + |
135 | 135 | } |
136 | | - else if(is_array($t)){ |
137 | | - foreach($t as $item){ |
138 | | - $string.= $this->sparql_info_to_string($item); |
| 136 | + else if ( is_array( $t ) ) { |
| 137 | + foreach ( $t as $item ) { |
| 138 | + $string .= $this->sparql_info_to_string( $item ); |
139 | 139 | } |
140 | 140 | } |
141 | | - if(isset($t['order_infos'])){ |
142 | | - foreach($t['order_infos'] as $order){ |
143 | | - $string.= " ORDER BY ".$this->sparql_info_to_string($order); |
| 141 | + if ( isset( $t['order_infos'] ) ) { |
| 142 | + foreach ( $t['order_infos'] as $order ) { |
| 143 | + $string .= " ORDER BY " . $this->sparql_info_to_string( $order ); |
144 | 144 | } |
145 | 145 | } |
146 | | - if(isset($t['limit'])){ |
147 | | - $string .= ' LIMIT '.$t['limit']; |
| 146 | + if ( isset( $t['limit'] ) ) { |
| 147 | + $string .= ' LIMIT ' . $t['limit']; |
148 | 148 | } |
149 | | - if(isset($t['offset'])){ |
150 | | - $string .= ' OFFSET '.$t['offset']; |
| 149 | + if ( isset( $t['offset'] ) ) { |
| 150 | + $string .= ' OFFSET ' . $t['offset']; |
151 | 151 | } |
152 | | - |
| 152 | + |
153 | 153 | return $string; |
154 | 154 | } |
155 | | - |
156 | | - function triple_to_string($t){ |
| 155 | + |
| 156 | + function triple_to_string( $t ) { |
157 | 157 | $str = ''; |
158 | | - if(empty($t)) return ''; |
159 | | - foreach(array('s','p','o') as $term){ |
160 | | - $str.= ' '.$this->term_to_string($t[$term.'_type'], $t[$term]); |
| 158 | + if ( empty( $t ) ) return ''; |
| 159 | + foreach ( array( 's', 'p', 'o' ) as $term ) { |
| 160 | + $str .= ' ' . $this->term_to_string( $t[$term . '_type'], $t[$term] ); |
161 | 161 | } |
162 | | - return $str.' . '; |
| 162 | + return $str . ' . '; |
163 | 163 | } |
164 | | - |
165 | | - function term_to_string($type, $val){ |
166 | | - switch($type){ |
| 164 | + |
| 165 | + function term_to_string( $type, $val ) { |
| 166 | + switch( $type ) { |
167 | 167 | case 'var': |
168 | | - return '?'.$val; |
| 168 | + return '?' . $val; |
169 | 169 | case 'literal': |
170 | 170 | case 'literal1': |
171 | 171 | case 'literal2': |
172 | 172 | case 'literal_long1': |
173 | 173 | case 'literal_long2': |
174 | 174 | $quot = '"'; |
175 | | - if (preg_match('/\"/', $val)) { |
| 175 | + if ( preg_match( '/\"/', $val ) ) { |
176 | 176 | $quot = "'"; |
177 | | - if (preg_match('/\'/', $val)) { |
| 177 | + if ( preg_match( '/\'/', $val ) ) { |
178 | 178 | $quot = '"""'; |
179 | | - if (preg_match('/\"\"\"/', $val) || preg_match('/\"$/', $val) || preg_match('/^\"/', $val)) { |
| 179 | + if ( preg_match( '/\"\"\"/', $val ) || preg_match( '/\"$/', $val ) || preg_match( '/^\"/', $val ) ) { |
180 | 180 | $quot = "'''"; |
181 | | - $val = preg_replace("/'$/", "' ", $val); |
182 | | - $val = preg_replace("/^'/", " '", $val); |
183 | | - $val = str_replace("'''", '\\\'\\\'\\\'', $val); |
| 181 | + $val = preg_replace( "/'$/", "' ", $val ); |
| 182 | + $val = preg_replace( "/^'/", " '", $val ); |
| 183 | + $val = str_replace( "'''", '\\\'\\\'\\\'', $val ); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | | - if ((strlen($quot) == 1) && preg_match('/[\x0d\x0a]/', $val)) { |
| 187 | + if ( ( strlen( $quot ) == 1 ) && preg_match( '/[\x0d\x0a]/', $val ) ) { |
188 | 188 | $quot = $quot . $quot . $quot; |
189 | 189 | } |
190 | | - return $quot .$val. $quot ; |
| 190 | + return $quot . $val . $quot ; |
191 | 191 | case 'uri': |
192 | | - return '<'.$val.'>'; |
| 192 | + return '<' . $val . '>'; |
193 | 193 | case 'bnode': |
194 | 194 | default: |
195 | 195 | return $val; |
Index: trunk/extensions/RDFIO/README |
— | — | @@ -8,23 +8,23 @@ |
9 | 9 | |
10 | 10 | == Introduction == |
11 | 11 | |
12 | | -This extension extends the RDF import and export functionality in Semantic MediaWiki |
13 | | -by providing import of arbitrary RDF triples (not only OWL ontologies, as before |
14 | | -(see http://semantic-mediawiki.org/wiki/Help:Ontology_import), and a SPARQL endpoint |
| 12 | +This extension extends the RDF import and export functionality in Semantic MediaWiki |
| 13 | +by providing import of arbitrary RDF triples (not only OWL ontologies, as before |
| 14 | +(see http://semantic-mediawiki.org/wiki/Help:Ontology_import), and a SPARQL endpoint |
15 | 15 | that allows write operations. |
16 | 16 | |
17 | | -Technically, RDFIO implements the PHP/MySQL based triple store (and its accompanying |
18 | | -SPARQL Endpoint) provided by the [http://arc.semsol.org/ ARC2] library. For updating |
| 17 | +Technically, RDFIO implements the PHP/MySQL based triple store (and its accompanying |
| 18 | +SPARQL Endpoint) provided by the [http://arc.semsol.org/ ARC2] library. For updating |
19 | 19 | wiki pages with new triples on import/sparql update, the SMWWriter extension is used. |
20 | 20 | |
21 | | -The RDF import stores the original URI of all imported RDF entities (in a special |
22 | | -property), which can later be used by the SPARQL endpoint, instead of SMW's internal |
23 | | -URIs, which thus allows to expose the imported RDF data "in its original formats", |
24 | | -with its original URIs. This allows to use SMW as a collaborative RDF editor, in |
25 | | -workflows together with other semantic tools, from which it is then possible to |
| 21 | +The RDF import stores the original URI of all imported RDF entities (in a special |
| 22 | +property), which can later be used by the SPARQL endpoint, instead of SMW's internal |
| 23 | +URIs, which thus allows to expose the imported RDF data "in its original formats", |
| 24 | +with its original URIs. This allows to use SMW as a collaborative RDF editor, in |
| 25 | +workflows together with other semantic tools, from which it is then possible to |
26 | 26 | "export, collaboratively edit, and import again", to/from SMW. |
27 | 27 | |
28 | | -This extensions was developed as part of a Google Summer of Code 2010 project. The |
| 28 | +This extensions was developed as part of a Google Summer of Code 2010 project. The |
29 | 29 | project description can be found at http://www.mediawiki.org/wiki/User:SHL/GSoC2010 |
30 | 30 | |
31 | 31 | *Caution!* This extension is not yet ready for production use! Use it on your own risk! |
— | — | @@ -55,5 +55,3 @@ |
56 | 56 | Please reports bugs and feature requests at Bugzilla: |
57 | 57 | https://bugzilla.wikimedia.org/ |
58 | 58 | General feedback can be given at http://www.mediawiki.org/w/index.php?title=Extension_talk:RDFIO |
59 | | - |
60 | | - |
Property changes on: trunk/extensions/RDFIO/README |
___________________________________________________________________ |
Added: svn:eol-style |
61 | 59 | + native |
Index: trunk/extensions/RDFIO/classes/PageHandler.php |
— | — | @@ -53,13 +53,13 @@ |
54 | 54 | $propertyErrorText = $property->getErrorText(); |
55 | 55 | $propertyHasError = ( $propertyErrorText != '' ); |
56 | 56 | if ( $propertyHasError ) { |
57 | | - $this->addError( "<p>In RDFIOPageHandler::writeOrDeleteDataToWiki(): " . $property->getErrorText() . "</p>"); |
| 57 | + $this->addError( "<p>In RDFIOPageHandler::writeOrDeleteDataToWiki(): " . $property->getErrorText() . "</p>" ); |
58 | 58 | } |
59 | | - |
| 59 | + |
60 | 60 | $valueErrorText = $value->getErrorText(); |
61 | 61 | $valueHasError = ( $valueErrorText != '' ); |
62 | 62 | if ( $valueHasError ) { |
63 | | - $this->addError( "<p>Error creating property value object in RDFIOPageHandler::writeOrDeleteDataToWiki():</p><p>" . $value->getErrorText() . "</p>"); |
| 63 | + $this->addError( "<p>Error creating property value object in RDFIOPageHandler::writeOrDeleteDataToWiki():</p><p>" . $value->getErrorText() . "</p>" ); |
64 | 64 | } |
65 | 65 | if ( $delete ) { |
66 | 66 | $this->m_smwwriter_remove->addPropertyObjectValue( $property, $value ); |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | $editmessage = "Importing properties. Last property added: " . $propertystring . " : " . $valuestring; |
71 | 71 | } |
72 | 72 | } |
73 | | - |
| 73 | + |
74 | 74 | $this->m_smwwriter->update( $this->m_smwwriter_remove, $this->m_smwwriter_add, $editmessage ); |
75 | 75 | $smwWriterError = $this->m_smwwriter->getError(); |
76 | 76 | $smwWriterHasError = ( $smwWriterError != '' ); |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | $this->addError( "<p>SMWWriter Error: " . $smwWriterError . "</p>" ); |
79 | 79 | } |
80 | 80 | } |
81 | | - |
| 81 | + |
82 | 82 | /** |
83 | 83 | * Delete the data in the object variables from the wiki page |
84 | 84 | * corresponding to this page handler |
— | — | @@ -88,13 +88,13 @@ |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Wrapper method for wikiPageExistsSaveEditToken() |
92 | | - * TODO Is this really needed? |
| 92 | + * TODO Is this really needed? |
93 | 93 | */ |
94 | 94 | private function checkWikiPageExists() { |
95 | 95 | $this->m_wikipageexists = $this->wikiPageExistsSaveEditToken(); |
96 | 96 | return $this->m_wikipageexists; |
97 | 97 | } |
98 | | - |
| 98 | + |
99 | 99 | /** |
100 | 100 | * For a wiki page title, check if it exists (and at the same time, store an edit token), |
101 | 101 | * and if not, create it. |
— | — | @@ -113,15 +113,15 @@ |
114 | 114 | private function createWikiPage() { |
115 | 115 | // Prepare a 'fake' request to the MediaWiki API, which we use internally |
116 | 116 | // See http://www.mediawiki.org/wiki/API:Calling_internally for more info |
117 | | - $fauxEditRequest = new FauxRequest(array ( |
| 117 | + $fauxEditRequest = new FauxRequest( array ( |
118 | 118 | 'action' => 'edit', |
119 | | - 'title' => $this->m_wikititlefull, // For the faux request, the namespace must be included in text form |
| 119 | + 'title' => $this->m_wikititlefull, // For the faux request, the namespace must be included in text form |
120 | 120 | 'section' => '0', |
121 | 121 | 'summary' => 'New Page (by SMWRDFConnector)', |
122 | 122 | 'text' => '<!-- Empty page -->', |
123 | 123 | 'token' => $this->m_edittoken |
124 | | - )); |
125 | | - $editApi = new ApiMain($fauxEditRequest, $enableWrite = true); |
| 124 | + ) ); |
| 125 | + $editApi = new ApiMain( $fauxEditRequest, $enableWrite = true ); |
126 | 126 | $editApi->execute(); |
127 | 127 | $editApiOutput = & $editApi->getResultData(); // TODO: Take care of this |
128 | 128 | } |
— | — | @@ -132,16 +132,16 @@ |
133 | 133 | * @return boolean |
134 | 134 | */ |
135 | 135 | private function wikiPageExistsSaveEditToken() { |
136 | | - $fauxRequest = new FauxRequest(array ( |
| 136 | + $fauxRequest = new FauxRequest( array ( |
137 | 137 | 'action' => 'query', |
138 | 138 | 'prop' => 'info', |
139 | 139 | 'intoken' => 'edit', |
140 | 140 | 'titles' => $this->m_wikititlefull |
141 | | - )); |
| 141 | + ) ); |
142 | 142 | // We are using the MediaWiki API internally. |
143 | 143 | // See http://www.mediawiki.org/wiki/API:Calling_internally |
144 | 144 | // for more info |
145 | | - $api = new ApiMain($fauxRequest); |
| 145 | + $api = new ApiMain( $fauxRequest ); |
146 | 146 | $api->execute(); |
147 | 147 | $apioutput = & $api->getResultData(); // TODO: Take care of this |
148 | 148 | $apioutputpages = $apioutput['query']['pages']; |
— | — | @@ -150,13 +150,13 @@ |
151 | 151 | } |
152 | 152 | // Using intricacies of array structure to determine if page exists |
153 | 153 | // TODO: Use more robust method |
154 | | - $pageismissing = count($apioutput['query']['pages'][-1]) > 0; |
| 154 | + $pageismissing = count( $apioutput['query']['pages'][ -1] ) > 0; |
155 | 155 | return !$pageismissing; |
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Initialize SMWWriter for the page corresponding to title |
160 | | - * in object variable |
| 160 | + * in object variable |
161 | 161 | * @param boolean $delete |
162 | 162 | */ |
163 | 163 | private function initSMWWriter( $delete = false ) { |
— | — | @@ -180,17 +180,17 @@ |
181 | 181 | |
182 | 182 | private function addError( $errormessage ) { |
183 | 183 | $this->m_errors[] = $errormessage; |
184 | | - $this->m_haserrors = true; |
| 184 | + $this->m_haserrors = true; |
185 | 185 | } |
186 | | - |
| 186 | + |
187 | 187 | public function hasErrors() { |
188 | | - return $this->m_haserrors; |
| 188 | + return $this->m_haserrors; |
189 | 189 | } |
190 | | - |
| 190 | + |
191 | 191 | public function getErrors( ) { |
192 | 192 | return $this->m_errors; |
193 | 193 | } |
194 | | - |
| 194 | + |
195 | 195 | public function getErrorText() { |
196 | 196 | $errors = $this->m_errors; |
197 | 197 | $errortext = ''; |
— | — | @@ -199,6 +199,6 @@ |
200 | 200 | $errortext .= "$error\n"; |
201 | 201 | $i++; |
202 | 202 | } |
203 | | - return $errortext; |
| 203 | + return $errortext; |
204 | 204 | } |
205 | 205 | } |
Index: trunk/extensions/RDFIO/classes/Utils.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class RDFIOUtils { |
5 | | - |
6 | 5 | /** |
7 | 6 | * Checks if $uri is an URI Resolver URI (i.e. an URI used by SMW to identify wiki pages) |
8 | 7 | * @param string $uri |
— | — | @@ -11,7 +10,7 @@ |
12 | 11 | $isURIResolverURI = ( preg_match( '/Special:URIResolver/', $uri, $matches ) > 0 ); |
13 | 12 | return $isURIResolverURI; |
14 | 13 | } |
15 | | - |
| 14 | + |
16 | 15 | /** |
17 | 16 | * Checks if $uri is an ARC untitled identifier |
18 | 17 | * @param string $uri |
— | — | @@ -23,7 +22,7 @@ |
24 | 23 | $isArcUntitledNode = ( $isArcUntitledNode1 || $isArcUntitledNode2 ); |
25 | 24 | return $isArcUntitledNode; |
26 | 25 | } |
27 | | - |
| 26 | + |
28 | 27 | /** |
29 | 28 | * Checks if a string is a URL (i.e., starts with 'http:') |
30 | 29 | * @param $text |
— | — | @@ -33,7 +32,7 @@ |
34 | 33 | $isURL = ( preg_match( '/^http(s)?:/', $text, $matches ) > 0 ); |
35 | 34 | return $isURL; |
36 | 35 | } |
37 | | - |
| 36 | + |
38 | 37 | /** |
39 | 38 | * Extracts the "label", or "local part" of an URI, i.e. it removes |
40 | 39 | * its namespace, or base URI |
— | — | @@ -45,7 +44,7 @@ |
46 | 45 | $basepart = $uriparts[0]; |
47 | 46 | $localpart = $uriparts[1]; |
48 | 47 | if ( $localpart[1] != '' ) { |
49 | | - return $localpart; |
| 48 | + return $localpart; |
50 | 49 | } else { |
51 | 50 | return $basepart; |
52 | 51 | } |
— | — | @@ -53,7 +52,7 @@ |
54 | 53 | |
55 | 54 | /** |
56 | 55 | * Customized version of the splitURI($uri) of the ARC2 library (http://arc.semsol.org) |
57 | | - * Splits a URI into its base part and local part, and returns them as an |
| 56 | + * Splits a URI into its base part and local part, and returns them as an |
58 | 57 | * array of two strings |
59 | 58 | * @param string $uri |
60 | 59 | * @return array |
— | — | @@ -64,7 +63,7 @@ |
65 | 64 | * the following namespaces may lead to conflated URIs, |
66 | 65 | * we have to set the split position manually |
67 | 66 | */ |
68 | | - if (strpos($uri, 'www.w3.org')) { |
| 67 | + if ( strpos( $uri, 'www.w3.org' ) ) { |
69 | 68 | $specials = array( |
70 | 69 | 'http://www.w3.org/XML/1998/namespace', |
71 | 70 | 'http://www.w3.org/2005/Atom', |
— | — | @@ -73,33 +72,33 @@ |
74 | 73 | if ( $rdfiogBaseURIs != '' ) { |
75 | 74 | $specials = array_merge( $specials, $rdfiogBaseURIs ); |
76 | 75 | } |
77 | | - foreach ($specials as $ns) { |
78 | | - if (strpos($uri, $ns) === 0) { |
79 | | - $local_part = substr($uri, strlen($ns)); |
80 | | - if (!preg_match('/^[\/\#]/', $local_part)) { |
| 76 | + foreach ( $specials as $ns ) { |
| 77 | + if ( strpos( $uri, $ns ) === 0 ) { |
| 78 | + $local_part = substr( $uri, strlen( $ns ) ); |
| 79 | + if ( !preg_match( '/^[\/\#]/', $local_part ) ) { |
81 | 80 | return array( $ns, $local_part ); |
82 | 81 | } |
83 | 82 | } |
84 | 83 | } |
85 | 84 | } |
86 | 85 | /* auto-splitting on / or # */ |
87 | | - //$re = '^(.*?)([A-Z_a-z][-A-Z_a-z0-9.]*)$'; |
88 | | - if (preg_match('/^(.*[\#])([^\#]+)$/', $uri, $matches)) { |
89 | | - return array($matches[1], $matches[2]); |
| 86 | + // $re = '^(.*?)([A-Z_a-z][-A-Z_a-z0-9.]*)$'; |
| 87 | + if ( preg_match( '/^(.*[\#])([^\#]+)$/', $uri, $matches ) ) { |
| 88 | + return array( $matches[1], $matches[2] ); |
90 | 89 | } |
91 | | - if (preg_match('/^(.*[\:])([^\:\/]+)$/', $uri, $matches)) { |
92 | | - return array($matches[1], $matches[2]); |
| 90 | + if ( preg_match( '/^(.*[\:])([^\:\/]+)$/', $uri, $matches ) ) { |
| 91 | + return array( $matches[1], $matches[2] ); |
93 | 92 | } |
94 | | - if (preg_match('/^(.*[\/])([^\/]+)$/', $uri, $matches)) { |
95 | | - return array($matches[1], $matches[2]); |
| 93 | + if ( preg_match( '/^(.*[\/])([^\/]+)$/', $uri, $matches ) ) { |
| 94 | + return array( $matches[1], $matches[2] ); |
96 | 95 | } /* auto-splitting on last special char, e.g. urn:foo:bar */ |
97 | | - return array($uri, ''); |
| 96 | + return array( $uri, '' ); |
98 | 97 | |
99 | 98 | } |
100 | | - |
| 99 | + |
101 | 100 | static function contains( $word, $subject ) { |
102 | 101 | $contains = preg_match( "/$word/i", $subject ) > 0; |
103 | | - return $contains; |
| 102 | + return $contains; |
104 | 103 | } |
105 | 104 | |
106 | 105 | /** |
— | — | @@ -112,7 +111,7 @@ |
113 | 112 | print_r( $arrayToShow ); |
114 | 113 | echo "</pre>"; |
115 | 114 | } |
116 | | - |
| 115 | + |
117 | 116 | static function showErrorMessage( $title, $message ) { |
118 | 117 | global $wgOut; |
119 | 118 | $errorhtml = RDFIOUtils::formatErrorHTML( $title, $message ); |
— | — | @@ -146,7 +145,7 @@ |
147 | 146 | // Convert any table to sortable wiki table |
148 | 147 | return $html; |
149 | 148 | } |
150 | | - |
| 149 | + |
151 | 150 | /** |
152 | 151 | * Add css class attributes which make tables styled and sortable inside the wiki |
153 | 152 | * @param string $html |
— | — | @@ -169,7 +168,7 @@ |
170 | 169 | } |
171 | 170 | |
172 | 171 | /** |
173 | | - * Convert to character identifiers used to make URLs XML compliant |
| 172 | + * Convert to character identifiers used to make URLs XML compliant |
174 | 173 | * @param string $text |
175 | 174 | * @return string $text |
176 | 175 | */ |
— | — | @@ -180,9 +179,9 @@ |
181 | 180 | $text = str_replace( ' ', '-20', $text ); |
182 | 181 | return $text; |
183 | 182 | } |
184 | | - |
| 183 | + |
185 | 184 | /** |
186 | | - * Convert back character identifiers used to make URLs XML compliant |
| 185 | + * Convert back character identifiers used to make URLs XML compliant |
187 | 186 | * @param string $text |
188 | 187 | * @return string $text |
189 | 188 | */ |
— | — | @@ -190,12 +189,12 @@ |
191 | 190 | $text = str_replace( '-23', '#', $text ); |
192 | 191 | $text = str_replace( '-3A', ':', $text ); |
193 | 192 | $text = str_replace( '-3F', '?', $text ); |
194 | | - $text = str_replace( '-2D', '-', $text ); |
| 193 | + $text = str_replace( '-2D', '-', $text ); |
195 | 194 | $text = str_replace( '-20', ' ', $text ); |
196 | 195 | $text = str_replace( '-3D', '=', $text ); |
197 | 196 | return $text; |
198 | 197 | } |
199 | | - |
| 198 | + |
200 | 199 | /** |
201 | 200 | * @param string $text |
202 | 201 | * @return string $text |
— | — | @@ -216,7 +215,7 @@ |
217 | 216 | $text = str_replace( '-20', '_', $text ); |
218 | 217 | return $text; |
219 | 218 | } |
220 | | - |
| 219 | + |
221 | 220 | /** |
222 | 221 | * Remove characters which don't work in wiki titles |
223 | 222 | * @param string $uri |
— | — | @@ -246,5 +245,4 @@ |
247 | 246 | $value = str_replace( ']', '', $value ); |
248 | 247 | return $value; |
249 | 248 | } |
250 | | - |
251 | 249 | } |
Index: trunk/extensions/RDFIO/classes/SMWBatchWriter.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | $rdfiogPropertiesToUseAsWikiTitle, |
33 | 33 | $rdfiogUseNSPrefixInWikiTitleForProperties, |
34 | 34 | $rdfiogUseNSPrefixInWikiTitleForEntities; |
35 | | - |
| 35 | + |
36 | 36 | if ( $dataformat == 'triples_array' ) { |
37 | 37 | $this->m_triples = $importdata; |
38 | 38 | } else { |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | $this->m_parser = ARC2::getRDFXMLParser(); |
47 | 47 | $this->parse(); |
48 | 48 | } else if ( $this->m_dataformat == 'turtle' ) { |
49 | | - $this->m_unparseddata = $wgRequest->getText('importdata'); |
| 49 | + $this->m_unparseddata = $wgRequest->getText( 'importdata' ); |
50 | 50 | $this->m_parser = ARC2::getTurtleParser(); |
51 | 51 | $this->parse(); |
52 | 52 | } |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | | - * Check for namespaces lacking a prefix ("abbreviation"), in the |
| 102 | + * Check for namespaces lacking a prefix ("abbreviation"), in the |
103 | 103 | * current namespace prefix configuration |
104 | 104 | */ |
105 | 105 | public function checkForNamespacesWithoutPrefix() { |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | $entityuris = array_merge( $subjecturis, $valueuris ); |
135 | 135 | $entityuris = array_unique( $entityuris ); |
136 | 136 | $unabbreviateduris = array(); |
137 | | - foreach( $entityuris as $entityuri ) { |
| 137 | + foreach ( $entityuris as $entityuri ) { |
138 | 138 | $titlebypropertyuriindex = ''; |
139 | 139 | $titlebypropertyuriindex = $this->getWikiTitleByPropertyURIIndex( $entityuri ); |
140 | 140 | if ( $titlebypropertyuriindex == '' ) { |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | // The page below should not be deleted on delete operations |
195 | 195 | if ( !$this->m_delete ) { |
196 | 196 | // Add type info to the Original URI property |
197 | | - $property_hastypeurl = array( array( 'p' => 'Has type', 'v' => 'URL') ); |
| 197 | + $property_hastypeurl = array( array( 'p' => 'Has type', 'v' => 'URL' ) ); |
198 | 198 | $origuripage = new RDFIOPageHandler( 'Original URI', SMW_NS_PROPERTY, $property_hastypeurl ); |
199 | 199 | $this->addToPages( $origuripage ); |
200 | 200 | } |
— | — | @@ -282,7 +282,7 @@ |
283 | 283 | $page->writeOrDeleteDataToWiki(); |
284 | 284 | if ( $page->hasErrors() ) { |
285 | 285 | $errortitle = "Error for wikipage \"" . $page->getWikiTitleFull() . "\"</h3>"; |
286 | | - $wgOut->addHTML( RDFIOUtils::formatErrorHTML( $errortitle, $page->getErrorText() )); |
| 286 | + $wgOut->addHTML( RDFIOUtils::formatErrorHTML( $errortitle, $page->getErrorText() ) ); |
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
— | — | @@ -298,7 +298,7 @@ |
299 | 299 | $page->deleteDataFromWiki(); |
300 | 300 | if ( $page->hasErrors() ) { |
301 | 301 | $errortitle = "Error for wikipage \"" . $page->getWikiTitleFull() . "\"</h3>"; |
302 | | - $wgOut->addHTML( RDFIOUtils::formatErrorHTML( $errortitle, $page->getErrorText() )); |
| 302 | + $wgOut->addHTML( RDFIOUtils::formatErrorHTML( $errortitle, $page->getErrorText() ) ); |
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
— | — | @@ -333,7 +333,7 @@ |
334 | 334 | * @return array $triples |
335 | 335 | */ |
336 | 336 | function getTriplesForSubject( $subjecturi ) { |
337 | | - $reconstructedIndex = array( $subjecturi => $this->m_tripleindex[$subjecturi]); |
| 337 | + $reconstructedIndex = array( $subjecturi => $this->m_tripleindex[$subjecturi] ); |
338 | 338 | $triples = ARC2::getTriplesFromIndex( $reconstructedIndex ); |
339 | 339 | return $triples; |
340 | 340 | } |
— | — | @@ -354,11 +354,11 @@ |
355 | 355 | function getUniquePropertyURIs() { |
356 | 356 | $tripleindex = $this->m_tripleindex; |
357 | 357 | $properties = array(); |
358 | | - foreach( $tripleindex as $cur_props ) { |
359 | | - foreach( $cur_props as $cur_prop => $cur_propdata ) { |
| 358 | + foreach ( $tripleindex as $cur_props ) { |
| 359 | + foreach ( $cur_props as $cur_prop => $cur_propdata ) { |
360 | 360 | $properties[$cur_prop] = array( |
361 | | - 'type' => $cur_propdata[0]['type'], |
362 | | - 'datatype' => $cur_propdata[0]['datatype'] |
| 361 | + 'type' => $cur_propdata[0]['type'], |
| 362 | + 'datatype' => $cur_propdata[0]['datatype'] |
363 | 363 | ); // Only the type info is interesting here |
364 | 364 | } |
365 | 365 | } |
— | — | @@ -372,16 +372,16 @@ |
373 | 373 | function getUniqueValueURIs() { |
374 | 374 | $tripleindex = $this->m_tripleindex; |
375 | 375 | $value_uris_data = array(); |
376 | | - foreach( $tripleindex as $cur_props ) { |
377 | | - foreach( $cur_props as $cur_prop => $cur_propdatas ) { |
| 376 | + foreach ( $tripleindex as $cur_props ) { |
| 377 | + foreach ( $cur_props as $cur_prop => $cur_propdatas ) { |
378 | 378 | foreach ( $cur_propdatas as $cur_propdata ) { |
379 | 379 | $value = $cur_propdata['value']; |
380 | 380 | $valuetype = $cur_propdata['type']; |
381 | 381 | $valuedatatype = $cur_propdata['datatype']; |
382 | 382 | if ( $valuetype == 'uri' ) { |
383 | 383 | $value_uris_data[$value] = array( |
384 | | - 'type' => $valuetype, |
385 | | - 'datatype' => $valuedatatype |
| 384 | + 'type' => $valuetype, |
| 385 | + 'datatype' => $valuedatatype |
386 | 386 | ); |
387 | 387 | } |
388 | 388 | } |
— | — | @@ -392,15 +392,15 @@ |
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
396 | | - * Create a property array with "Original URI" as property, |
397 | | - * and $uri as subject |
| 396 | + * Create a property array with "Original URI" as property, |
| 397 | + * and $uri as subject |
398 | 398 | * @param string $uri |
399 | 399 | * @return array $origuripropertyarray |
400 | 400 | */ |
401 | 401 | function createOrigURIPropertyArray( $uri ) { |
402 | 402 | $origuripropertyarray = array( |
403 | | - 'p' => 'Original URI', |
404 | | - 'v' => $uri ); |
| 403 | + 'p' => 'Original URI', |
| 404 | + 'v' => $uri ); |
405 | 405 | return $origuripropertyarray; |
406 | 406 | } |
407 | 407 | |
— | — | @@ -412,8 +412,8 @@ |
413 | 413 | */ |
414 | 414 | function createEquivURIPropertyArray( $uri ) { |
415 | 415 | $equivuripropertyarray = array( |
416 | | - 'p' => 'Equivalent URI', |
417 | | - 'v' => $uri ); |
| 416 | + 'p' => 'Equivalent URI', |
| 417 | + 'v' => $uri ); |
418 | 418 | return $equivuripropertyarray; |
419 | 419 | } |
420 | 420 | |
— | — | @@ -434,7 +434,7 @@ |
435 | 435 | return 'String'; |
436 | 436 | } |
437 | 437 | } else { |
438 | | - $this->addError('Unknown entity type in SMWBatchWriter.php:convertARCTypeToSMWType'); |
| 438 | + $this->addError( 'Unknown entity type in SMWBatchWriter.php:convertARCTypeToSMWType' ); |
439 | 439 | } |
440 | 440 | // TODO: Expand with more options |
441 | 441 | } |
— | — | @@ -485,7 +485,6 @@ |
486 | 486 | return $this->m_haserrors; |
487 | 487 | } |
488 | 488 | |
489 | | - |
490 | 489 | /** |
491 | 490 | * Get an array with current errors |
492 | 491 | * @return array |
— | — | @@ -510,7 +509,7 @@ |
511 | 510 | } |
512 | 511 | |
513 | 512 | |
514 | | - ///////////// PREVIOUSLY THE EQUIV URI CLASS ////////////////////// |
| 513 | + //////////// / PREVIOUSLY THE EQUIV URI CLASS ////////////////////// |
515 | 514 | |
516 | 515 | |
517 | 516 | /** |
— | — | @@ -549,7 +548,7 @@ |
550 | 549 | if ( $titlebypropertyuriindex != '' ) { |
551 | 550 | $wikititle = $titlebypropertyuriindex; |
552 | 551 | } else if ( ( $this->m_usenspintitles_entities && !$isproperty ) || |
553 | | - ( $this->m_usenspintitles_properties && $isproperty ) ){ |
| 552 | + ( $this->m_usenspintitles_properties && $isproperty ) ) { |
554 | 553 | $wikititle = $this->abbreviateNSFromURI( $uri ); |
555 | 554 | } else { |
556 | 555 | $wikititle = RDFIOUtils::extractLabelFromURI( $uri ); |
— | — | @@ -633,15 +632,15 @@ |
634 | 633 | |
635 | 634 | if ( $localpart == '' ) { |
636 | 635 | $uri = $basepart; |
637 | | - } else if ( substr($basepart, 0, 1) == '_' ) { |
| 636 | + } else if ( substr( $basepart, 0, 1 ) == '_' ) { |
638 | 637 | // Change ARC:s default "random string", to indicate more clearly that |
639 | 638 | // it lacks title |
640 | | - $uri = str_replace('arc','untitled',$localpart); |
641 | | - } else if ( substr($basepart, 0, 7) == 'http://' ) { |
| 639 | + $uri = str_replace( 'arc', 'untitled', $localpart ); |
| 640 | + } else if ( substr( $basepart, 0, 7 ) == 'http://' ) { |
642 | 641 | // If the abbreviation does not seem to have succeeded, |
643 | 642 | // fall back to use only the local part |
644 | 643 | $uri = $localpart; |
645 | | - } else if ( substr($basepart, -1) == ':' ) { |
| 644 | + } else if ( substr( $basepart, -1 ) == ':' ) { |
646 | 645 | // Don't add another colon |
647 | 646 | $uri = $basepart . $localpart; |
648 | 647 | } else if ( $basepart == false || $basepart == '' ) { |
— | — | @@ -665,17 +664,17 @@ |
666 | 665 | |
667 | 666 | if ( $localpart == '' ) { |
668 | 667 | $uri = $basepart; |
669 | | - } else if ( substr($basepart, 0, 1) == '_' ) { |
| 668 | + } else if ( substr( $basepart, 0, 1 ) == '_' ) { |
670 | 669 | // Change ARC:s default "random string", to indicate more clearly that |
671 | 670 | // it lacks title |
672 | | - $uri = str_replace('arc','untitled',$localpart); |
| 671 | + $uri = str_replace( 'arc', 'untitled', $localpart ); |
673 | 672 | } else { |
674 | | - $basepart = $this->getPrefixForNS($basepart); |
675 | | - if ( substr($basepart, 0, 7) == 'http://' ) { |
| 673 | + $basepart = $this->getPrefixForNS( $basepart ); |
| 674 | + if ( substr( $basepart, 0, 7 ) == 'http://' ) { |
676 | 675 | // If the abbreviation does not seem to have succeeded, |
677 | 676 | // fall back to use only the local part |
678 | 677 | $uri = $localpart; |
679 | | - } else if ( substr($basepart, -1) == ':' ) { |
| 678 | + } else if ( substr( $basepart, -1 ) == ':' ) { |
680 | 679 | // Don't add another colon |
681 | 680 | $uri = $basepart . $localpart; |
682 | 681 | } else { |
Index: trunk/extensions/RDFIO/classes/RDFStore.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * RDFIOStore contains utility functionality that requires connecting to the |
| 5 | + * RDFIOStore contains utility functionality that requires connecting to the |
6 | 6 | * ARC based RDF store |
7 | 7 | * @author samuel.lampa@gmail.com |
8 | 8 | * @package RDFIO |
— | — | @@ -21,18 +21,18 @@ |
22 | 22 | function getOrigURIURI() { |
23 | 23 | return $this->getURIResolverURI() . 'Property-3AOriginal_URI'; |
24 | 24 | } |
25 | | - |
| 25 | + |
26 | 26 | /** |
27 | | - * Get SMWs internal URI for corresponding to the "Equivalent URI" property |
| 27 | + * Get SMWs internal URI for corresponding to the "Equivalent URI" property |
28 | 28 | * @return string |
29 | 29 | */ |
30 | 30 | function getEquivURIURI() { |
31 | 31 | return 'http://www.w3.org/2002/07/owl#sameAs'; |
32 | 32 | } |
33 | | - |
| 33 | + |
34 | 34 | /** |
35 | 35 | * Get SMWs internal URI for corresponding to the "Equivalent URI" property, |
36 | | - * for property pages |
| 36 | + * for property pages |
37 | 37 | * @return string |
38 | 38 | */ |
39 | 39 | function getEquivURIURIForProperty() { |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | | - * For a given RDF URI, return it's original URI, as defined in wiki articles |
| 44 | + * For a given RDF URI, return it's original URI, as defined in wiki articles |
45 | 45 | * by the "Original URI" property |
46 | 46 | * @param string $uri |
47 | 47 | * @return string $origuri |
— | — | @@ -50,8 +50,8 @@ |
51 | 51 | $store = $this->m_arcstore; |
52 | 52 | $origuriuri = $this->getOrigURIURI(); |
53 | 53 | $q = "SELECT ?origuri WHERE { <$uri> <$origuriuri> ?origuri }"; |
54 | | - $rs = $store->query($q); |
55 | | - if (!$store->getErrors()) { |
| 54 | + $rs = $store->query( $q ); |
| 55 | + if ( !$store->getErrors() ) { |
56 | 56 | $rows = $rs['result']['rows']; |
57 | 57 | $row = $rows[0]; |
58 | 58 | $origuri = $row['origuri']; |
— | — | @@ -60,9 +60,9 @@ |
61 | 61 | } |
62 | 62 | return $origuri; |
63 | 63 | } |
64 | | - |
| 64 | + |
65 | 65 | /** |
66 | | - * For a given RDF URI, return it's corresponding equivalend URIs |
| 66 | + * For a given RDF URI, return it's corresponding equivalend URIs |
67 | 67 | * as defined in wiki articles by the Equivalent URI property |
68 | 68 | * @param string $uri |
69 | 69 | * @param boolean $is_property |
— | — | @@ -77,18 +77,18 @@ |
78 | 78 | $equivuriuri = $this->getEquivURIURI(); |
79 | 79 | } |
80 | 80 | $q = "SELECT ?equivuri WHERE { <$uri> <$equivuriuri> ?equivuri }"; |
81 | | - $rs = $store->query($q); |
82 | | - if (!$store->getErrors()) { |
| 81 | + $rs = $store->query( $q ); |
| 82 | + if ( !$store->getErrors() ) { |
83 | 83 | $equivuris = $rs['result']['rows']; |
84 | 84 | foreach ( $equivuris as $equivuriid => $equivuri ) { |
85 | | - $equivuris[$equivuriid] = $equivuri['equivuri']; |
86 | | - } |
| 85 | + $equivuris[$equivuriid] = $equivuri['equivuri']; |
| 86 | + } |
87 | 87 | } else { |
88 | 88 | die( "Error in ARC Store: " . print_r( $store->getErrors(), true ) ); |
89 | 89 | } |
90 | 90 | return $equivuris; |
91 | 91 | } |
92 | | - |
| 92 | + |
93 | 93 | /** |
94 | 94 | * @param string $ouri |
95 | 95 | * @return string $uri |
— | — | @@ -98,8 +98,8 @@ |
99 | 99 | $store = $this->m_arcstore; |
100 | 100 | $origuriuri = $this->getOrigURIURI(); |
101 | 101 | $q = "SELECT ?uri WHERE { ?uri <$origuriuri> <$origuri> }"; |
102 | | - $rs = $store->query($q); |
103 | | - if (!$store->getErrors()) { |
| 102 | + $rs = $store->query( $q ); |
| 103 | + if ( !$store->getErrors() ) { |
104 | 104 | if ( $rs !== '' ) { |
105 | 105 | $rows = $rs['result']['rows']; |
106 | 106 | $row = $rows[0]; |
— | — | @@ -121,8 +121,8 @@ |
122 | 122 | $store = $this->m_arcstore; |
123 | 123 | $equivuriuri = $this->getEquivURIURI(); |
124 | 124 | $q = "SELECT ?uri WHERE { ?uri <$equivuriuri> <$equivuri> }"; |
125 | | - $rs = $store->query($q); |
126 | | - if (!$store->getErrors()) { |
| 125 | + $rs = $store->query( $q ); |
| 126 | + if ( !$store->getErrors() ) { |
127 | 127 | $rows = $rs['result']['rows']; |
128 | 128 | $row = $rows[0]; |
129 | 129 | $uri = $row['uri']; |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | $uriresolveruri = $resolver->getFullURL() . '/'; |
143 | 143 | return $uriresolveruri; |
144 | 144 | } |
145 | | - |
| 145 | + |
146 | 146 | /** |
147 | 147 | * For a URI that is defined using the "Original URI" property, return the wiki |
148 | 148 | * article corresponding to that entity |
— | — | @@ -149,7 +149,7 @@ |
150 | 150 | * @return string $wikititle; |
151 | 151 | */ |
152 | 152 | function getWikiTitleByOriginalURI( $uri ) { |
153 | | - $wikititleresolveruri = $this->getURIForOrigURI( $uri ); |
| 153 | + $wikititleresolveruri = $this->getURIForOrigURI( $uri ); |
154 | 154 | $resolveruri = $this->getURIResolverURI(); |
155 | 155 | $wikititle = str_replace( $resolveruri, '', $wikititleresolveruri ); |
156 | 156 | $wikititle = str_replace( 'Property-3A', '', $wikititle ); |