Skip to content

Instantly share code, notes, and snippets.

View Mec-iS's full-sized avatar

Lorenzo Mec-iS

View GitHub Profile
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
{
"_id" : ObjectId("542dfd62d61fce6881caed5e"),
"http://www_w3_org/2004/02/skos/core#closeMatch" : [
{
"@id" : "http://dbpedia.org/data/Asteroid.jsond",
"_id" : ObjectId("542dfd62d61fce6881caed5d"),
"@type" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"
}
],
"http://schema_org/provider" : {
@Mec-iS
Mec-iS / rdflib-3-3.py
Created September 26, 2014 15:06
RDFlib example
##############################################################################################
# Py3.3 script to navigate DBpedia URIs
# install latest RDFlib with 'pip install rdflib'
# https://github.com/RDFLib/rdflib/
##############################################################################################
from rdflib import Graph, term
from rdflib.namespace import SKOS
@Mec-iS
Mec-iS / definitions_astronomy.xml
Created September 12, 2014 09:59
example for an RDF-XML representation of the NASA-STI categories
<?xml version="1.0"?>
<!-- Definition of Category Astronomy -->
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#">
<skos:Concept rdf:about="http://mydomain.com/astronomy">
Three examples of RDF-SKOS definitions taken from http://www.sti.nasa.gov/sscg/main.html
1.TURTLE LANGUAGE, a keyword, a category and a division taken from NASA-STI:
Common prefixes:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
File 1:
<!-- defining a keyword as a Concept, at URI = http://mydomain.com/infrared+astronomy# -->
@Mec-iS
Mec-iS / results.json
Created August 14, 2014 20:25
Quickscrape's test result
[
{
"title": "NuSTAR | NASA"
},
{
"title": "NuSTAR Delivers the X-Ray Goods | NASA"
},
{
"title": "NuSTAR Delivers the X-Ray Goods - NASA Jet Propulsion ..."
},
@Mec-iS
Mec-iS / command.sh
Created August 14, 2014 20:22
Quickscrape's command for scraping nasasearch
quickscrape --url "http://nasasearch.nasa.gov/search?affiliate=nasa&query=nustar+x-ray&commit=Search" --scraper journal-scrapers/scrapers/nasasearch.json --output nasasearch --loglevel debug
@Mec-iS
Mec-iS / nasasearch.json
Created August 14, 2014 20:19
Quickscrape's scrapers definition for nasasearch
{
"url": "nasasearch.nasa.gov",
"elements": {
"title": {
"selector": "//div[@id='search']/div[@id='results']/div[@class='searchresult']/h2/a",
"attribute": "text"
},
"link": {
"selector": "//div[@id='search']/div[@id='results']/div[@class='searchresult']/h2/a",
"attribute": "href"