This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
# 問い合わせ先のURL | |
uri = URI.parse("http://lod4all.net/api/search.cgi") | |
# SPARQL式 | |
sparql =<<-EOS | |
SELECT ?s | |
WHERE { | |
?s ?p <http://ja.dbpedia.org/resource/東京都> . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prefix schema: <http://schema.org/> | |
prefix org: <http://www.w3.org/ns/org#> | |
prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> | |
SELECT ?library ?name ?lat ?long | |
WHERE { | |
?library schema:name ?name . | |
OPTIONAL { | |
?library org:hasSite/geo:lat ?lat . | |
?library org:hasSite/geo:long ?long . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rdf' | |
require 'rdf/rdfxml' | |
require 'rdf/turtle' | |
=begin | |
My environment | |
MacOSX 10.10.2 | |
Ruby 2.2.1-p85 | |
$ gem list | grep rdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
README.txt | |
========== | |
kuromojiをrubyで利用するサンプル | |
1. kuromojiのダウンロード | |
wget https://github.com/downloads/atilika/kuromoji/kuromoji-0.7.7.tar.gz | |
tar zxf kuromoji-0.7.7.tar.gz | |
cd kuromoji-0.7.7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GROUP BYで集約した結果を数える | |
# 例)BibResourceクラスのインスタンスそれぞれが | |
# どのようなプロパティをいくつ持っているかを数えて表示する | |
SELECT ?resource ?property (COUNT(?property) AS ?property_count) | |
FROM <http://purl.org/net/aozora/resources> | |
WHERE { | |
?resource rdf:type <http://purl.org/net/aozora/BibResource> . | |
?resource ?property ?value . | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rsolr' | |
require 'time' | |
mode = ARGV[0] || "1" | |
url = case mode | |
when "1" | |
"http://localhost:8983/solr/collection1" | |
when "2" | |
"http://localhost:8983/solr/collection2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LOD Statsから,データセットのメタデータを収集するスクリプト | |
require 'nokogiri' | |
require 'uri' | |
require 'open-uri' | |
require 'rdf' | |
require 'rdf/rdfxml' | |
require 'rdf/n3' | |
require 'rdf/turtle' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uncomment_lines 'Gemfile', "gem 'therubyracer'" | |
gem 'simple_form' | |
gem 'nested_form' | |
gem 'country_select' | |
gem 'bootstrap-sass' | |
gem 'bootswatch-rails' | |
gem 'devise' | |
gem 'rails_admin' | |
gem_group :development do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LOD Statsから,データセットのメタデータを収集するスクリプト | |
require 'timeout' | |
require 'nokogiri' | |
require 'uri' | |
require 'cgi' | |
require 'open-uri' | |
require 'rdf' | |
require 'rdf/rdfxml' | |
require 'rdf/n3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: UTF-8 | |
# | |
# openRDF SesameにRDFファイルをHTTP Postするスクリプト | |
# ruby post2sesame.rb sample_file.rdf http://purl.org/net/mdlab/context_example | |
require 'net/http' | |
require 'cgi' | |
require 'uri' | |
# SesameのリポジトリID |
NewerOlder