Archive for the ‘ semantic web ’ Category

Interlinking Discovery #SPARQL

Here is a Quick and Dirty quide how to discover interlinking between two datasets. To begin with, You must install Fuseki SPARQL server. . Create a directory in fuseki directory, for instance : mydata. Then start your SPARQL SERVER service

java -jar fuseki-server.jar --port 8000 --update --loc=data /mydata &

For the following example, we will use two datasets: Sider and Diseasome which are stored in different graphs.

s-put http://localhost:8000/ds/data http://localhost/sider sider.nt
s-put http://localhost:8000/ds/data http://localhost/diseasome diseasome.nt

Note that, you should know the list of classes of each dataset in advance before querying it. Consider an example, we know class side_effects in the sider dataset and class disease in the diseasome dataset, then we can execute the following query :

select * {
GRAPH <http://localhost/sider&gt;
{
?sideeffect a <http://www4.wiwiss.fu-berlin.de/sider/resource/sider/side_effects&gt; .
?sideeffect ?p1 ?disease .
}
GRAPH <http://localhost/diseasome&gt;
{
?disease a <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseasome/diseases&gt; .
}
}

Results :
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| sideeffect | p1 | disease |
========================================================================================================================================================================================
| <http://www4.wiwiss.fu-berlin.de/sider/resource/side_effects/C0027947&gt; | <http://www.w3.org/2002/07/owl#sameAs&gt; | <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/833&gt; |
| <http://www4.wiwiss.fu-berlin.de/sider/resource/side_effects/C0917801&gt; | <http://www.w3.org/2002/07/owl#sameAs&gt; | <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/613&gt; |
| <http://www4.wiwiss.fu-berlin.de/sider/resource/side_effects/C0009951&gt; | <http://www.w3.org/2002/07/owl#sameAs&gt; | <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/265&gt; |
| <http://www4.wiwiss.fu-berlin.de/sider/resource/side_effects/C0042514&gt; | <http://www.w3.org/2002/07/owl#sameAs&gt; | <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/1171&gt; |
| <http://www4.wiwiss.fu-berlin.de/sider/resource/side_effects/C0004134&gt; | <http://www.w3.org/2002/07/owl#sameAs&gt; | <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseases/117&gt; |

……

Iklan

SPARQL 1.1 Federated Query

Fuseki Output

silahkan dipilih mana output yang kita inginkan


./s-query --service http://vmlidrc02.deri.ie:8000/dailymed/query 'select * {?s ?P ?o} limit 2' --output=text
./s-query --service http://localhost:8000/dailymed/query 'select * {?s ?P ?o} limit 2' --output=text
./s-query --service http://localhost:8000/dailymed/query 'select * {?s ?P ?o} limit 2' --output=xml
./s-query --service http://localhost:8000/dailymed/query 'select * {?s ?P ?o} limit 2' --output=json
./s-query --service http://localhost:8000/dailymed/query 'select * {?s ?P ?o} limit 2' --output=csv
./s-query --service http://localhost:8000/dailymed/query 'select * {?s ?P ?o} limit 2' --output=tsv

#LinkTraversal in a nutshell

  1. Discover relevant source at runtime #LinkTraversal #LinkedData
  2. Intermediate result triggers to find other relevant data source #LinkTraversal #LinkedData
  3. Zero knowledge of data statistic #LinkTraversal #LinkedData
  4. follow your nose concept #LinkTraversal #LinkedData
  5. hard to achieve completeness result #LinkTraversal #LinkedData
  6. could not execute any type of SPARQL query pattern.Ex : unbound predicate #LinkTraversal #LinkedData
  7. example #LinkTraversal : SQUIN, LTBQE, LIDAQ  #LinkedData

Statistik RDFDump

#author : Nur Aini Rakhmawati#
#twitter : @nuraini
#Date : 18 October 2012
awk '
{
s=$1
p=$2
o=$3
subj[s]=1
pre[p]=1
obj[o]=1
triple++
if ( match(p,"http://www.w3.org/1999/02/22-rdf-syntax-ns#type")!=0)
{
	entity++
	class[o]=1
	
}
else if(match(o, "^<", obj)!=0 )
	{
		uri++		
	}
else if(match(o, "^_:", obj)!=0 )
		bnode++
else
	literal++
}
END { 
for(no in class) { 
	totalC=totalC+class[no]	
}
for(no in subj) { 
	totalS=totalS+subj[no]	
}
for(no in pre) { 
	totalP=totalP+pre[no]	
}
for(no in obj) { 
	totalO=totalO+obj[no]	
}

printf("Triples %d\n",triple)
printf("Subject %d\n",totalS)
printf("Predicate %d\n",totalP)
printf("Object %d\n",totalO)

printf("class %d\n",totalC)
printf("entity %d\n",entity)
printf("uri %d\n",uri)
printf("literal %d\n",literal)
printf("bnode %d\n",bnode)
}' $1

[SPARQL] Tranlasi SPARQL Operators Ke SPARQL Algebra

Saya menemukan 1 bagian slide yang menurut saya penting bagi kita yang mengukur estimasi biaya sebuah SPARQL query dari presentasi Michael Schmidt, Michael Meier, Georg Lausen.  Slide tersebut menrangkan bagaimana kita mengubah SPARQL menajdi oerasi aljabar sebagaimana terlihat pada gambar berikut :

Example of Service Description for DARQ

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#&gt; .
@prefix sd: <http://darq.sf.net/dose/0.1#&gt; .
@prefix a: <http://example.com/a#&gt; .
@prefix b: <http://example.com/b#&gt; .
@prefix foaf: <http://xmlns.com/foaf/0.1/#&gt; .

# definition of an endpoint A
[] a sd:Service ;
sd:capability [
sd:predicate foaf:name ;
sd:triples 10 ;
sd:subjectSelectivity 0.1 ; # 1/10 (10 of distint subject)
sd:objectSelectivity 0.2 ] ; # 1/5 ( 5 of distinct object)
sd:capability [
sd:predicate foaf:mbox ;
sd:triples 10 ] ;
sd:totalTriples “20” ;
sd:url “http://a.com/sparql&#8221; . Baca lebih lanjut