Java Code Examples for com.hp.hpl.jena.query.ResultSet#nextSolution()

The following examples show how to use com.hp.hpl.jena.query.ResultSet#nextSolution() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SPARQLExample.java    From GeoTriples with Apache License 2.0 7 votes vote down vote up
public static void main(String[] args) {
	ModelD2RQ m = new ModelD2RQ("file:doc/example/mapping-iswc.ttl");
	String sparql = 
		"PREFIX dc: <http://purl.org/dc/elements/1.1/>" +
		"PREFIX foaf: <http://xmlns.com/foaf/0.1/>" +
		"SELECT ?paperTitle ?authorName WHERE {" +
		"    ?paper dc:title ?paperTitle . " +
		"    ?paper dc:creator ?author ." +
		"    ?author foaf:name ?authorName ." +
		"}";
	Query q = QueryFactory.create(sparql); 
	ResultSet rs = QueryExecutionFactory.create(q, m).execSelect();
	while (rs.hasNext()) {
		QuerySolution row = rs.nextSolution();
		System.out.println("Title: " + row.getLiteral("paperTitle").getString());
		System.out.println("Author: " + row.getLiteral("authorName").getString());
	}
	m.close();
}
 
Example 2
Source File: SparqlQueryBase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public DataEntry getDataEntryFromRS(ResultSet rs) {
	DataEntry dataEntry = new DataEntry();
	QuerySolution soln = rs.nextSolution();
	String colName, value;
	boolean useColumnNumbers = this.isUsingColumnNumbers();
	/* for each column get the colName and colValue and add to the data entry */
	for (int i = 0; i < rs.getResultVars().size(); i++) {
		colName = rs.getResultVars().get(i);
		RDFNode node = soln.get(colName) ;  			
		if (node.isLiteral()) {
			value = convertRSToString(soln, colName);
		} else {
			value = soln.getResource(colName).getURI();
		}			
		dataEntry.addValue(useColumnNumbers ? Integer.toString(i + 1) : 
			colName, new ParamValue(value));
	}
	return dataEntry;
}
 
Example 3
Source File: SpecificAPIDataset.java    From aliada-tool with GNU General Public License v3.0 6 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, to get 
 * the URIs of the resources to use to discover links towards external datasets.
 *
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param graphName 			the graphName, null in case of default graph.
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @param query					the query to use to look for the resources.
 * @param offset				causes the solutions generated to start after the 
 *                              specified number of solutions.
 * @param limit					upper bound on the number of solutions returned.
 * @return a list of the matched URIs.
 * @since 2.0
 */
public ResourceToLink[] getResourcesToLink(final String sparqlEndpointURI, final String user, final String password, final String sparql, final Integer offset, final Integer limit) {
  	final ArrayList<ResourceToLink> resourcesList = new ArrayList<ResourceToLink>();
  	final String query = sparql + " OFFSET " + offset + " LIMIT " + limit;
       // Execute the query and obtain results
  	final ResultSet results = rdfstoreDAO.executeSelect(sparqlEndpointURI, user, password, query);
 	if (results != null){
           while (results.hasNext())
           {
           	final QuerySolution soln = results.nextSolution() ;
           	final Resource res = soln.getResource("res");
       		final String resURI = res.getURI();
           	final String textToSearch = soln.getLiteral("text").getString();
           	final ResourceToLink resToLink = new ResourceToLink(textToSearch, resURI);
       		resourcesList.add(resToLink);
           }
	}
	if (resourcesList.isEmpty()) {
		return new ResourceToLink[0];
	}
	return (ResourceToLink[]) resourcesList.toArray(new ResourceToLink[resourcesList.size()]);
}
 
Example 4
Source File: AliadaRDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 6 votes vote down vote up
public String crm2AliadaClass(final String crmClass) {
	final Query query = QueryFactory.create(CRM_TO_ALIADA_CLASS_P1 + crmClass + CRM_TO_ALIADA_CLASS_P2);
	ARQ.getContext().setTrue(ARQ.useSAX);
       
	QueryExecution execution = null;
	try {
		execution = QueryExecutionFactory.sparqlService("http://172.25.5.15:8890/sparql", query);
		execution.setTimeout(2000, 5000);
		final ResultSet results = execution.execSelect();
		//Iterating over the SPARQL Query results
		while (results.hasNext()) {
			QuerySolution soln = results.nextSolution();
			//Printing DBpedia entries' abstract.
			System.out.println(soln.get("?abstract"));   
			return soln.get("?abstract").asResource().getURI();
		}
		return "NULL";
       } finally {
       	try {
       		execution.close();
		} catch (Exception exception) {
			// TODO: handle exception
		}
       }

}
 
