Hi andy,
I don't understand what are the configuration files to be edited.
I have the Hotel.ttl file in configuration/ directory and this is his
content:
@prefix : <http://base/#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . @prefix rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ja:
<http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix rdfs:
<http://www.w3.org/2000/01/rdf-schema#> . @prefix fuseki:
<http://jena.apache.org/fuseki#> . :service_tdb_all a fuseki:Service ;
rdfs:label "TDB Hotel" ; fuseki:dataset :tdb_dataset_readwrite ;
fuseki:name "Hotel" ; fuseki:serviceQuery "query" , "sparql" ;
fuseki:serviceReadGraphStore "get" ; fuseki:serviceReadWriteGraphStore
"data" ; fuseki:serviceUpdate "update" ; fuseki:serviceUpload "upload" .
:tdb_dataset_readwrite a tdb:DatasetTDB ; tdb:location
"C:\\Users\\Maiullari\\Desktop\\TESI\\Software\\apache-jena-fuseki-2.3.0\\run/databases/Hotel"
. and also I have the config.ttl file in run/ directory and this is his
content: # Licensed under the terms of
http://www.apache.org/licenses/LICENSE-2.0 ## Fuseki Server
configuration file. @prefix : <#> . @prefix fuseki:
<http://jena.apache.org/fuseki#> . @prefix rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs:
<http://www.w3.org/2000/01/rdf-schema#> . @prefix ja:
<http://jena.hpl.hp.com/2005/11/Assembler#> . [] rdf:type fuseki:Server
; # Example:: # Server-wide query timeout. # # Timeout - server-wide
default: milliseconds. # Format 1: "1000" -- 1 second timeout # Format
2: "10000,60000" -- 10s timeout to first result, # then 60s timeout for
the rest of query. # # See javadoc for ARQ.queryTimeout for details. #
This can also be set on a per dataset basis in the dataset assembler. #
# ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "30000" ] ; #
Add any custom classes you want to load. # Must have a "public static
void init()" method. # ja:loadClass "your.code.Class" ; # End triples. .
Now, which file I have to edit between hotel.ttl and config.ttl? Can you
also tell me what are the values to be inserted in my case? Thanks in
adavanced.
Il 19/11/2015 13:14, Andy Seaborne ha scritto:
Rocco, On 18/11/15 14:40, Rocco wrote:
Hi Andy, I have put in the configuration file (config.ttl) the
exactly code that you have sent me that present in this
page(https://github.com/apache/jena/blob/master/jena-fuseki2/examples/service-inference-1.ttl)
but the result of query are not changed.
Exactly? That is an example and you'll need to For example, your data
service is "Hotel/query" so the fuseki:name is "Hotel" not
"inf-mem". Maybe you want a different reasoner.
What is the problem?
What sort of reasoning are you expecting? What does the instance data
and the ontology look like? Andy
Thanks in adavanced. Rocco Il 18/11/2015 12:12, Andy Seaborne ha
scritto:
Hi Rocco, To put in an inferencing dataset, you'll need to write a
configuration file. The UI can't create complex dataset setups. Put
the service and dataset description in the configuration/ directory
of the Fuseki area.
https://github.com/apache/jena/tree/master/jena-fuseki2/examples
----------------- # Dataset with only the default graph. <#dataset>
rdf:type ja:RDFDataset ; ja:defaultGraph
<#model_inf> ; . # The inference model <#model_inf> a
ja:InfModel ; ja:baseModel <#baseModel> ; ja:reasoner [
ja:reasonerURL
<http://jena.hpl.hp.com/2003/OWLFBRuleReasoner> ] . # The base
data. <#baseModel> a ja:MemoryModel ; ja:content
[ja:externalContent <file:Data/data.ttl> ] ; . -----------------
Andy On 17/11/15 20:46, Rocco Lillo wrote:
Il 17/nov/2015 16:29 "Rocco" <[email protected]> ha scritto:
I use apache jena fuseki as server sparqlendpoint interface for
execute query sparql on an ontology OWL that is loaded on server
apache jena. The queries are executed through python languages. I
have need that the results of query must be the consequence of
process the reasoning. How I do at configure the reasoner with
apache jena fuseki? I use library sparqlwrapper for SPARQL
Endpoint interface to Python. # defines the URI of the endpoint
and the query to send uri = "http://localhost:3030/Hotel/query"
<http://localhost:3030/Hotel/query> query = ("PREFIX :
<http://www.semanticweb.org/ontologies/Hotel.owl#>
<http://www.semanticweb.org/ontologies/Hotel.owl#> "
"SELECT ?hotel ?price WHERE {" " ?hotel a :Hotel. "
" ?hotel :hasPrice ?price }") # obtain a connection to
the endpoint and sends the query sparql =
SPARQLEndpointInterface(uri) rs,fields = converter(sparql(query))
And this is the define the function sparql: def
__call__(self, statement): ''' This function sends the
query to the SPARQL end-point. :Parameter: statement:
query in string form to send. :Returns: resultset: the
result-set list in JSON format. ''' resultset = []
self._sparql.setQuery(statement)
self._sparql.setReturnFormat(JSON) print("SPARQLInterface is
executing the query...") try: t0 = time()
rs = self._sparql.query() tf = time() resultset
= rs.convert() print("Query has been executed
successfully!\nTime elapsed: {0:.3f} seconds.".format(tf-t0))
except: raise Exception("")
self._sparql.resetQuery() return resultset