本文整理汇总了Java中org.openprovenance.prov.model.WasGeneratedBy类的典型用法代码示例。如果您正苦于以下问题:Java WasGeneratedBy类的具体用法?Java WasGeneratedBy怎么用?Java WasGeneratedBy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WasGeneratedBy类属于org.openprovenance.prov.model包,在下文中一共展示了WasGeneratedBy类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addGenerations
import org.openprovenance.prov.model.WasGeneratedBy; //导入依赖的package包/类
protected void addGenerations(Connection connection, String query, int param)
throws SQLException, QueryException {
assert (connection != null);
assert (query != null);
assert (param != -1);
l.debug("Entering addGenerations()");
PreparedStatement generatedStmt = null;
ResultSet resultSet = null;
try {
generatedStmt = connection.prepareStatement(query);
generatedStmt.setInt(1, param);
resultSet = generatedStmt.executeQuery();
while (resultSet.next()) {
String genID = resultSet.getString("generation_id");
int activityID = resultSet.getInt("activity_id");
int entityID = resultSet.getInt("entity_id");
String location = resultSet.getString("location");
java.sql.Timestamp usedTime = resultSet.getTimestamp("generation_time");
// check whether the relationship already exists, if yes, don't add it again
String activityEntityId = getActivityEntityId(activityID, entityID);
if (relationships.get(activityEntityId) != null) {
continue;
}
Activity activity = activities.get(activityID);
if (activity == null) {
// this is a new activity, so populate it
createActivity(connection, PROVSqlQuery.GET_ACTIVITIES_BY_ACTIVITY_ID, "" + activityID);
// now the activity must be in the map
activity = activities.get(activityID);
unexpandedNodes.push(new GraphNode(GraphNode.NodeType.ACTIVITY, activityID));
}
Entity entity = entities.get(entityID);
if (entity == null) {
// this is a new entity, so populate it
entities.put(entityID, createEntity("" + entityID, connection));
// now the entity must be in the map
entity = entities.get(entityID);
unexpandedNodes.push(new GraphNode(GraphNode.NodeType.ENTITY, entityID));
}
WasGeneratedBy wasGeneratedBy = pFactory.newWasGeneratedBy(
getIdQName(QueryConstants.GENERATION_IDENTIFIER + genID),
entity.getId(), activity.getId());
if (infoDetailLevel != null && infoDetailLevel.equals(DetailEnumType.FINE)) {
// add attributes
if (location != null) {
wasGeneratedBy.getLocation().add(pFactory.newLocation(location, Name.QNAME_XSD_STRING));
// TODO : check Role
}
if (usedTime != null) {
org.openprovenance.prov.xml.Other timeAtt = pFactory.newOther(getKomaduAttQName("generation-time"),
usedTime, Name.QNAME_XSD_DATETIME);
pFactory.addAttribute(wasGeneratedBy, timeAtt);
}
// add external attributes too
addCustomAttributes(PROVSqlQuery.GET_EXE_GENERATION_ATTRIBUTES_BY_ID,
genID, wasGeneratedBy, connection);
}
// add the used element into the list of relationships
relationships.put(activityEntityId, wasGeneratedBy);
}
l.debug("addGenerations() successful");
} catch (SQLException e) {
l.error("Exiting addGenerations() with error");
l.error(e.toString());
} finally {
if (generatedStmt != null) {
generatedStmt.close();
}
if (resultSet != null) {
resultSet.close();
}
}
}
示例2: addGenerations
import org.openprovenance.prov.model.WasGeneratedBy; //导入依赖的package包/类
private void addGenerations(Connection connection,
HashMap<String, Activity> activities,
HashMap<String, Entity> entities,
List<Statement> relationships,
String contextWorkflowURI,
DetailEnumType.Enum informationDetailLevel) throws SQLException {
assert (connection != null);
assert (contextWorkflowURI != null);
l.debug("Entering addGenerations()");
PreparedStatement generatedStmt = null;
ResultSet resultSet = null;
try {
generatedStmt = connection.prepareStatement(PROVSqlQuery.GET_PROV_GENERATIONS);
generatedStmt.setString(1, contextWorkflowURI);
generatedStmt.setString(2, contextWorkflowURI);
resultSet = generatedStmt.executeQuery();
while (resultSet.next()) {
String genID = resultSet.getString(1);
String activityID = QueryConstants.ACTIVITY_IDENTIFIER + resultSet.getString(2);
String entityID = resultSet.getString(3);
String location = resultSet.getString(4);
java.sql.Timestamp usedTime = resultSet.getTimestamp(5);
Activity activity = activities.get(activityID);
Entity entity = entities.get(entityID);
if (activity == null || entity == null) {
l.error("Activity or Entity is null. Inconsistent WasGeneratedBy relationship..");
return;
}
WasGeneratedBy wasGeneratedBy = pFactory.newWasGeneratedBy(getIdQName(genID),
entity.getId(), activity.getId());
if (informationDetailLevel != null
&& informationDetailLevel.equals(DetailEnumType.FINE)) {
// add attributes
if (location != null) {
wasGeneratedBy.getLocation().add(pFactory.newLocation(location, Name.QNAME_XSD_STRING));
// TODO : check Role
}
if (usedTime != null) {
Other timeAtt = pFactory.newOther(getKomaduAttQName("generation-time"),
usedTime, Name.QNAME_XSD_DATETIME);
pFactory.addAttribute(wasGeneratedBy, timeAtt);
}
// add external attributes too
addCustomAttributes(PROVSqlQuery.GET_EXE_GENERATION_ATTRIBUTES_BY_ID,
genID, wasGeneratedBy, connection);
}
// add the used element into the list of relationships
relationships.add(wasGeneratedBy);
}
l.debug("addGenerations() successful");
} catch (SQLException e) {
l.error("Exiting addGenerations() with error");
l.error(e.toString());
} finally {
if (generatedStmt != null) {
generatedStmt.close();
}
if (resultSet != null) {
resultSet.close();
}
}
}