SPARQL querying not possible - fuseki

I installed Fuseki on my local Ubuntu. Accessible via http://localhost:3030. Added a dataset "fuwstats" and a named graph "fuwstats" and then I imported some triples (see code below).
When I want to run the standard SPARQL query, nothing is shown (0 results). Any idea what I'm doing wrong?
SPARQL Endpoint is: http://localhost:3030/fuwstats/query
Query is: SELECT * WHERE { ?s ?p ?o }
This is the RDF that I added to the dataset:
#prefix fuwarticle: <http://localhost/article/> .
#prefix dc: <http://purl.org/dc/elements/1.1/> .
#prefix dcterms: <http://purl.org/dc/terms/> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
fuwstats:1452406 dc:source fuwarticle:lonza-stellt-sich-neu-auf.
fuwstats:1452406 fuwstats:visit _:b.
_:b fuwstats:visitor "bbbbbbbbbb"^^xsd:int.
_:b dcterms:date "2019-02-25 10:37:10"^^dcterms:W3CDTF .
fuwstats:1452406 fuwstats:visit _:c.
_:c fuwstats:visitor "aaaaaaaaa"^^xsd:int.
_:c dcterms:date "2019-01-26 10:37:10"^^dcterms:W3CDTF .`

Related

Why does my SPARQL query works in idref but not in R?

I am trying to extract SPARQL data with SPARQL package in R. This works in https://data.idref.fr/yasgui.html but not in R :
SPARQL(url="https://data.idref.fr/sparql",
query='PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bnf-onto: <http://data.bnf.fr/ontology/bnf-onto/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?nom count(*) as ?prefaces
WHERE
{
<http://www.idref.fr/028479653/id> foaf:name ?nom.
?uri ?relator <http://www.idref.fr/028479653/id> ; dcterms:bibliographicCitation ?titre.
?relator skos:prefLabel ?role.
FILTER CONTAINS(?role, "Préfacier, etc.")
}')
This returns the following error :
Error in function (type, msg, asError = TRUE) : error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Could you help me to fix this?

How to dereference an uploaded URI node in Fuseki2 linked data server?

I installed Fuseki2 and run it as a standalone server with default settings (http://localhost:3030/).
I created an in-memory dataset ('geography') by uploading a Turtle file with information like this, through the 'Manage datasets' console:
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix schema: <http://schema.org/> .
#prefix dcat: <http://www.w3.org/ns/dcat#> .
#prefix pd: <http://localhost:3030/geography/ontology/> .
pd:City
rdf:type owl:Class ;
rdfs:comment "Represents a City in the ontology" .
<http://localhost:3030/geography/City/>
a dcat:Dataset;
schema:name "City information";
schema:description "Dataset with all the country's cities' information from 2018." ;
<http://localhost:3030/geography/City/1100015>
a pd:City;
rdfs:label "Rome" ;
pd:isCapital "1"^^xsd:int .
Although I can get the values by SPARQL query (eg. PREFIX dcat: http://www.w3.org/ns/dcat# SELECT ?s WHERE {?s a dcat:Dataset.}), I cannot access this node's information (http://localhost:3030/geography/City/1100015), as I would, for example , like this: http://dbpedia.org/page/Rome.
Is there a way that I can configure Fuseki server to dereference the URI that I uploaded and return the information of the node?
Apparently the only way to make the imported URIs resolvable is by using a Linked Data Interface, such as Pubby (http://wifo5-03.informatik.uni-mannheim.de/pubby/) or LOD View (https://github.com/LodLive/LodView).
Once installed, you can point them to the Fuseki's SPARQL endpoint.
Example with LodView config file (config.ttl):
conf:IRInamespace <http://localhost:3030/geography/> ; # base namespace for URIs
conf:endpoint <http://localhost:3030/sparql>; # where to query
The, you can access http://localhost:8080/lodview/geography/City/1100015 through content negotiation.

copy a line with specific pattern and paste it below in unix without opening a file

I have a specific requirement.
I have file:
some text
. . . . .
. . . . .
**todo: owner comments . . . .**
... .
sometext
Now I want the output like:
some text
. . . . .
. . . . .
**todo: owner comments . . . .**
**owner: todo comments . . . .**
... .
.
sometext
I want to grep for todo and copy that line and paste it below with above modification.
Can it be possible without opening a file... like sed,awk command ??
Thanks and Regards,
Dharak
I guess what you mean is opening the file in an editor. Here is an awk script you can tailor for your needs.
$ awk '/\*\*todo:/{print; print "**owner: todo ... ";next}1' file
some text
. . . . .
. . . . .
**todo: owner comments . . . .**
**owner: todo ...
... .
sometext
you can save the output to a temp file and move over to your original file.
sed 's/\(**todo: owner comments\)\(.*\)/\1 \2 \
> **owner: todo comments \2/g' filename
Patterns matched and replaced
New line is inserted manually by placing an enter after '\' at end of first line
'>' will come automatically pointing for the next characters to be inserted

Virtuoso Dump graph

Hello I have a probably simple problem but I am not able to find it anywhere in docs.
I use this code in Virtuoso Interactive SQL:
SPARQL clear graph <http://product-open-data.org/temp>;
SPARQL clear graph <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>;
DB.DBA.TTLP ('
#prefix rr: <http://www.w3.org/ns/r2rml#> .
#prefix foaf: <http://xmlns.com/foaf/0.1/> .
#prefix gr: <http://purl.org/goodrelations/v1#> .
#prefix s: <http://schema.org/> .
#prefix pod: <http://linked.opendata.cz/ontology/product-open-data.org#>
<#TriplesMapBrand>
a rr:TriplesMap;
rr:logicalTable [
rr:tableSchema "POD";
rr:tableOwner "DBA";
rr:tableName "BRAND"
];
rr:subjectMap
[
rr:template "http://linked.opendata.cz/resource/brand/{BSIN}";
rr:class gr:Brand;
rr:graph <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
];
rr:predicateObjectMap [
rr:predicateMap [rr:constant pod:bsin];
rr:objectMap [rr:termType rr:Literal; rr:column "BSIN" ];
];
rr:predicateObjectMap [
rr:predicateMap [rr:constant gr:name];
rr:objectMap [rr:termType rr:Literal; rr:column "BRAND_NM" ];
];
rr:predicateObjectMap [
rr:predicateMap [rr:constant s:url];
rr:objectMap [rr:termType rr:IRI; rr:template "{BRAND_LINK}";];
];.
', 'http://product-open-data.org/temp', 'http://product-open-data.org/temp', 0);
exec ('sparql ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('http://product-open-data.org/temp','http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01'));
SPARQL Select * from <http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01>
where {?s ?o ?p.} limit 1000000;
My problem is following: I want to get a TTL file with dump_one_graph procedure. But when I run the procedure like this in iSQL:
SQL> DB.DBA.dump_one_graph('http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01','../R2RML/pod_',1000000000);
the only thing I get is:
Dump of graph http://linked.opendata.cz/resource/dataset/product-open-data.org/2014-01-01, as of 2014-11-11 23:46:48.000004
So my question is: where are my triples stored and why is SPARQL SELECT returning a result set while dump_one_graph doesn't?
R2RML gets mapped to Virtuoso RDFViews which are not persisted to the Quad Store by default.
There is an option to make these material or persisted to the Quad Store.
Have a look at: r2rml. There should by an option 'Enable Data Syncs with Physical Quad Store' which should do the trick. Also have a look at the Generate RDB2RDF triggers option. I don't know exactly how this will look with turtle-syntax, but you can inspect the resulting commands by using the 'Prepare to Execute Button.
Hope this helps...

How to I pass a list to cl-mustache?

I am trying to use CL-MUSTACHE. Rendering atomic variables works fine, following the examples in the README file:
> (mustache:mustache-render-to-string "{{year}}-{{month}}-{{day}}"
'((:year . "2012")
(:month . "07")
(:day . "02")))
"2012-07-02"
However, I am unable to figure out how to pass a list to render a section multiple times. The README file does not have an example, and the ways I have tried don't work. For example:
(mustache:mustache-render-to-string "{{#dates}}{{year}}-{{month}}-{{day}}
{{/dates}}"
'((:dates . (((:year . "2012")
(:month . "07")
(:day . "02"))
((:year . "2013")
(:month . "08")
(:day . "03"))))))
"--
"
I don't have it to check, but from the documentation, it seems that arrays are treated as CL arrays, so you can try this to see if it works:
(mustache:mustache-render-to-string "{{#dates}}{{year}}-{{month}}-{{day}}{{/dates}}"
'((:dates . #( ((:year . "2012")
(:month . "07")
(:day . "02"))
((:year . "2013")
(:month . "08")
(:day . "03"))))))
(that is, an array of lists of parameters).

Resources