« September 2010 | Main | December 2010 »

October 27, 2010

SPARQL Toot

SPARQL Tutorial | AllegroGraph 4.1

Posted by pj at 12:56 PM | Comments (0)

October 26, 2010

PHP script to run SPARQL queries against a 4store triple store

<?php

error_reporting(E_ERROR | E_PARSE);

require_once "HTTP/Request.php";

if($_GET['format']){

	header('Content-type: text/plain');

	} else { 

	header('Content-type: text/xml');

	}

$sparql = sprintf("PREFIX rss: <http://purl.org/rss/1.0/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dubco: <http://purl.org/dc/elements/1.1/>
PREFIX ev: <http://purl.org/rss/1.0/modules/event/>

select * { 
        ?item rss:title ?title . 
        ?item rss:link ?link . 
        ?item dc:date ?date .
        ?item dubco:description ?description .
	?item ev:location ?location .
        FILTER regex(str(?title), \"%s?\", 'i') . 
        } ORDER BY ?title", $_GET['query']);

$req = &new HTTP_Request('http://172.20.36.113:8080/sparql/'); 

if($_GET['format']){ $req->addHeader("Accept", "application/".$_GET['format']); }

$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->addPostData("query", $sparql);
$req->sendRequest();

$response = $req->getResponseBody();

print $response;

print '<!--'.$sparql.'-->';

?>

Posted by pj at 03:46 PM | Comments (0)

October 25, 2010

XSLT Date and Time Processing Examples

Date and time processing

Posted by pj at 12:40 PM | Comments (0)

October 23, 2010

Keep it quiet

Bicycle Bike Noises, Clicks, Ticks, Creaks, Clunks, Knocks And Repair by Jim Langley

Posted by pj at 12:49 PM | Comments (0)

October 18, 2010

Checking PHP form array has a value

function valet(els){

	if(validate(els)){
	
		var checks = document.getElementsByName('category[]');
	
		for (i = 0; i < checks.length; i++){ 
		
			if(checks[i].checked == true){ return true; } 

			}

		poppy('You need to choose at least one Region or Sector.'); return false; 
	
		}

	return false;

	}

Posted by pj at 01:11 PM | Comments (0)