# HG changeset patch # User dwinter # Date 1325168437 -3600 # Node ID 290d859f036ba989f69eeabab9b919f4b70797d8 # Parent cdc4c12262b115344c19fa8ea85121ee505a8b2b ID search diff -r cdc4c12262b1 -r 290d859f036b protege.properties --- a/protege.properties Wed Dec 21 22:10:38 2011 +0100 +++ b/protege.properties Thu Dec 29 15:20:37 2011 +0100 @@ -1,5 +1,5 @@ #Protege Properties -#Thu Jul 14 22:42:24 CEST 2011 +#Wed Dec 21 16:29:30 CET 2011 +history.projects.reopen=file\:/Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/examples/newspaper/newspaper.pprj,file\:/Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/examples/sqwrl/SQWRLExamples.pprj,file\:/Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/examples/pizza/pizza.owl.pprj SwitchableClassDefinitionType=edu.stanford.smi.protegex.owl.ui.cls.LogicClassDefinitionWidgetType -history.projects.reopen=file\:/Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/examples/newspaper/newspaper.pprj,file\:/Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/examples/sqwrl/SQWRLExamples.pprj,file\:/Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/examples/pizza/pizza.owl.pprj OntURIBase=http\://www.owl-ontologies.com diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/IDQueryString --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/itgroup/nimanager/persons/IDQueryString Thu Dec 29 15:20:37 2011 +0100 @@ -0,0 +1,21 @@ +sparql + +select * +FROM +FROM +FROM +FROM +where { +{?person "%s". + +?ident ?person. +?gnd crm:P1_is_identified_by ?ident. + +optional {?person2 ?person. +?ident2 ?person2. +?objects crm:P1_is_identified_by ?ident2.} + +optional {?gnd ?birthDate.} +optional {?gnd ?deathDate.} +} +UNION {GRAPH {?person "%s"}}} \ No newline at end of file diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/IDQueryStringFull --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/itgroup/nimanager/persons/IDQueryStringFull Thu Dec 29 15:20:37 2011 +0100 @@ -0,0 +1,63 @@ +sparql + +select distinct * +FROM +FROM +FROM +FROM +where {{ +<%s> ?name. + +{{?ident <%s>. + +?gnd crm:P1_is_identified_by ?ident.} UNION { +?person2 <%s>. +?ident2 ?person2. +?gnd crm:P1_is_identified_by ?ident2. +}} + +optional {?gnd ?birthDate.} +optional {?gnd ?deathDate.} + +optional { {?gnd ?gndSame.} UNION +{?gndSame ?gnd.}} +} + +union + { +?person ?name. + +{{?ident ?person. + +<%s> crm:P1_is_identified_by ?ident.} UNION { +?person2 ?person. +?ident2 ?person2. +?gndSame crm:P1_is_identified_by ?ident2. +}} + +optional {<%s> ?birthDate.} +optional {<%s> ?deathDate.} + +{ {<%s> ?gndSame.} UNION +{?gndSame +<%s>.}} +} +union + +{ +?person ?name. + +?ident ?person. +?gnd crm:P1_is_identified_by ?ident. +?person2 ?person. +?ident2 ?person2. +<%s> crm:P1_is_identified_by ?ident2. + + +optional {?gnd ?birthDate.} +optional {?gnd ?deathDate.} + +optional { {?gnd ?gndSame.} UNION +{?gndSame ?gnd.}} +} +} \ No newline at end of file diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/IDQueryStringFull_tmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/itgroup/nimanager/persons/IDQueryStringFull_tmp Thu Dec 29 15:20:37 2011 +0100 @@ -0,0 +1,63 @@ +sparql + +select distinct * +FROM +FROM +FROM +FROM +where {{ + ?name. + +{{?ident . + +?gnd crm:P1_is_identified_by ?ident.} UNION { +?person2 . +?ident2 ?person2. +?gnd crm:P1_is_identified_by ?ident2. +}} + +optional {?gnd ?birthDate.} +optional {?gnd ?deathDate.} + +optional { {?gnd ?gndSame.} UNION +{?gndSame ?gnd.}} +} + +union + { +?person ?name. + +{{?ident ?person. + + crm:P1_is_identified_by ?ident.} UNION { +?person2 ?person. +?ident2 ?person2. + crm:P1_is_identified_by ?ident2. +}} + +optional { ?birthDate.} +optional { ?deathDate.} + +optional { { ?gndSame.} UNION +{?gndSame +.}} +} +union + +{ +?person ?name. + +?ident ?person. +?gnd crm:P1_is_identified_by ?ident. +?person2 ?person. +?ident2 ?person2. + crm:P1_is_identified_by ?ident2. + + +optional {?gnd ?birthDate.} +optional {?gnd ?deathDate.} + +optional { {?gnd ?gndSame.} UNION +{?gndSame ?gnd.}} +} +} \ No newline at end of file diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/PersonByIDService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/itgroup/nimanager/persons/PersonByIDService.java Thu Dec 29 15:20:37 2011 +0100 @@ -0,0 +1,421 @@ +package de.mpiwg.itgroup.nimanager.persons; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.net.URLDecoder; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.json.JSONArray; +import org.openrdf.model.Statement; +import org.openrdf.repository.RepositoryException; +import org.openrdf.repository.RepositoryResult; +import org.restlet.Context; +import org.restlet.data.ClientInfo; +import org.restlet.data.Form; +import org.restlet.data.MediaType; +import org.restlet.data.Status; +import org.restlet.engine.component.ChildContext; +import org.restlet.ext.json.JsonRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.resource.Get; +import org.restlet.resource.Options; +import org.restlet.resource.ServerResource; + +import de.mpiwg.itgroup.triplestoremanager.exceptions.TripleStoreHandlerException; +import de.mpiwg.itgroup.triplestoremanager.owl.TripleStoreHandler; + +import virtuoso.jdbc4.VirtuosoResultSet; + + +public class PersonByIDService extends ServerResource { + + private String VIRTUOSO_PW; + private String VIRTUOSO_USER; + private String virtuoso_server_url; + private String RELATION_FOR_NAME_SEARCH = "http://xmlns.com/foaf/0.1/name"; + private String PERSONS_CONTEXT; + private TripleStoreHandler th; + private Logger logger=Logger.getRootLogger(); + + public PersonByIDService() { + ChildContext context = (ChildContext)Context.getCurrent(); + virtuoso_server_url = context.getParameters().getFirstValue("de.mpwig.itgroup.personSearch.virtuoso.url"); + VIRTUOSO_PW = context.getParameters().getFirstValue("de.mpwig.itgroup.personSearch.virtuoso.pw"); + VIRTUOSO_USER = context.getParameters().getFirstValue("de.mpwig.itgroup.personSearch.virtuoso.user"); + PERSONS_CONTEXT = context.getParameters().getFirstValue("de.mpwig.itgroup.personSearch.virtuoso.personsGraphURI"); + //th = TripleStoreHandler.getInstance("jdbc:virtuoso://virtuoso.mpiwg-berlin.mpg.de:1111", "dba", "dba"); + try { + th = new TripleStoreHandler(virtuoso_server_url, VIRTUOSO_USER, VIRTUOSO_PW); + } catch (TripleStoreHandlerException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Options + public void doOptions(Representation entity) { + Form responseHeaders = (Form) getResponse().getAttributes().get( + "org.restlet.http.headers"); + if (responseHeaders == null) { + responseHeaders = new Form(); + getResponse().getAttributes().put("org.restlet.http.headers", + responseHeaders); + } + responseHeaders.add("Access-Control-Allow-Origin", "*"); + responseHeaders.add("Access-Control-Allow-Methods", "POST,OPTIONS,GET"); + responseHeaders.add("Access-Control-Allow-Headers", "Content-Type"); + responseHeaders.add("Access-Control-Allow-Credentials", "false"); + responseHeaders.add("Access-Control-Max-Age", "60"); + } + + public Representation getTest() { + return new StringRepresentation("TEST"); + } + + @Get("json") + public Representation getJson() { + Form responseHeaders = (Form) getResponse().getAttributes().get( + "org.restlet.http.headers"); + if (responseHeaders == null) { + responseHeaders = new Form(); + getResponse().getAttributes().put("org.restlet.http.headers", + responseHeaders); + } + responseHeaders.add("Access-Control-Allow-Origin", "*"); + + JSONArray resultsJsonArray = new JSONArray(); + try { + String id = (String) getRequest().getAttributes().get("name"); + id = URLDecoder.decode(id, "utf-8"); + + //InputStream is = getClass().getResourceAsStream("de/mpiwg/itgroup/nimanager/persons/personQueryString"); + InputStream is = getClass().getResourceAsStream("IDQueryString"); + Writer sw = new StringWriter(); + IOUtils.copy(is, sw,"utf-8"); + + String queryPersonWPMD=String.format(sw.toString(), id,id); + + java.sql.Statement smt = th.sqlCon.createStatement(); + + + smt.execute(queryPersonWPMD); + VirtuosoResultSet rs = (VirtuosoResultSet) smt.getResultSet(); + Map resultMap = new HashMap(); + while(rs.next()){ + if (rs.getString("person")!=null){ + resultMap.put("person",rs.getString("person")); + }else { + resultMap.put("person",""); + } + if (rs.getString("objects")!=null){ + resultMap.put("wikipedia",rs.getString("objects")); + } else { + resultMap.put("wikipedia",""); + } + if (rs.getString("gnd")!=null){ + resultMap.put("gnd",rs.getString("gnd")); + } else { + resultMap.put("gnd",""); + } + if (rs.getString("birthDate")!=null){ + resultMap.put("birthDate",rs.getString("birthDate")); + } else { + resultMap.put("birthDate",""); + } + if (rs.getString("deathDate")!=null){ + resultMap.put("deathDate",rs.getString("deathDate")); + } else { + resultMap.put("deathDate",""); + } + resultMap.put("name",id); + resultsJsonArray.put(resultMap); + } + + return new JsonRepresentation(resultsJsonArray); + + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL, "REPOSITORY ERROR"); + return new JsonRepresentation(new JSONArray()); + + } catch (SQLException e) { + + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL, "REPOSITORY SQL ERROR"); + return new JsonRepresentation(new JSONArray()); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL); + return new JsonRepresentation(new JSONArray()); + } + + + } + + @Get("xml") + public Representation getXML() { + List supported=new ArrayList(); + supported.add(MediaType.APPLICATION_JSON); + + ClientInfo ci = getRequest().getClientInfo(); + + if(ci==null){ //don't know why this can happen, but sometimes does + setStatus(Status.SERVER_ERROR_INTERNAL); + return null; + } + MediaType types = getRequest().getClientInfo().getPreferredMediaType(supported); + if (types.equals(MediaType.APPLICATION_JSON)) + return getJson(); + + try { + String id = (String) getRequest().getAttributes().get("name"); + id = URLDecoder.decode(id, "utf-8"); + RepositoryResult statements = th.getStatements(null, + th.createUri(RELATION_FOR_NAME_SEARCH), + th.createLiteral(id, "en"), PERSONS_CONTEXT); + String ret = ""; + while (statements.hasNext()) { + Statement statement = statements.next(); + ret += ""; + } + ret += ""; + + return new StringRepresentation(ret, MediaType.TEXT_XML); + + } catch (RepositoryException e) { + + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL, "REPOSITORY ERROR"); + return new StringRepresentation( + "Repository Error", + MediaType.TEXT_XML); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL, "REPOSITORY ERROR"); + return new StringRepresentation( + "Unsupported encoding", + MediaType.TEXT_XML); + } + } + + @Get("html") + public Representation getHTML() { + + List supported=new ArrayList(); + supported.add(MediaType.APPLICATION_JSON); + + ClientInfo ci = getRequest().getClientInfo(); + + if(ci==null){ //don't know why this can happen, but sometimes does + setStatus(Status.SERVER_ERROR_INTERNAL); + return null; + } + MediaType types = ci.getPreferredMediaType(supported); + if (types!=null) + if (types.equals(MediaType.APPLICATION_JSON)) + return getJson(); + + Form responseHeaders = (Form) getResponse().getAttributes().get( + "org.restlet.http.headers"); + if (responseHeaders == null) { + responseHeaders = new Form(); + getResponse().getAttributes().put("org.restlet.http.headers", + responseHeaders); + } + responseHeaders.add("Access-Control-Allow-Origin", "*"); + try { + Form form = getRequest().getResourceRef().getQueryAsForm(); + + + String id =form.getValuesMap().get("id"); + if (id==null) + { + InputStream is = getClass().getResourceAsStream("SearchPersonsByIDNoParameterInfo.html"); + Writer sw = new StringWriter(); + IOUtils.copy(is, sw,"utf-8"); + return new StringRepresentation(sw.toString(),MediaType.TEXT_HTML); + } + + id = URLDecoder.decode(id, "utf-8"); + id=StringUtils.stripEnd(id, null); + id=StringUtils.stripStart(id, null); + InputStream is = getClass().getResourceAsStream("IDQueryStringFull"); + Writer sw = new StringWriter(); + IOUtils.copy(is, sw,"utf-8"); + + String queryPersonWPMD=String.format(sw.toString(), id,id,id,id,id,id,id,id,id,id); + logger.debug("personIDservice getHTML:"+queryPersonWPMD); + java.sql.Statement smt = th.sqlCon.createStatement(); + + + smt.execute(queryPersonWPMD); + VirtuosoResultSet rs = (VirtuosoResultSet) smt.getResultSet(); + + + String person=id; + String bd=""; + String dd=""; + String name=""; + String ret = ""; + + List alternateMPIWGAdresses = new ArrayList(); + + while(rs.next()){ + + String personNew= rs.getString("person"); // setzte Geburtsdatum, falls noch nicht geschehen + if (personNew!=null){ + person=personNew; + } + + String gnd= rs.getString("gnd"); + + String bdNew= rs.getString("birthDate"); // setzte Geburtsdatum, falls noch nicht geschehen + if (bdNew!=null && bd.equals("")){ + bd=bdNew; + } + String nameNew= rs.getString("name"); // setzte Geburtsdatum, falls noch nicht geschehen + if (nameNew!=null && name.equals("")){ + name=nameNew; + } + String ddNew= rs.getString("deathDate"); // setzte Todesdatum, falls noch nicht geschehen + if (ddNew!=null && dd.equals("")){ + dd=ddNew; + } + + String person2=rs.getString("person2"); // get alternative MPIWG ID + if (person2!=null){ + alternateMPIWGAdresses.add(person2); + } + ret+=String.format("
  • external ID:%s
  • ",gnd,gnd); + + String sameID = rs.getString("gndSame"); + if (sameID!=null){ + ret+=String.format("
  • external ID: %s
  • ",sameID,sameID); + } + } + + ret = "
    "+ + String.format("
    %s (%s-%s)
    ",name,bd,dd)+ + String.format("
    MPIWG ID:%s
      ",person,person)+ + ret+ + "
    "; + if(alternateMPIWGAdresses.size()>0){ + ret+="
    Alternative MPIWG addresses (don't use)
      "; + for (String alt: alternateMPIWGAdresses){ + ret+=String.format("
    • %s
    • ",alt,alt); + } + ret+="
    "; + } + + ret+="
    "; + + return new StringRepresentation(ret, MediaType.TEXT_HTML); + + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL, "REPOSITORY ERROR"); + return new StringRepresentation( + "Unsupported encoding", + MediaType.TEXT_HTML); + } catch (SQLException e) { + + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL, "REPOSITORY SQL ERROR"); + return new StringRepresentation( + "REPOSITORY SQL ERROR", + MediaType.TEXT_HTML); + } catch (IOException e) { + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL); + return null; + } + } + + public List> getMaps(String id){ + ArrayList> retList = new ArrayList>(); + try { + + + //InputStream is = getClass().getResourceAsStream("de/mpiwg/itgroup/nimanager/persons/personQueryString"); + InputStream is = getClass().getResourceAsStream("IDQueryString"); + Writer sw = new StringWriter(); + IOUtils.copy(is, sw,"utf-8"); + + String queryPersonWPMD=String.format(sw.toString(), id,id); + + java.sql.Statement smt = th.sqlCon.createStatement(); + + + smt.execute(queryPersonWPMD); + VirtuosoResultSet rs = (VirtuosoResultSet) smt.getResultSet(); + Map resultMap = new HashMap(); + while(rs.next()){ + if (rs.getString("person")!=null){ + resultMap.put("person",rs.getString("person")); + }else { + resultMap.put("person",""); + } + if (rs.getString("objects")!=null){ + resultMap.put("wikipedia",rs.getString("objects")); + } else { + resultMap.put("wikipedia",""); + } + if (rs.getString("gnd")!=null){ + resultMap.put("gnd",rs.getString("gnd")); + } else { + resultMap.put("gnd",""); + } + if (rs.getString("birthDate")!=null){ + resultMap.put("birthDate",rs.getString("birthDate")); + } else { + resultMap.put("birthDate",""); + } + if (rs.getString("deathDate")!=null){ + resultMap.put("deathDate",rs.getString("deathDate")); + } else { + resultMap.put("deathDate",""); + } + resultMap.put("name",id); + retList.add(resultMap); + } + + return retList; + + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + + return null; + + } catch (SQLException e) { + + e.printStackTrace(); + + return null; + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + setStatus(Status.SERVER_ERROR_INTERNAL); + return null; + } + + + + + } + +} diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/PersonByNameService.java --- a/src/de/mpiwg/itgroup/nimanager/persons/PersonByNameService.java Wed Dec 21 22:10:38 2011 +0100 +++ b/src/de/mpiwg/itgroup/nimanager/persons/PersonByNameService.java Thu Dec 29 15:20:37 2011 +0100 @@ -101,7 +101,7 @@ Writer sw = new StringWriter(); IOUtils.copy(is, sw,"utf-8"); - String queryPersonWPMD=String.format(sw.toString(), id); + String queryPersonWPMD=String.format(sw.toString(), id,id); java.sql.Statement smt = th.sqlCon.createStatement(); @@ -238,11 +238,11 @@ String id = (String) getRequest().getAttributes().get("name"); id = URLDecoder.decode(id, "utf-8"); - InputStream is = getClass().getResourceAsStream("personQueryString"); + InputStream is = getClass().getResourceAsStream("personQueryStringFull"); Writer sw = new StringWriter(); IOUtils.copy(is, sw,"utf-8"); - String queryPersonWPMD=String.format(sw.toString(), id); + String queryPersonWPMD=String.format(sw.toString(), id,id); java.sql.Statement smt = th.sqlCon.createStatement(); @@ -250,18 +250,55 @@ smt.execute(queryPersonWPMD); VirtuosoResultSet rs = (VirtuosoResultSet) smt.getResultSet(); - String ret = "
    "; + + String person=""; + String bd=""; + String dd=""; + + String ret = ""; + + List alternateMPIWGAdresses = new ArrayList(); + while(rs.next()){ - String person= rs.getString("person"); + person= rs.getString("person"); String gnd= rs.getString("gnd"); - String bd= rs.getString("birthDate"); - String dd= rs.getString("deathDate"); - - ret+=String.format("",gnd,id,bd,dd); - ret+=String.format("",person,person); + + + String bdNew= rs.getString("birthDate"); // setzte Geburtsdatum, falls noch nicht geschehen + if (bdNew!=null && bd.equals("")){ + bd=bdNew; + } + String ddNew= rs.getString("deathDate"); // setzte Todesdatum, falls noch nicht geschehen + if (ddNew!=null && dd.equals("")){ + dd=ddNew; + } + + String person2=rs.getString("person2"); // get alternative MPIWG ID + if (person2!=null){ + alternateMPIWGAdresses.add(person2); + } + ret+=String.format("
  • external ID:%s
  • ",gnd,gnd); + + String sameID = rs.getString("gndSame"); + if (sameID!=null){ + ret+=String.format("
  • external ID: %s
  • ",sameID,sameID); + } } - ret += "
    "; + ret = "
    "+ + String.format("
    %s (%s-%s)
    ",id,bd,dd)+ + String.format("
    MPIWG ID:%s
      ",person,person)+ + ret+ + "
    "; + if(alternateMPIWGAdresses.size()>0){ + ret+="
    Alternative MPIWG addresses (don't use)
      "; + for (String alt: alternateMPIWGAdresses){ + ret+=String.format("
    • %s
    • ",alt,alt); + } + ret+="
    "; + } + + ret+="
    "; return new StringRepresentation(ret, MediaType.TEXT_HTML); @@ -295,7 +332,7 @@ Writer sw = new StringWriter(); IOUtils.copy(is, sw,"utf-8"); - String queryPersonWPMD=String.format(sw.toString(), id); + String queryPersonWPMD=String.format(sw.toString(), id,id); java.sql.Statement smt = th.sqlCon.createStatement(); diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/SearchPersonsByIDNoParameterInfo.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/itgroup/nimanager/persons/SearchPersonsByIDNoParameterInfo.html Thu Dec 29 15:20:37 2011 +0100 @@ -0,0 +1,23 @@ + + + +NO ID given + + +

    Search Person by ID

    +

    You have to supply a parameter id!

    +

    This services searches the MPIWG authority server for id of person names. +

    This can be either +

    +

    +

    Search: +

    id:
    +

    + + + \ No newline at end of file diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/personQueryString --- a/src/de/mpiwg/itgroup/nimanager/persons/personQueryString Wed Dec 21 22:10:38 2011 +0100 +++ b/src/de/mpiwg/itgroup/nimanager/persons/personQueryString Thu Dec 29 15:20:37 2011 +0100 @@ -18,4 +18,4 @@ optional {?gnd ?birthDate.} optional {?gnd ?deathDate.} } -UNION {GRAPH {?person "Einstein, Albert"}}} \ No newline at end of file +UNION {GRAPH {?person "%s"}}} \ No newline at end of file diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/personQueryStringFull --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/itgroup/nimanager/persons/personQueryStringFull Thu Dec 29 15:20:37 2011 +0100 @@ -0,0 +1,24 @@ +sparql + +select distinct * +FROM +FROM +FROM +FROM +where {{ +?person "%s". + +{{?ident ?person. ?gnd crm:P1_is_identified_by ?ident.} UNION { +?person2 ?person. +?ident2 ?person2. +?gnd crm:P1_is_identified_by ?ident2. +}} + +optional {?gnd ?birthDate.} +optional {?gnd ?deathDate.} + +optional { {?gnd ?gndSame.} UNION +{?gndSame ?gnd.}} +} +UNION {GRAPH {?person "%s"}} +} \ No newline at end of file diff -r cdc4c12262b1 -r 290d859f036b src/de/mpiwg/itgroup/nimanager/persons/personQueryStringFull_altern --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/itgroup/nimanager/persons/personQueryStringFull_altern Thu Dec 29 15:20:37 2011 +0100 @@ -0,0 +1,26 @@ +sparql + +select * +FROM +FROM +FROM +FROM +where { +{?person "%s". + +?ident ?person. +?gnd crm:P1_is_identified_by ?ident. + +optional {?person2 ?person. +?ident2 ?person2. +?objects crm:P1_is_identified_by ?ident2.} + +optional {?gnd ?birthDate.} +optional {?gnd ?deathDate.} + +{ {?gnd ?gndSame.} UNION +{?gndSame ?gnd.} UNION +{?objects ?gndSame.} UNION +{?gndSame ?objects.}} +} +UNION {GRAPH {?person "%s"}}} \ No newline at end of file