I am sorry Lorenz sir, here is the code.

String service = "http://dbpedia.org/sparql";;
   String query = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?label " +
           "WHERE {" +
            "<http://dbpedia.org/resource/Quatre_Bornes> <
http://dbpedia.org/ontology/country> ?y ."+
            "?y rdfs:label ?label ."+
            "FILTER (LANG(?label) = 'en')"+
           "}";
   QueryExecution qe = QueryExecutionFactory.sparqlService(service, query);
   try {
       ResultSet results = qe.execSelect();

       for (; results.hasNext();) {

           QuerySolution sol = (QuerySolution) results.next();

           System.out.println(sol.get("?abstract"));

       }

   }catch(Exception e){

       e.printStackTrace();
   }
   finally {

      qe.close();
   }
}

On Mon, Feb 29, 2016 at 3:19 PM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> And how can somebody help you without seeing the code? And where NULL is
> returned.
>
>
> I think it was the problem of not including the right prefix. I included
>> it, the error goes away but it just ouput "null". I do not know why, but
>> it
>> gives me the result at SPARQL endpoint, but in Jena, it shows null as
>> output.
>>
>> On Mon, Feb 29, 2016 at 12:30 PM, Andy Seaborne <a...@apache.org> wrote:
>>
>> What have you tried?
>>>
>>> Before firing off questions, try to solve basic java issues using google,
>>> stackoverflow etc.
>>>
>>> Caused by: java.net.UnknownHostException: dbpedia.org
>>>
>>> so it's a networking issue in your environment.
>>> Firewall, misconfigured DNS etc.
>>>
>>> Study the output of
>>>     nslookup dbpedia.org
>>>
>>>          Andy
>>>
>>>
>>> On 29/02/16 11:29, Lorenz B. wrote:
>>>
>>> It has to be http://dbpedia.org/sparql
>>>>
>>>> Hello I am getting this exception when I run jena against dbpedia.
>>>>
>>>>> What is
>>>>> the problem?
>>>>> ++++++++++++++++++++++++++++++++++
>>>>> :WARN No appenders could be found for logger
>>>>> (org.apache.jena.riot.system.stream.JenaIOEnvironment).
>>>>> log4j:WARN Please initialize the log4j system properly.
>>>>> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
>>>>> for
>>>>> more info.
>>>>> HttpException: java.net.UnknownHostException: dbpedia.org: Unexpected
>>>>> error
>>>>> making the query: java.net.UnknownHostException: dbpedia.org
>>>>> at
>>>>> com.hp.hpl.jena.sparql.engine.http.HttpQuery.rewrap(HttpQuery.java:417)
>>>>> at
>>>>>
>>>>> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:358)
>>>>> at
>>>>> com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:295)
>>>>> at
>>>>>
>>>>>
>>>>> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execResultSetInner(QueryEngineHTTP.java:346)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:338)
>>>>>
>>>>> at jenaclass.main(jenaclass.java:24)
>>>>> Caused by: java.net.UnknownHostException: dbpedia.org
>>>>> at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
>>>>> at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)
>>>>> at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
>>>>> at java.net.InetAddress.getAllByName0(Unknown Source)
>>>>> at java.net.InetAddress.getAllByName(Unknown Source)
>>>>> at java.net.InetAddress.getAllByName(Unknown Source)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:137)
>>>>>
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:118)
>>>>>
>>>>> at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1108)
>>>>>
>>>>>
>>>>> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>

Reply via email to