NQUADS -> TRIG … A Noddy Perl Script
I keep coming across nquads files, and libraptor doesn’t support this serialisation, it only supports quad-based TriG format. I knocked together a dirty perl file which will parse a nquads file to TriG if ever need be.
You can find the perl file on my site :
https://mmt.me.uk/blog/examples/perl/nquads_to_trig.pl
`
#!/usr/bin/perl
use strict;</p>
my $files = scalar(@ARGV);
if ($files != 1) {
print "NQuads importer. ./nquads_importer nquads_file\n";
exit();
}
my $input_filename = @ARGV[0];
open (INPUT,$input_filename) || die { print "Input file does not exist\n"};
open (OUTPUT,">$input_filename.trig") || die { print "Failed to open output file\n"};
my $line = "";
my $model_uri = "";
my $triple = "";
my $count = 0;
my %quads = ();
while () {
$line = $_;
if ($line =~ m/^(.*?)(<[^>]+>?)\s*\.$/) {
$model_uri = $2;
$triple = $1.".\n";
$quads{$model_uri} .= $triple;
} else {
print ERROR "boo this nquad doesn't pass regex\n$line\n*************\n";
}
$count++;
}
foreach my $forth (keys %quads) {
print OUTPUT "$forth { ".$quads{$forth}." }\n";
}
print "Finished\n";
close(INPUT);
close(OUTPUT);
# vi:set ts=8 sts=4 sw=4 et:
`
Facebook and their Horrible “OPT-OUT” Policy
So Facebook announced their new Facebook Places functionality a couple of days ago, the service seems well implemented, and following the uptake of 4square, probably a timely service for fb – good luck to them.
What I am most disappointed about (rant) is the way that Facebook, seem to think that an **“OPT-OUT” policy is the right way to go about landing new functionality on their users. By default, Facebook allows your friends to log your geolocation at given point in time. And this is simply NOT ACCEPTABLE. As far as I am aware (and please do let me know if I am wrong), none of the other popular geo-logging services allow for other people to log your location at a given point in time. I see this as a massive invasion of your privacy, and as have others, as discussed in the following CNET article:
Shots already fired over Facebook Places privacy
An OPT-OUT policy to services which compromise your privacy and your personal information is simply NOT acceptable, and DRACONIAN. I mean, Facebook, DID NOT even attempt to inform me, that friends of mine can can geolog my location at any given point in time. I mean, what is stopping a friend of mine, who is hanging out in a brothel from geologging me, and defaming my character, by suggesting that I too was at the same place as him.
I noticed this yesterday, and then I got round to tweeting it, and had a lot of people thanking me for informing them of this change of service. So, I thought I would expand what is going on in a bit more detail. If you would like a more verbose write up on how to disable this new “feature”, visit the Garlik blog article:
Garlik Blog: Disabling Facebook Places.
As far as I am aware there has been no recent changes to Facebook’s privacy policy or their terms of service as illustrated on the awesome Terms of Service Tracking site. From my point of view, Facebook should inform their users about new functionality, especially new functionality which by definition shares your geolocation information both with people within Facebook, and with the Skyhook geolocation gazetteer.
The joys of upgrading to PHP 5.3
I have been bitten by a number of things when I updated my PHP to PHP 5.3. These are the changes which I had to make to my php.ini file :
<br />
short_open_tag = 1<br />
This option allows for the use of the short hand "<?"
and "?>"
used as abbreviations for "<?php"
and "php?>"
. And yes, shorts hand are good, I am super lazy, insofar as I am not good at setting “use strict;” when writing perl code.
Secondly, I was stung due to the fact that PHP 5.3 has clamped down on the returning of values when expecting a reference to be returned by a function, this phenomena and the necessary fix is illustrated in my previous blog post.