Revision 40097
Added by Argiro Kokogiannaki over 8 years ago
TestClass.java | ||
---|---|---|
5 | 5 |
*/ |
6 | 6 |
|
7 | 7 |
|
8 |
import eu.dnetlib.data.claimsDemo.eu.dnetlib.data.claims.migration.Claim; |
|
8 |
//import eu.dnetlib.data.claimsDemo.eu.dnetlib.data.claims.migration.Claim; |
|
9 |
import eu.dnetlib.data.claimsDemo.eu.dnetlib.data.claims.migration.ClaimGenerics; |
|
10 |
import eu.dnetlib.data.claimsDemo.eu.dnetlib.data.claims.migration.JsonldBuilder; |
|
9 | 11 |
import eu.dnetlib.data.claimsDemo.eu.dnetlib.data.claims.migration.Result; |
10 | 12 |
import org.apache.log4j.BasicConfigurator; |
11 | 13 |
import org.apache.log4j.Logger; |
... | ... | |
69 | 71 |
//id : 169149 type : rels2actions reltype : resultResult_datasetpublication_isRelatedTo |
70 | 72 |
// id : 169480 type : rels2actions reltype : resultProject |
71 | 73 |
// id : 169503 type : rels2actions reltype : resultResult_publicationdataset_isRelatedTo |
72 |
ResultSet rs=sqlDAO.executePreparedQuery("Select * from claims limit 15");
|
|
74 |
ResultSet rs=sqlDAO.executePreparedQuery("Select * from claims limit 1"); |
|
73 | 75 |
//ResultSet rs=sqlDAO.executePreparedQuery(sqlDAO.getQueryGenerator().selectClaimById("169480")); |
74 | 76 |
while(rs.next()){ |
75 | 77 |
String claimType=rs.getString("type"); |
76 | 78 |
String xml=rs.getString("xml"); |
77 | 79 |
if(claimType!=null && claimType.equals("rels2actions")){ |
78 | 80 |
log.info("*Relation *"); |
79 |
log.info(claimOperations.getRelationClaim(rs).toString());
|
|
81 |
log.info(JsonldBuilder.toJsonld(claimOperations.getRelationClaim(rs)));
|
|
80 | 82 |
}else{ |
83 |
//type ="dmf2actions" |
|
81 | 84 |
if(xml!=null && xml.contains("<oaf:concept")){ |
82 | 85 |
log.info("* Context *"); |
83 | 86 |
log.info(claimOperations.getConceptDMFClaim(rs).toString()); |
... | ... | |
92 | 95 |
public void getRelationClaims() throws Exception { |
93 | 96 |
ResultSet rs=sqlDAO.executePreparedQuery(sqlDAO.getQueryGenerator().selectRelationClaims(1)); |
94 | 97 |
while(rs.next()){ |
95 |
Claim claim = claimOperations.getRelationClaim(rs); |
|
98 |
ClaimGenerics<Object,Result> claim = claimOperations.getRelationClaim(rs);
|
|
96 | 99 |
log.info(claim.toString()); |
97 | 100 |
} |
98 | 101 |
} |
... | ... | |
109 | 112 |
ResultSet rs=sqlDAO.executePreparedQuery(sqlDAO.getQueryGenerator().selectConceptDMFClaims(1)); |
110 | 113 |
while(rs.next()){ |
111 | 114 |
log.info(rs.getString("xml")); |
112 |
Claim claim=claimOperations.getConceptDMFClaim(rs); |
|
115 |
ClaimGenerics<Object,Result> claim=claimOperations.getConceptDMFClaim(rs);
|
|
113 | 116 |
log.info(claim.toString()); |
114 | 117 |
} |
115 | 118 |
} |
Also available in: Unified diff
Use class claimGenerics in ParsingClaimUtils and Test