This is a combination of things happening.
In the one case of no data (grph or dataset) provided, Jena does read
the URL. If there is supplied data, FROM refers the dataset.
The URL is coming back from www.learningsparql.com
as explicitly "Content-Type: text/plain", not "text/turtle".
Jena pretty much ignores "text/plain" because it is usually wrong, so it
tries to guess the syntax.
The URL in the message
(URI=file:///D:/neli/cs575Spring24/ex070mod2.rq : stream=text/plain)
is misleading - that "URI" is the base URI, not the URI being read.
> (This specifically may be a bug in the arq tool)
Yes, it is.
Recorded as https://github.com/apache/jena/issues/2250
Corrected, the results are:
-------------------------------------------------------------
| last | first | courseName |
=============================================================
| "Mutt" | "Richard" | "Updating Data with SPARQL" |
| "Mutt" | "Richard" | "Using SPARQL with non-RDF Data" |
| "Marshall" | "Cindy" | "Modeling Data with OWL" |
| "Marshall" | "Cindy" | "Using SPARQL with non-RDF Data" |
| "Ellis" | "Craig" | "Using SPARQL with non-RDF Data" |
-------------------------------------------------------------
Workarounds:
1/ Download the file using curl or wget as suggested
2/ Set the base on the command line with
--base http://www.learningsparql.com/2ndeditionexamples/ex069.ttl
The message
ERROR StatusLogger Reconfiguration failed: No configuration found for
'73d16e93' at 'null' in 'null'
is unrelated.
It is the command not finding the logging set up - I don't know why that
is happening.
Try copying the log4j2.properties from the distribution directory into
the current directory.
Andy
On 05/02/2024 13:06, Zlatareva, Neli (Computer Science) wrote:
Hi Rob, thank you so much for the quick response. What made me wonder was that
this same FROM from arq on command line worked perfectly fine in the past (was
able to access remote files). However, I assume that for different reasons
(security?) this is not the case anymore.
Truly appreciate the help.
Thanks.
Regards, Neli.
Neli P. Zlatareva, PhD
Professor of Computer Science
Department of Computer Science
Central Connecticut State University
New Britain, CT 06050
Phone: (860) 832-2723
Fax: (860) 832-2712
Web site: cs.ccsu.edu/~neli/
________________________________
From: Rob @ DNR <[email protected]>
Sent: Monday, February 5, 2024 6:32 AM
To: [email protected] <[email protected]>
Subject: Re: question about FROM keyword
EXTERNAL EMAIL: This email originated from outside of the organization. Do not
click any links or open any attachments unless you trust the sender and know
the content is safe.
So, there’s a couple of things happening here.
Firstly, Jena’s SPARQL engine always treats FROM (and FROM NAMED) as referring
to graphs in the local dataset. So, it doesn’t matter that the URL in your
FROM is a valid RDF resource on the web, Jena won’t try and load that by
default, it just looks for a graph with that URI in the local dataset.
Nothing in the SPARQL specifications requires that these URLs be treated
otherwise. Some implementations choose to resolve these URIs from the web but
that isn’t required by the standard, and from a security standpoint isn’t a
good idea.
Secondly, the ARQ command line tool the local dataset is usually an implicit
empty dataset if you don’t supply one. Except as it turns out when you supply
a FROM/FROM NAMED, in which case it tries to build one given the inputs it has.
In this case that’s only your query file which isn’t valid when treated as an
RDF dataset, thus you get the big nasty stack trace you reported. (This
specifically may be a bug in the arq tool)
You can avoid this second problem by supplying an empty data file e.g.
arq --query query.rq --data empty.ttl
But that will only serve to highlight the first issue, that Jena only treats
FROM/FROM NAMED as references to graphs in the local dataset, and you’ll get an
empty result from your query.
You are better off downloading the RDF data you want to query locally and then
running arq and supplying both a query file and a data file.
Hope this helps,
Rob
From: Zlatareva, Neli (Computer Science) <[email protected]>
Date: Monday, 5 February 2024 at 01:40
To: [email protected] <[email protected]>
Subject: question about FROM keyword
Hi there, I am trying the following arq query from command window
(works fine if I am getting the file locally)
PREFIX ab:
<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Flearningsparql.com%2Fns%2Faddressbook%23&data=05%7C02%7CZlatareva%40ccsu.edu%7C59d36674f06f40d9c56308dc263e3868%7C2329c570b5804223803b427d800e81b6%7C0%7C0%7C638427296484679540%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=waYVEA2IEoM78rs6p3x%2BkxuleHLLzvibLf1eZD2M7AE%3D&reserved=0<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Flearningsparql.com%2Fns%2Faddressbook&data=05%7C02%7CZlatareva%40ccsu.edu%7C59d36674f06f40d9c56308dc263e3868%7C2329c570b5804223803b427d800e81b6%7C0%7C0%7C638427296484686045%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=lEbwD883YTbHKSFKLMe5RfrcxQdM6gFaGzmmQKq9g8g%3D&reserved=0<http://learningsparql.com/ns/addressbook#>>>
SELECT ?last ?first ?courseName
FROM
<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.learningsparql.com%2F2ndeditionexamples%2Fex069.ttl&data=05%7C02%7CZlatareva%40ccsu.edu%7C59d36674f06f40d9c56308dc263e3868%7C2329c570b5804223803b427d800e81b6%7C0%7C0%7C638427296484689160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=bbO1MUImZpykHxCtogPjGCSlBVPK4CCmoz21Ea4me94%3D&reserved=0<http://www.learningsparql.com/2ndeditionexamples/ex069.ttl>>
WHERE
{
?s ab:firstName ?first ;
ab:lastName ?last ;
ab:takingCourse ?course .
?course ab:courseTitle ?courseName .
}
I am getting the following error
D:\neli\cs575Spring24>arq --query ex070mod2.rq
ERROR StatusLogger Reconfiguration failed: No configuration found for
'73d16e93' at 'null' in 'null'
org.apache.jena.riot.RiotException: Failed to determine the content type:
(URI=file:///D:/neli/cs575Spring24/ex070mod2.rq : stream=text/plain)
at org.apache.jena.riot.RDFParser.parseURI(RDFParser.java:380)
at org.apache.jena.riot.RDFParser.parse(RDFParser.java:360)
at
org.apache.jena.riot.RDFParserBuilder.parse(RDFParserBuilder.java:570)
at org.apache.jena.riot.RDFDataMgr.parseFromURI(RDFDataMgr.java:737)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:193)
at
org.apache.jena.sparql.util.DatasetUtils.addInGraphsWorker(DatasetUtils.java:200)
at
org.apache.jena.sparql.util.DatasetUtils.lambda$addInGraphs$0(DatasetUtils.java:181)
at org.apache.jena.system.Txn.exec(Txn.java:77)
at org.apache.jena.system.Txn.executeWrite(Txn.java:125)
at
org.apache.jena.sparql.util.DatasetUtils.addInGraphs(DatasetUtils.java:181)
at
org.apache.jena.sparql.util.DatasetUtils.createDatasetGraph(DatasetUtils.java:153)
at
org.apache.jena.sparql.util.DatasetUtils.createDatasetGraph(DatasetUtils.java:142)
at
org.apache.jena.sparql.engine.QueryEngineBase.prepareDataset(QueryEngineBase.java:82)
at
org.apache.jena.sparql.engine.QueryEngineBase.<init>(QueryEngineBase.java:58)
at
org.apache.jena.sparql.engine.main.QueryEngineMain.<init>(QueryEngineMain.java:45)
at
org.apache.jena.sparql.engine.main.QueryEngineMain$QueryEngineMainFactory.create(QueryEngineMain.java:89)
at
org.apache.jena.sparql.exec.QueryExecDataset.getPlan(QueryExecDataset.java:514)
at
org.apache.jena.sparql.exec.QueryExecDataset.startQueryIterator(QueryExecDataset.java:455)
at
org.apache.jena.sparql.exec.QueryExecDataset.execute(QueryExecDataset.java:170)
at
org.apache.jena.sparql.exec.QueryExecDataset.select(QueryExecDataset.java:164)
at
org.apache.jena.sparql.exec.QueryExecutionAdapter.execSelect(QueryExecutionAdapter.java:117)
at
org.apache.jena.sparql.exec.QueryExecutionCompat.execSelect(QueryExecutionCompat.java:99)
at
org.apache.jena.sparql.util.QueryExecUtils.doSelectQuery(QueryExecUtils.java:174)
at
org.apache.jena.sparql.util.QueryExecUtils.executeQuery(QueryExecUtils.java:106)
at arq.query.lambda$queryExec$0(query.java:239)
at org.apache.jena.system.Txn.exec(Txn.java:77)
at org.apache.jena.system.Txn.executeRead(Txn.java:115)
at arq.query.queryExec(query.java:236)
at arq.query.exec(query.java:159)
at org.apache.jena.cmd.CmdMain.mainMethod(CmdMain.java:87)
at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:56)
at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:43)
at arq.arq.main(arq.java:28)
Your help will be greatly appreciated. I just downloaded the latest version of
Apache-Jena and I am trying to run and test in command window.
Thank you so much.
Regards, Neli.
Neli P. Zlatareva, PhD
Professor of Computer Science
Department of Computer Science
Central Connecticut State University
New Britain, CT 06050
Phone: (860) 832-2723
Fax: (860) 832-2712
Web site: cs.ccsu.edu/~neli/