Skip to content

Instantly share code, notes, and snippets.

@jctoledo
jctoledo / gist:6581779
Last active December 23, 2015 04:39
Get a list of FTP files given a path and an extension
<?php
$list = getFtpFileList('ftp.ebi.ac.uk','/pub/databases/chembl/ChEMBL-RDF/16.0/', 'ttl.gz');
$total = count($list);
print_r($list);
/**
* Given an FTP uri get a non recursive list of all files of a given extension
* located inside a given path
*/
@jctoledo
jctoledo / gist:6426686
Created September 3, 2013 17:09
PDB FTP RSYNC mirroring script
#!/bin/sh
############################################################################
#
# Script for mirroring PDB FTP archive using rsync
#
############################################################################
# This script is being provided to PDB users as a template for using rsync
# to mirror the FTP archive from an anonymous rsync server. You may want
@jctoledo
jctoledo / gist:6054161
Created July 22, 2013 14:18
Using Limit and offset in a SPARQL query with PHP
<?php
$myQuery = "select * where{?x ?y ?z}";
$result = getFromEndpoint(urlencode($myQuery), 10, 10);
if($result != null){
print_r($result);
}
@jctoledo
jctoledo / gist:5938249
Created July 6, 2013 01:35
Editing virtuoso.ini such that it can read files anywhere in your filesystem
#Modify line 66 of virtuoso.ini from
DirsAllowed = ., /usr/local/virtuoso-opensource/share/virtuoso/vad
#to the following
DirsAllowed = ., /usr/local/virtuoso-opensource/share/virtuoso/vad, /
@jctoledo
jctoledo / instances.tab
Last active December 19, 2015 10:09
Sample instances.tab file used by https://github.com/micheldumontier/php-lib/blob/master/apps/manager.php This is a tab delimited file where its columns are: isql port, http port and desired instance name
#this is a comment
#isql-port http-port name
12001 12002 myFirstEndpoint
12003 12004 mySecondEndpoint
@jctoledo
jctoledo / gist:5937718
Created July 5, 2013 22:49
Adding VOS to your user's path
# open ~/.bashrc with your favourite text editor and add the following line at the end of the file
export PATH=$PATH:/usr/local/virtuoso-opensource/bin
@jctoledo
jctoledo / gist:5931267
Last active December 19, 2015 09:09
VOS 6.1.6 set compiler class before running ./configure
# for 64-bit
~ $ export CFLAGS="-O2 -m64"
# for 32-bit
~ $ export CFLAGS="-O2"
@jctoledo
jctoledo / gist:5931241
Last active December 19, 2015 09:09
Build VOS 6.1.6 from source in Ubuntu 13.04
sudo apt-get install dpkg-dev build-essential gawk automake autoconf libtool bison flex gperf libssl-dev
// For testing reasons one can add a X509TrustManager to a HttpClient to avoid the SSLPeerUnverifiedException
// References:
// http://javaskeleton.blogspot.com/2010/07/avoiding-peer-not-authenticated-with.html
// http://en.wikibooks.org/wiki/Programming:WebObjects/Web_Services/How_to_Trust_Any_SSL_Certificate
// Made some customizations to these guides. Works with Java 7 (no NullPointerException when calling init() of SSLContext) and does not use any deprecated functions of HttpClient, SSLContext...
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
@jctoledo
jctoledo / Q9
Last active December 19, 2015 01:59
Q9: retrieve orthologous human and mouse genes annotated with function to bind ATP
SPARQL-DL : Type(?human_gene, 'gene'), Type(?mouse_gene, 'gene'), Type(?homologene_group, HomoloGene_Group), PropertyValue(?human_gene, has_taxid, 'Homo sapiens'), PropertyValue(?mouse_gene, has_taxid, 'Mus musculus'), PropertyValue(?human_gene,'has function', 'ATP binding'), PropertyValue(?mouse_gene, 'has function', 'ATP binding'), PropertyValue(?homologene_group, has_gene, ?human_gene), PropertyValue(?homologene_group, has_gene, ?mouse_gene)
# gene : http://semanticscience.org/resource/SIO_010035
# HomoloGene_Group : http://bio2rdf.org/homologene_vocabulary:HomoloGene_Group
# has_taxid : http://bio2rdf.org/geneid_vocabulary:has_taxid
# 'Homo sapiens' : http://bio2rdf.org/taxon:9606
# 'Mus musculus' : http://bio2rdf.org/taxon:10090
# 'has function' : http://semanticscience.org/resource/SIO_000225
# 'ATP binding' : http://bio2rdf.org/go:0005524
# has_gene : http://bio2rdf.org/homologene_vocabulary:has_gene