Example 5
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 6 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, 
 * to get the number of resources specified in the query argument.
 *
 * @param query					the query to execute to get the number of resources.  
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @return the number of resources.
 * @since 2.0
 */
public int getNumResources(final String query, final String sparqlEndpointURI, final String user, final String password) {
	int numRes = 0;
	try {
        // Execute the query and obtain results
        final QueryExecution qexec = QueryExecutionFactory.sparqlService(
        		sparqlEndpointURI, 
        		QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
        qexec.setTimeout(2000, 5000);
           final ResultSet results = qexec.execSelect() ;
           while (results.hasNext())
           {
           	final QuerySolution soln = results.nextSolution() ;
           	numRes = soln.getLiteral("count").getInt();
           }
        qexec.close() ;
      } catch (Exception exception) {
		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
	}
	return numRes;
}
 
Example 6
Source File: TrigKSTripleReader.java    From EventCoreference with Apache License 2.0 6 votes vote down vote up
public static ArrayList<Statement> readTriplesFromKs(String subjectUri, String sparqlQuery){

        ArrayList<Statement> triples = new ArrayList<Statement>();
        HttpAuthenticator authenticator = new SimpleAuthenticator(user, pass.toCharArray());
        try {
            qCount++;
            QueryExecution x = QueryExecutionFactory.sparqlService(serviceEndpoint, sparqlQuery, authenticator);
            ResultSet resultset = x.execSelect();
            while (resultset.hasNext()) {
                QuerySolution solution = resultset.nextSolution();
                String relString = solution.get("predicate").toString();
                RDFNode obj = solution.get("object");
                Model model = ModelFactory.createDefaultModel();
                Resource subj = model.createResource(subjectUri);
                Statement s = createStatement(subj, ResourceFactory.createProperty(relString), obj);
                triples.add(s);
            }
        } catch (Exception e) {
            //e.printStackTrace();
        }
        return triples;
    }
 
Example 7
Source File: TrigKSTripleReader.java    From EventCoreference with Apache License 2.0 6 votes vote down vote up
public static ArrayList<String> readEventIdsFromKs(String sparqlQuery)throws Exception {
    ArrayList<String> eventIds = new ArrayList<String>();
    //System.out.println("serviceEndpoint = " + serviceEndpoint);
    //System.out.println("sparqlQuery = " + sparqlQuery);
    //System.out.println("user = " + user);
    //System.out.println("pass = " + pass);
    HttpAuthenticator authenticator = new SimpleAuthenticator(user, pass.toCharArray());

    QueryExecution x = QueryExecutionFactory.sparqlService(serviceEndpoint, sparqlQuery, authenticator);
    ResultSet resultset = x.execSelect();
    while (resultset.hasNext()) {
        QuerySolution solution = resultset.nextSolution();
        //System.out.println("solution.toString() = " + solution.toString());
        //( ?event = <http://www.newsreader-project.eu/data/Dasym-Pilot/425819_relink_dominant.naf#ev24> )
        String currentEvent = solution.get("event").toString();
        //System.out.println("currentEvent = " + currentEvent);
        //http://www.newsreader-project.eu/data/Dasym-Pilot/425819_relink_dominant.naf#ev24
        if (!eventIds.contains(currentEvent)) {
            eventIds.add(currentEvent);
        }
    }
    return eventIds;
}
 
Example 8
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 5 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, 
 * to get the discovered links.
 *
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param graphName 			the graphName, null in case of default graph.
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @param offset				causes the solutions generated to start after 
 *                              the specified number of solutions.
 * @param limit					upper bound on the number of solutions returned.
 * @return a list of triples with the discovered links.
 * @since 2.0
 */
public Triple[] getDiscoveredLinks(final String sparqlEndpointURI, final String graphName, final String user, final String password, final int offset, final int limit) {
	final String query = "select * FROM <" + graphName + "> " + 
					"where {?source ?rel ?target }" +
					" ORDER BY ?source ?target" +
					" OFFSET " + offset + " LIMIT " + limit;
  	ArrayList<Triple> linksList = new ArrayList<Triple>();
 	try {
        // Execute the query and obtain results
        final QueryExecution qexec = QueryExecutionFactory.sparqlService(
        		sparqlEndpointURI, 
        		QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
        qexec.setTimeout(2000, 5000);
           final ResultSet results = qexec.execSelect() ;
           while (results.hasNext())
           {
           	final QuerySolution soln = results.nextSolution() ;
           	final Resource sourceResType = soln.getResource("source");
           	final Resource targetResType = soln.getResource("target");
           	final Resource relResType = soln.getResource("rel");
       		final Triple triple = new Triple(sourceResType.asNode(), relResType.asNode(), targetResType.asNode());
       		linksList.add(triple);
           }
        qexec.close() ;
      } catch (Exception exception) {
		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
	}
	if (linksList.isEmpty()) {
		return new Triple[0];
	}
	return (Triple[]) linksList.toArray(new Triple[linksList.size()]);
}
 
Example 9
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 5 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint,
 * to get the ambiguous discovered links.
 *
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param graphName 			the graphName, null in case of default graph.
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @param offset				causes the solutions generated to start after 
 *                              the specified number of solutions.
 * @param limit					upper bound on the number of solutions returned.
 * @return a list of {@link eu.aliada.shared.rdfstore.AmbiguousLink} with the ambiguous discovered links.
 * @since 2.0
 */
public AmbiguousLink[] getAmbiguousDiscoveredLinks(final String sparqlEndpointURI, final String graphName, final String user, final String password, final int offset, final int limit) {
	final String query = "SELECT ?localRes ?extResBegin (COUNT(?localRes) AS ?count) FROM <" + graphName + "> " + 
			" WHERE {?localRes ?rel ?extRes ." +
			" BIND( str(?extRes) as ?extResStr )." +
			" BIND( SUBSTR(?extResStr, 1,14) AS ?extResBegin)" +
			" }" +
			" GROUP BY ?localRes ?extResBegin" +
			" HAVING (COUNT(?localRes) > 1)" +
			" ORDER BY ?localRes" +
			" OFFSET " + offset + " LIMIT " + limit;
	
	ArrayList<AmbiguousLink> ambiguousLinksList = new ArrayList<AmbiguousLink>();
	try {
		// Execute the query and obtain results
		final QueryExecution qexec = QueryExecutionFactory.sparqlService(
				sparqlEndpointURI, 
				QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
		qexec.setTimeout(2000, 5000);
		final ResultSet results = qexec.execSelect() ;
		while (results.hasNext())
		{
			final QuerySolution soln = results.nextSolution() ;
	    	final Resource localRes = soln.getResource("localRes");
	    	final String extResBegin = soln.getLiteral("extResBegin").getString();
	    	final AmbiguousLink ambiguousLink = new AmbiguousLink();
	    	ambiguousLink.setSourceURI(localRes.getURI());
	    	getSourceURIAmbiguousLinks(ambiguousLink, localRes, extResBegin, sparqlEndpointURI, graphName, user, password);
	    	ambiguousLinksList.add(ambiguousLink);
	    }
	    qexec.close() ;
	  } catch (Exception exception) {
		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
	}
	if (ambiguousLinksList.isEmpty()) {
		return new AmbiguousLink[0];
	}
	return (AmbiguousLink[]) ambiguousLinksList.toArray(new AmbiguousLink[ambiguousLinksList.size()]);
}
 
Example 10
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 5 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, 
 * to get the number of ambiguous discovered links.
 *
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param graphName 			the graphName, null in case of default graph.
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @return the number of the ambiguous discovered links.
 * @since 2.0
 */
public int getNumAmbiguousDiscoveredLinks (final String sparqlEndpointURI, final String graphName, final String user, final String password) {
	final String query = "SELECT (COUNT(?localRes) AS ?count) FROM <" + graphName + "> " + 
					" WHERE {?localRes ?rel ?extRes ." +
					" BIND( str(?extRes) as ?extResStr )." +
					" BIND( SUBSTR(?extResStr, 1,14) AS ?extResBegin)" +
					" }" +
					" GROUP BY ?localRes ?extResBegin" +
					" HAVING (COUNT(?localRes) > 1)";

	int numLinks = 0;
	try {
        // Execute the query and obtain results
        final QueryExecution qexec = QueryExecutionFactory.sparqlService(
        		sparqlEndpointURI, 
        		QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
        qexec.setTimeout(2000, 5000);
           final ResultSet results = qexec.execSelect() ;
           while (results.hasNext())
           {
           	final QuerySolution soln = results.nextSolution() ;
           	numLinks = numLinks + soln.getLiteral("count").getInt();
           }
        qexec.close() ;
      } catch (Exception exception) {
		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
	}
	return numLinks;
}
 
Example 11
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 5 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, 
 * to get the ambiguous discovered links of a source URI.
 *
 * @param ambiguousLink			a {@link eu.aliada.shared.rdfstore.AmbiguousLink} that contains the source URI.  
 * @param localRes				the source resource of the link.  
 * @param extResBegin			the beginning string of the target link.  
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param graphName 			the graphName, null in case of default graph.
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @param offset				causes the solutions generated to start after 
 *                              the specified number of solutions.
 * @param limit					upper bound on the number of solutions returned.
 * @since 2.0
 */
public void getSourceURIAmbiguousLinks(final AmbiguousLink ambiguousLink, final Resource localRes, final String extResBegin, final String sparqlEndpointURI, final String graphName, final String user, final String password) {
	final String query = "SELECT ?rel ?extRes FROM <" + graphName + "> " + 
			" WHERE {<" + ambiguousLink.getSourceURI() + "> ?rel ?extRes ." +
			" FILTER regex(?extRes, \"^" + extResBegin + "\", \"i\")" +
			" }";
	try {
		// Execute the query and obtain results
		final QueryExecution qexec = QueryExecutionFactory.sparqlService(
				sparqlEndpointURI, 
				QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
		qexec.setTimeout(2000, 5000);
		final ResultSet results = qexec.execSelect() ;
		while (results.hasNext())
		{
			final QuerySolution soln = results.nextSolution() ;
	    	final Resource extRes = soln.getResource("extRes");
           	final Resource relResType = soln.getResource("rel");
           	final Triple triple = new Triple(localRes.asNode(), relResType.asNode(), extRes.asNode());
	    	ambiguousLink.addLink(triple);
	    }
	    qexec.close() ;
	  } catch (Exception exception) {
		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
	}
}
 
Example 12
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 5 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, 
 * to get the resources specified in the query argument.
 *
 * @param query					the query to execute to get the resources.  
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @param offset				causes the solutions generated to start after 
 *                              the specified number of solutions.
 * @param limit					upper bound on the number of solutions returned.
 * @return a list of {@link eu.aliada.shared.rdfstore.RetrievedResource} with the resources.
 * @since 2.0
 */
public RetrievedResource[] getResources(final String query, final String sparqlEndpointURI, final String user, final String password, final int offset, final int limit) {
	final ArrayList<RetrievedResource> resList = new ArrayList<RetrievedResource>();
 	try {
        // Execute the query and obtain results
        final QueryExecution qexec = QueryExecutionFactory.sparqlService(
        		sparqlEndpointURI, 
        		QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
        qexec.setTimeout(2000, 5000);
           final ResultSet results = qexec.execSelect() ;
           while (results.hasNext())
           {
           	final QuerySolution soln = results.nextSolution() ;
           	final Resource res = soln.getResource("res");
       		String name = "";
           	if(soln.contains("name")) {
           		name = soln.getLiteral("name").getString();
           	}
       		final RetrievedResource retrievedRes = new RetrievedResource(res.getURI(), name);
       		resList.add(retrievedRes);
           }
        qexec.close() ;
      } catch (Exception exception) {
		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
	}
	if (resList.isEmpty()) {
		return new RetrievedResource[0];
	}
	return (RetrievedResource[]) resList.toArray(new RetrievedResource[resList.size()]);
}
 
Example 13
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 4 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, to get the 
 * URIs of a type from ALIADA ontology.
 *
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @param typeLabel				the label value of the type to search for.
 * @return a list of URIs with the matched types.
 * @since 1.0
 */
public String[] getOntologyTypeURI(final String sparqlEndpointURI, final String user, final String password, final String typeLabel) {
	final String query = "select distinct ?type FROM <http://aliada-project.eu/2014/aliada-ontology#> " + 
					"where {?type a <http://www.w3.org/2004/02/skos/core#Concept> . " +
					"?type <http://www.w3.org/2004/02/skos/core#prefLabel> ?label . " +
					"FILTER regex(str(?label), \"^" + typeLabel + "$\")}";
	final ArrayList<String> typesList = new ArrayList<String>();
	QueryExecution qexec = null;
	try {
        // Execute the query and obtain results
  		qexec = QueryExecutionFactory.sparqlService(
  				sparqlEndpointURI, 
        		QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
           
        if (qexec instanceof QueryEngineHTTP) {
        	((QueryEngineHTTP)qexec).setTimeout(2000L, 5000L);
        }
        
        final ResultSet results = qexec.execSelect() ;
           while (results.hasNext()) {
           	final QuerySolution soln = results.nextSolution() ;
           	final Resource resType = soln.getResource("type");
       		final String type = resType.getURI();
       		typesList.add(type);
           }
  	} catch (Exception exception) {
  		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
  	} finally {
  		try {
			qexec.close();
		} catch (Exception e) {
			// Ignore
		}
  	}
 	
	if (typesList.isEmpty()) {
		return new String[0];
	}
	return (String[]) typesList.toArray(new String[typesList.size()]);
}
 
Example 14
Source File: RDFStoreDAO.java    From aliada-tool with GNU General Public License v3.0 4 votes vote down vote up
/**
 * It executes a SELECT SPARQL query on the SPARQL endpoint, 
 * to get the resources specified in the query argument.
 *
 * @param sparqlEndpointURI		the SPARQL endpoint URI.  
 * @param graphName 			the graphName, null in case of default graph.
 * @param user					the user name for the SPARQl endpoint.
 * @param password				the password for the SPARQl endpoint.
 * @param offset				causes the solutions generated to start after 
 *                              the specified number of solutions.
 * @param limit					upper bound on the number of solutions returned.
 * @return a list of {@link eu.aliada.shared.rdfstore.RetrievedResource} with the resources.
 * @since 2.0
 */
public RetrievedWork[] getWorks(final String sparqlEndpointURI, final String graphName, final String user, final String password, final int offset, final int limit) {
	final String query = " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" +
	" PREFIX ecrm:   <http://erlangen-crm.org/current/>" +
	" PREFIX efrbroo: <http://erlangen-crm.org/efrbroo/>" +
	" SELECT DISTINCT ?work ?expr ?manif ?title FROM <" + graphName + "> " +
	" WHERE { ?work rdf:type efrbroo:F1_Work . "+
	" ?work efrbroo:R40_has_representative_expression ?expr ." +
	" ?expr efrbroo:R4_carriers_provided_by ?manif ." +
	" ?manif ecrm:P102_has_title ?apel ." +
	" ?apel ecrm:P3_has_note ?title ." +
	" }" +
	" ORDER BY ?work ?expr ?manif" +
	" OFFSET " + offset + " LIMIT " + limit;

	ArrayList<RetrievedWork> resList = new ArrayList<RetrievedWork>();
 	try {
        // Execute the query and obtain results
        final QueryExecution qexec = QueryExecutionFactory.sparqlService(
        		sparqlEndpointURI, 
        		QueryFactory.create(query), 
				auth(sparqlEndpointURI, user, password));
        qexec.setTimeout(2000, 5000);
           final ResultSet results = qexec.execSelect() ;
           while (results.hasNext())
           {
           	final QuerySolution soln = results.nextSolution() ;
	    	final RetrievedWork retrievedRes = new RetrievedWork();
	    	retrievedRes.setWorkURI(soln.getResource("work").getURI());
	    	retrievedRes.setExprURI(soln.getResource("expr").getURI());
	    	retrievedRes.setManifURI(soln.getResource("manif").getURI());
	    	retrievedRes.setTitle(soln.getLiteral("title").getString());
       		
	    	String dimensions = "";
           	if(soln.contains("dimensions")) {
           		dimensions = soln.getLiteral("dimensions").getString();
           	}
	    	retrievedRes.setDimensions(dimensions);
       		
	    	String extension = "";
           	if(soln.contains("extension")) {
           		extension = soln.getLiteral("extension").getString();
           	}
	    	retrievedRes.setExtension(extension);
       		
	    	String author = "";
           	if(soln.contains("author")) {
           		author = soln.getLiteral("author").getString();
           	}
	    	retrievedRes.setAuthor(author);

	    	String publicPlace = "";
           	if(soln.contains("place_publication")) {
           		publicPlace = soln.getLiteral("place_publication").getString();
           	}
	    	retrievedRes.setPublicPlace(publicPlace);

	    	String publicDate = "";
           	if(soln.contains("date_publication")) {
           		publicDate = soln.getLiteral("date_publication").getString();
           	}
	    	retrievedRes.setPublicDate(publicDate);

	    	String edition = "";
           	if(soln.contains("edition")) {
           		edition = soln.getLiteral("edition").getString();
           	}
	    	retrievedRes.setEdition(edition);
       		
	    	resList.add(retrievedRes);
           }
        qexec.close() ;
      } catch (Exception exception) {
		LOGGER.error(MessageCatalog._00035_SPARQL_FAILED, exception, query);
	}
	if (resList.isEmpty()) {
		return new RetrievedWork[0];
	}
	return (RetrievedWork[]) resList.toArray(new RetrievedWork[resList.size()]);
}