How to use LarKC for Location Based Social Media Analysis
Emanuele Della Valle, 20.6.2011
Abstract. This page presents how to use LarKC for Location Based Social Media Analysis with a template LarKC work flow and three template LarKC plug-ins. This is part of the "crazy plan" we agree upon in Lund, in particular it focus on query 24.
Contents
Conceptual View
Let us assume that:
- each plug-ins declares to be able to answers a set of graph pattern expression
- the SPARQL query we submit to the LarKC4LBSMA requires in the WHERE clause a graph pattern expression that can be obtained by concatenating with "." (i.e., AND) graph pattern expression declared by the plug-ins
Each query submitted to LarKC4LBSMA can be rewritten in a set of queries to be executed in parallel on the plug-ins that will store the intermediate results in a labelled graph in LarKC data layer and a query that computes the intersection of the previous queries on the partial results stored in the labelled graph in LarKC data layer.
The following figure illustrate this concept using four plug-ins: Query Rewriter, SOR, SUNS and SPARQL Evalutator. The queries Q reaches the SPARQL endpoint attached to the input of the path (i.e., the diamond labelled with "begin"). Q is sent to the Query Rewriter using the standard encoding that makes use of the triple _:a1 hasSerializationForm "Q" . The Query Rewriter rewrites the query Q in three queries, QSOR for SOR, QSUNS for SUNS and Q for the SPARQL Evaluator. It encodes them in the output set of statements using the triples illustrated in the figure. It also determine the name of the labelled graph to store the intemediate results of SOR and SUNS into. It adds the name of such a label to the output set of statements. SOR and SUNS recieve their query, process them and store the intermediate results in the data layer using the label indicated by the query rewriter. Finally, the SPARQL Evaluator plugin recieves the query Q, evaluates it on the labelled graph and returns the resutls.
The LarKC workflow for this example is:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix larkc: <http://larkc.eu/schema#> . _:queryRewriter a <urn:eu.larkc.lbsma.TemplateQueryRewriter> . _:sunsPlugin a <urn:eu.larkc.lbsma.TemplatePluginSUNS> . _:sorPlugin a <urn:eu.larkc.lbsma.TemplatePluginSOR> . _:reasoner a <urn:eu.larkc.plugin.SparqlQueryEvaluationReasoner> . _:queryRewriter larkc:connectsTo _:sorPlugin . _:queryRewriter larkc:connectsTo _:sunsPlugin . _:queryRewriter larkc:connectsTo _:reasoner . _:sorPlugin larkc:connectsTo _:reasoner . _:sunsPlugin larkc:connectsTo _:reasoner . #Define the endpoint for this workflow. <urn:eu.larkc.endpoint.sparql.ep1> a <urn:eu.larkc.endpoint.sparql> . #Endpoints are connected to paths in the workflow. Specify the path the above endpoint refers to. <urn:eu.larkc.endpoint.sparql.ep1> larkc:links _:path . _:path a larkc:Path . #Connect the input of the path to a plugin _:path larkc:hasInput _:queryRewriter . #Connect the output of the path to a plugin _:path larkc:hasOutput _:reasoner .
The query LarKC client sends to LarKC is:
SELECT ?poi ?name ?category ?p
WHERE
{ ns:place_201 rdf:type ns:NamedPlace .
ns:place_201 geo:lat ?givenLat .
ns:place_201 geo:long ?givenLong .
ns:place_201 ns:category ?category .
?poi rdf:type ns:NamedPlace .
?poi ns:name ?name .
?poi geo:lat ?lat .
?poi geo:long ?long .
?poi ns:category ?category
FILTER ( ?poi != ns:place_201 )
FILTER ( ( ( ( ( ?lat - ?givenLat ) < 0.001 ) &&
( ( ?lat - ?givenLat ) > -0.001 ) ) &&
( ( ?long - ?givenLong ) < 0.001 ) ) &&
( ( ?long - ?givenLong ) > -0.001 ) )
{ twd:108512266 sioc:creator_of ?tweet .
?tweet twd:talksAboutPositively ?poi .
WITH PROBABILITY ?p
ENSURE PROBABILITY [0.5..1)
}
}
ORDER BY DESC(?p)
LIMIT 10It is worth to notice the use of WITH PROBABILITY ?p to access the probability estimated by SUNS for the graph pattern {twd:108512266 sioc:creator_of ?tweet . ?tweet twd:talksAboutPositively ?poi } and ENSURE PROBABILITY [0.5..1) that filters all the solutions whose probability is more than or equal to 0.5 and less than 1 (thus excluding all asserted triples).
The query the Query rewriter sends to SOR is:
CONSTRUCT { ?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category . }
WHERE {
ns:place_201 a ns:NamedPlace ;
geo:lat ?givenLat ;
geo:long ?givenLong ;
ns:category ?category .
?poi a ns:NamedPlace ;
ns:name ?name ;
geo:lat ?lat ;
geo:long ?long ;
ns:category ?category .
FILTER (?poi != ns:place_201)
FILTER (
(?lat - ?givenLat) < 0.001 &&
(?lat - ?givenLat) > -0.001 &&
(?long - ?givenLong) < 0.001 &&
(?long - ?givenLong) > -0.001
)It is worth to notice that the query above is a CONSTRUCT query. The Query Rewriter is asking SOR to run this query on its repository and to store the resulting RDF graph in LarKC data layer in a labelled graph.
The query the Query Rewriter sends to SUNS is:
CONSTRUCT { twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p ] }
WHERE {
SELECT ?poi (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) AS ?p)
WHERE {
twd:108512266 sioc:creator_of ?tweet .
?tweet twd:talksAboutPositively ?poi .
FILTER (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) >= 0.5 && f:talksAboutPositivelyWithProbability(twd:108512266,?poi) < 1)
}
}It is worth to notice that also this is a CONSTRUCT query and that SUNS is expected to write the resulting RDF graph in LarKC data layer in a labelled graph. Both SUNS and SOR must write in the same labelled graph whose label is defined by the query rewriter.
Finally, the Query Rewriter sends to the SPARQL Evaluator the query that impose the conditions that finds the intersection between the results of the query sent to SUNS and to SOR. This query is:
SELECT DISTINCT ?poi ?name ?category ?p
WHERE {
?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category .
twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p ]
}
ORDER BY DESC(?p)
LIMIT 10 ")
Downloading and Installing
LarKC Platform 2.5 (I checked it out from the SVN, but [http://sourceforge.net/projects/larkc/files/Release-2.5/larkc-release-2.5.zip/download|this link] should also work.
- If you downloaded the platform unzip it, otherwise it should be ready
download the data prepared by Seonho from http://dl.dropbox.com/u/8152171/bottari-original.zip
- unzip the file in the larkc-release-2.5 folder
- Download the .jar of the three template plug-ins I developed from
- copy them into larkc-release-2.5/platform/plugins (LarKC will unzip them when starting up)
create a folder in the platform root named bottari-original and unzip the bottari-original.zip into it
Download my LarKC Client eclipse project I use for testing from http://dl.dropbox.com/u/8152171/LarKC4LBSMAClient.zip
- import it in your eclipse
Testing
- start-up LarKC by running the run_larkc script from the larkc-release-2.5/platform folder
- execute the main of Test.java in my LarKC Client eclipse project
- If everything goes well the it should write on console something like
Jun 20, 2011 7:47:39 PM org.restlet.engine.http.connector.HttpClientHelper start INFO: Starting the default HTTP client http://localhost:8182/workflow/6c27a8b9-eb3b-438d-bbda-a58423fe3b17 Jun 20, 2011 7:47:45 PM org.restlet.engine.http.connector.HttpClientHelper start INFO: Starting the default HTTP client http://127.0.0.1:8183/sparql Jun 20, 2011 7:47:45 PM org.restlet.engine.http.connector.HttpClientHelper stop INFO: Stopping the default HTTP client Jun 20, 2011 7:47:45 PM org.restlet.engine.http.connector.HttpClientHelper stop INFO: Stopping the default HTTP client --------------------------------------------------------------------------------------------------------------- | poi | name | category | p | =============================================================================================================== | <http://www.saltlux.com/geospatial#place_822> | "ÌÉúÏõê" | <http://www.saltlux.com/geospatial#code_643> | "0.9" | ---------------------------------------------------------------------------------------------------------------
- the LarKC logs in the terminal window should tell something like
SPARQLServer 19:47:46.220 DEBUG e.l.c.e.Executor: Got query to execute.
LocalPluginManager 19:47:46.303 DEBUG e.l.p.Plugin: Cache miss
Hello from eu.larkc.lbsma.TemplateQueryRewriter@215cc135
LocalPluginManager 19:47:46.317 DEBUG e.l.p.Plugin: Plugin eu.larkc.lbsma.TemplateQueryRewriter called.
input: (_:node162n2kjlcx1, http://larkc.eu/schema#hasSerializedForm, "PREFIX f: <http://www.saltlux.com/geo/functions#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?poi ?name ?category ?p
WHERE
{ ns:place_201 rdf:type ns:NamedPlace .
ns:place_201 geo:lat ?givenLat .
ns:place_201 geo:long ?givenLong .
ns:place_201 ns:category ?category .
?poi rdf:type ns:NamedPlace .
?poi ns:name ?name .
?poi geo:lat ?lat .
?poi geo:long ?long .
?poi ns:category ?category
FILTER ( ?poi != ns:place_201 )
FILTER ( ( ( ( ( ?lat - ?givenLat ) < 0.001 ) && ( ( ?lat - ?givenLat ) > -0.001 ) ) && ( ( ?long - ?givenLong ) < 0.001 ) ) && ( ( ?long - ?givenLong ) > -0.001 ) )
{ twd:108512266 sioc:creator_of ?tweet .
?tweet twd:talksAboutPositively ?poi
}
}
ORDER BY DESC(?p)
LIMIT 10
")
(_:node162n2kjlcx1, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://larkc.eu/schema#SPARQLquery)
output: (_:3e48f4fe-6481-4e87-a2b3-6f385bca2e77, http://larkc.eu/schema#rewrittenQuery4SUNS, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p
] }
WHERE {
SELECT ?poi (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) AS ?p)
WHERE {
twd:108512266 sioc:creator_of ?tweet .
?tweet twd:talksAboutPositively ?poi .
FILTER (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) >= 0.5 && f:talksAboutPositivelyWithProbability(twd:108512266,?poi) < 1)
}
}")
(_:56683822-700e-44bc-9c9a-fd98f2676e8f, http://larkc.eu/schema#rewrittenQuery4SOR, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://www.saltlux.com/geo/functions#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { ?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category . }
WHERE {
ns:place_201 a ns:NamedPlace ;
geo:lat ?givenLat ;
geo:long ?givenLong ;
ns:category ?category .
?poi a ns:NamedPlace ;
ns:name ?name ;
geo:lat ?lat ;
geo:long ?long ;
ns:category ?category .
FILTER (?poi != ns:place_201)
FILTER (
(?lat - ?givenLat) < 0.001 &&
(?lat - ?givenLat) > -0.001 &&
(?long - ?givenLong) < 0.001 &&
(?long - ?givenLong) > -0.001
)
}")
(_:a1880e6e-95dd-4a05-a60c-ef2358940880, http://larkc.eu/schema#hasSerializedForm, "
PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT DISTINCT ?poi ?name ?category ?p
WHERE {
?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category .
twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p ]
} ORDER BY DESC(?p)
LIMIT 10 ")
(_:4d392b68-305b-43bf-bcde-968f785dcb7b, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
LocalPluginManager 19:47:46.326 DEBUG e.l.c.p.l.LocalPluginManager: Wrote data to output queues ...
LocalPluginManager 19:47:46.344 DEBUG e.l.p.Plugin: Cache miss
Hello from eu.larkc.lbsma.TemplatePluginSOR@24ae2d66
LocalPluginManager 19:47:46.390 DEBUG e.l.p.Plugin: Cache miss
Hello from eu.larkc.lbsma.TemplatePluginSUNS@9bc850f
LocalPluginManager 19:47:47.102 WARN c.o.t.InferencerFactory: Deprecated usage of partialRdfs=true flag detected. Consider changing the configuration to use 'owl-max-optimized', 'owl-horst-optimized', 'owl2-rl-reduced-optimized', 'rdfs-optimized' rulesets!
ruleSet is disabled
LocalPluginManager 19:47:47.713 DEBUG e.l.p.Plugin: Plugin eu.larkc.lbsma.TemplatePluginSUNS called.
input: (_:3e48f4fe-6481-4e87-a2b3-6f385bca2e77, http://larkc.eu/schema#rewrittenQuery4SUNS, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p
] }
WHERE {
SELECT ?poi (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) AS ?p)
WHERE {
twd:108512266 sioc:creator_of ?tweet .
?tweet twd:talksAboutPositively ?poi .
FILTER (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) >= 0.5 && f:talksAboutPositivelyWithProbability(twd:108512266,?poi) < 1)
}
}")
(_:56683822-700e-44bc-9c9a-fd98f2676e8f, http://larkc.eu/schema#rewrittenQuery4SOR, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://www.saltlux.com/geo/functions#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { ?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category . }
WHERE {
ns:place_201 a ns:NamedPlace ;
geo:lat ?givenLat ;
geo:long ?givenLong ;
ns:category ?category .
?poi a ns:NamedPlace ;
ns:name ?name ;
geo:lat ?lat ;
geo:long ?long ;
ns:category ?category .
FILTER (?poi != ns:place_201)
FILTER (
(?lat - ?givenLat) < 0.001 &&
(?lat - ?givenLat) > -0.001 &&
(?long - ?givenLong) < 0.001 &&
(?long - ?givenLong) > -0.001
)
}")
(_:a1880e6e-95dd-4a05-a60c-ef2358940880, http://larkc.eu/schema#hasSerializedForm, "
PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT DISTINCT ?poi ?name ?category ?p
WHERE {
?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category .
twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p ]
} ORDER BY DESC(?p)
LIMIT 10 ")
(_:4d392b68-305b-43bf-bcde-968f785dcb7b, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
output: (_:4d71df31-99ea-4a8a-b426-2427af2a113c, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
LocalPluginManager 19:47:47.753 DEBUG e.l.c.p.l.LocalPluginManager: Wrote data to output queues ...
LocalPluginManager 19:47:49.051 DEBUG e.l.p.Plugin: Plugin eu.larkc.lbsma.TemplatePluginSOR called.
input: (_:3e48f4fe-6481-4e87-a2b3-6f385bca2e77, http://larkc.eu/schema#rewrittenQuery4SUNS, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p
] }
WHERE {
SELECT ?poi (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) AS ?p)
WHERE {
twd:108512266 sioc:creator_of ?tweet .
?tweet twd:talksAboutPositively ?poi .
FILTER (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) >= 0.5 && f:talksAboutPositivelyWithProbability(twd:108512266,?poi) < 1)
}
}")
(_:56683822-700e-44bc-9c9a-fd98f2676e8f, http://larkc.eu/schema#rewrittenQuery4SOR, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://www.saltlux.com/geo/functions#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { ?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category . }
WHERE {
ns:place_201 a ns:NamedPlace ;
geo:lat ?givenLat ;
geo:long ?givenLong ;
ns:category ?category .
?poi a ns:NamedPlace ;
ns:name ?name ;
geo:lat ?lat ;
geo:long ?long ;
ns:category ?category .
FILTER (?poi != ns:place_201)
FILTER (
(?lat - ?givenLat) < 0.001 &&
(?lat - ?givenLat) > -0.001 &&
(?long - ?givenLong) < 0.001 &&
(?long - ?givenLong) > -0.001
)
}")
(_:a1880e6e-95dd-4a05-a60c-ef2358940880, http://larkc.eu/schema#hasSerializedForm, "
PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT DISTINCT ?poi ?name ?category ?p
WHERE {
?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category .
twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p ]
} ORDER BY DESC(?p)
LIMIT 10 ")
(_:4d392b68-305b-43bf-bcde-968f785dcb7b, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
output: (_:51f299dc-21eb-417b-a209-868eae10430b, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
LocalPluginManager 19:47:49.052 DEBUG e.l.c.p.l.LocalPluginManager: Wrote data to output queues ...
LocalPluginManager 19:47:49.070 DEBUG e.l.p.Plugin: Cache miss
LocalPluginManager 19:47:49.074 DEBUG e.l.p.Plugin: Got query:
PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT DISTINCT ?poi ?name ?category ?p
WHERE {
?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category .
twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p ]
} ORDER BY DESC(?p)
LIMIT 10
LocalPluginManager 19:47:49.076 DEBUG e.l.p.Plugin: Processing select query...
LocalPluginManager 19:47:49.101 DEBUG e.l.p.Plugin: Plugin eu.larkc.plugin.SparqlQueryEvaluationReasoner called.
input: (_:3e48f4fe-6481-4e87-a2b3-6f385bca2e77, http://larkc.eu/schema#rewrittenQuery4SUNS, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p
] }
WHERE {
SELECT ?poi (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) AS ?p)
WHERE {
twd:108512266 sioc:creator_of ?tweet .
?tweet twd:talksAboutPositively ?poi .
FILTER (f:talksAboutPositivelyWithProbability(twd:108512266,?poi) >= 0.5 && f:talksAboutPositivelyWithProbability(twd:108512266,?poi) < 1)
}
}")
(_:56683822-700e-44bc-9c9a-fd98f2676e8f, http://larkc.eu/schema#rewrittenQuery4SOR, "PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://www.saltlux.com/geo/functions#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
CONSTRUCT { ?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category . }
WHERE {
ns:place_201 a ns:NamedPlace ;
geo:lat ?givenLat ;
geo:long ?givenLong ;
ns:category ?category .
?poi a ns:NamedPlace ;
ns:name ?name ;
geo:lat ?lat ;
geo:long ?long ;
ns:category ?category .
FILTER (?poi != ns:place_201)
FILTER (
(?lat - ?givenLat) < 0.001 &&
(?lat - ?givenLat) > -0.001 &&
(?long - ?givenLong) < 0.001 &&
(?long - ?givenLong) > -0.001
)
}")
(_:a1880e6e-95dd-4a05-a60c-ef2358940880, http://larkc.eu/schema#hasSerializedForm, "
PREFIX ns: <http://www.saltlux.com/geospatial#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX f: <http://example.org/function#>
PREFIX twd: <http://www.saltlux.com/larkc/lbsma/twitterdata#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT DISTINCT ?poi ?name ?category ?p
WHERE {
?poi a ns:NamedPlace ;
ns:name ?name ;
ns:category ?category .
twd:108512266 twd:mayTalkPositively [
twd:about ?poi ;
twd:withProbability ?p ]
} ORDER BY DESC(?p)
LIMIT 10 ")
(_:4d392b68-305b-43bf-bcde-968f785dcb7b, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
(_:4d71df31-99ea-4a8a-b426-2427af2a113c, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
(_:51f299dc-21eb-417b-a209-868eae10430b, http://larkc.eu/schema#defaultoutputname, http://larkc.eu/schema#7992f38cd26bc185678051660530b3e8)
output: (_:node162n2kmfdx1, http://larkc.eu/VariableBinding, eu.larkc.core.data.VariableBindingValue@6471d768)
Start Coding
You can download the code of the three template plug-ins I did from:
Unfortunately, I found very difficult importing somebody else plug-in in my eclipse and change them. This is mainly due to the fact that the LarKC eclipse plug-in I have installed (it is not the last version, but at the time I installed LarKC Platform 2.5 the new Eclipse plug-in was not available) is design for LarKC Platform 2.0. You should check whether a new Eclipse plug-in was released recently.
If not, my approach to import somebody else plug-in is:
- I delete both the jar and the folder of the LarKC plug-in I want to start extending form larkc-platform-2.5/platform/plugins
- I create using the LarKC Eclipse Plug-in a project with the same name of the LarKC plug-in I want to start extending
I adjust the class path to point to the larkc platform jar in larkc-platform-2.5/target/platform-2.5.0-SNAPSHOT-?LarkcAssembly.jar
- I cut and past the source code of the plug-in I want to start extending from its original folder to the folder automatically created in the Eclipse Workspace
- I adjust the class path to import all the jars in the lib folder of the plug-in (if any)
You know you have succeed if a folder named as the plugin your are modifying appears in larkc-platform-2.5/platform/plugins and the compiled code appers there every time you rebuild.
What's Next
You should start coding your plug-in changing the template code that I'm providing with SOR/SUNS implementation. You should be able to test your plugins independently since my code simulate the behavior of the rest of the system.
In terms of responsibilities, I take responsibility for implementing a generic version of the query rewriter, Saltlux is responsible for the SOR plugin and SIMENS is responsible for the SUNS plugin.
Enjoy
Emanuele
