Revision 48294
Added by Argiro Kokogiannaki almost 7 years ago
QueryGenerator.java | ||
---|---|---|
318 | 318 |
*/ |
319 | 319 |
private String createSemanticsType(String sourceType,String targetType){ |
320 | 320 |
String semantics=null; |
321 |
if((targetType.equals(ClaimUtils.PUBLICATION)||targetType.equals(ClaimUtils.DATASET))&&(sourceType.equals(ClaimUtils.PUBLICATION)||sourceType.equals(ClaimUtils.DATASET))){
|
|
322 |
semantics="resultResult_"+targetType+sourceType+"_isRelatedTo";
|
|
321 |
if((targetType.equals(ClaimUtils.PUBLICATION))&&(sourceType.equals(ClaimUtils.DATASET))){
|
|
322 |
semantics="resultResult_publicationDataset_isRelatedTo";
|
|
323 | 323 |
} |
324 |
else if(targetType.equals(ClaimUtils.DATASET)&&sourceType.equals(ClaimUtils.PUBLICATION)){ |
|
325 |
semantics="resultResult_publicationDataset_isRelatedTo"; |
|
326 |
} |
|
327 |
else if((targetType.equals(ClaimUtils.PUBLICATION))&&(sourceType.equals(ClaimUtils.PUBLICATION))){ |
|
328 |
semantics="resultResult_supplement_isSupplementedBy"; |
|
329 |
} |
|
330 |
else if(targetType.equals(ClaimUtils.DATASET)&&sourceType.equals(ClaimUtils.DATASET)){ |
|
331 |
semantics="resultResult_supplement_isSupplementTo"; |
|
332 |
} |
|
324 | 333 |
else if((targetType.equals(ClaimUtils.PUBLICATION)||targetType.equals(ClaimUtils.DATASET))&&(sourceType.equals(ClaimUtils.PROJECT))){ |
325 | 334 |
semantics= "resultProject_outcome_produces"; //"resultProject_outcome_isProducedBy"; |
326 | 335 |
} |
... | ... | |
446 | 455 |
" curated_by text,\n" + |
447 | 456 |
" approved boolean DEFAULT TRUE,\n" + |
448 | 457 |
" claim_status varchar(30),\n" + |
449 |
" semantics varchar(60)\n" + |
|
458 |
" semantics varchar(60) NOT NULL\n" +
|
|
450 | 459 |
");\n" + |
451 | 460 |
"\n" + |
452 | 461 |
"CREATE TABLE has_source_context(\n" + |
... | ... | |
939 | 948 |
return query; |
940 | 949 |
} |
941 | 950 |
|
951 |
public String generateCountClaimsForResultQuery(String resultId){ |
|
952 |
return " Select count(*) from claim where source_id = '"+ resultId +"' or target_id = '"+resultId+"' "; |
|
953 |
} |
|
954 |
public String generateSelectResultSource(String resultId){ |
|
955 |
return " Select collected_from from result where openaire_id = '"+ resultId +"' "; |
|
956 |
} |
|
957 |
|
|
942 | 958 |
/** |
943 | 959 |
* Select form a has_source_* or has_target_* table |
944 | 960 |
* ... |
... | ... | |
985 | 1001 |
String query =" "; |
986 | 1002 |
return " Select id, source_type, source_id, target_type, target_id from claim where id = ?::int and claimedBy = ? "; |
987 | 1003 |
} |
1004 |
|
|
988 | 1005 |
public String generateSelectClaimQuery(String id, ArrayList<Object> params){ |
989 | 1006 |
|
990 | 1007 |
params.add(id); |
Also available in: Unified diff
Delete file when claim is deleted and result has no other links| change semantics | change the openaireId generation