当前位置: 首页>>代码示例>>Java>>正文


Java Used类代码示例

本文整理汇总了Java中org.openprovenance.prov.model.Used的典型用法代码示例。如果您正苦于以下问题:Java Used类的具体用法?Java Used怎么用?Java Used使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Used类属于org.openprovenance.prov.model包,在下文中一共展示了Used类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newObsoleteProv

import org.openprovenance.prov.model.Used; //导入依赖的package包/类
public static Document newObsoleteProv(final User editor, final String lvlId) {
	final String lvlId2 = parseParam(lvlId);
	checkArgument(editor != null, "Uninitialized editor");
	checkArgument(isNotBlank(editor.getUserid()), "Uninitialized user Id");
	checkArgument(isNotBlank(editor.getProvider()), "Uninitialized identity provider");

	final Document graph = newProvDocument();
	final Bundle bundle = getBundle(graph);
	final Agent system = getSystem(bundle);

	// edit activity
	final Agent curatorAgent = PROVENANCE.personAgent(editor);
	final Entity entObj1 = PROVENANCE.entity(LVL_PREFIX, lvlId2);
	final Activity invalidateAct = PROVENANCE.factory().newActivity(PROVENANCE.qn("invalidate"));
	final Role curatorRole = PROVENANCE.factory().newRole("Curator", PROVENANCE.qn("Curator"));
	final Used usedObject = PROVENANCE.factory().newUsed(null, invalidateAct.getId(), entObj1.getId());
	PROVENANCE.factory().addRole(usedObject, curatorRole);
	bundle.getStatement().addAll(asList(curatorAgent, invalidateAct, entObj1,
			PROVENANCE.factory().newActedOnBehalfOf(null, curatorAgent.getId(), system.getId()),
			PROVENANCE.factory().newWasAssociatedWith(null, invalidateAct.getId(), curatorAgent.getId()),
			usedObject,
			PROVENANCE.factory().newWasInvalidatedBy(null, entObj1.getId(), invalidateAct.getId(), PROVENANCE.factory().newTimeNow(), null)
			));
	return graph;
}
 
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:26,代码来源:ProvFactory.java

示例2: newReleaseProv

import org.openprovenance.prov.model.Used; //导入依赖的package包/类
public static Document newReleaseProv(final User editor, final String lvlId, final String original, final String revision) {
	final String lvlId2 = parseParam(lvlId);
	checkArgument(editor != null, "Uninitialized editor");
	checkArgument(isNotBlank(editor.getUserid()), "Uninitialized user Id");
	checkArgument(isNotBlank(editor.getProvider()), "Uninitialized identity provider");

	final Document graph = newProvDocument();
	final Bundle bundle = getBundle(graph);
	final Agent system = getSystem(bundle);

	// edit activity
	final Agent curatorAgent = PROVENANCE.personAgent(editor);
	final Entity entObj1 = PROVENANCE.entity(LVL_PREFIX, lvlId2 + original);
	final Entity entObj2 = PROVENANCE.entity(LVL_PREFIX, lvlId2 + revision);
	final Activity editAct = PROVENANCE.factory().newActivity(PROVENANCE.qn("edit"));
	final Role curatorRole = PROVENANCE.factory().newRole("Curator", PROVENANCE.qn("Curator"));
	final Used usedObject = PROVENANCE.factory().newUsed(null, editAct.getId(), entObj1.getId());
	PROVENANCE.factory().addRole(usedObject, curatorRole);
	bundle.getStatement().addAll(asList(curatorAgent, editAct, entObj1, entObj2,
			PROVENANCE.factory().newActedOnBehalfOf(null, curatorAgent.getId(), system.getId()),
			PROVENANCE.factory().newWasAssociatedWith(null, editAct.getId(), curatorAgent.getId()),
			usedObject,
			PROVENANCE.factory().newWasInvalidatedBy(null, entObj1.getId(), editAct.getId()),
			PROVENANCE.factory().newWasGeneratedBy(null, entObj2.getId(), editAct.getId(), PROVENANCE.factory().newTimeNow(), null),
			PROVENANCE.factory().newWasDerivedFrom(null, entObj2.getId(), entObj1.getId(), editAct.getId(), null, null, null)
			));
	return graph;
}
 
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:29,代码来源:ProvFactory.java

示例3: addUsages

import org.openprovenance.prov.model.Used; //导入依赖的package包/类
protected void addUsages(Connection connection, String query, int param)
        throws SQLException, QueryException {
    assert (connection != null);
    assert (query != null);
    assert (param != -1);
    l.debug("Entering addUsages()");

    PreparedStatement usedStmt = null;
    ResultSet resultSet = null;

    try {
        usedStmt = connection.prepareStatement(query);
        usedStmt.setInt(1, param);
        resultSet = usedStmt.executeQuery();

        while (resultSet.next()) {
            String usageID = resultSet.getString("usage_id");
            int activityID = resultSet.getInt("activity_id");
            int entityID = resultSet.getInt("entity_id");
            String location = resultSet.getString("location");
            java.sql.Timestamp usedTime = resultSet.getTimestamp("usage_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 usedActivity = activities.get(activityID);
            if (usedActivity == 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
                usedActivity = activities.get(activityID);
                unexpandedNodes.push(new GraphNode(GraphNode.NodeType.ACTIVITY, activityID));
            }
            Entity usedEntity = entities.get(entityID);
            if (usedEntity == null) {
                // this is a new entity, so populate it
                entities.put(entityID, createEntity("" + entityID, connection));
                // now the entity must be in the map
                usedEntity = entities.get(entityID);
                unexpandedNodes.push(new GraphNode(GraphNode.NodeType.ENTITY, entityID));
            }
            Used used = pFactory.newUsed(getIdQName(QueryConstants.USAGE_IDENTIFIER + usageID),
                    usedActivity.getId(), usedEntity.getId());

            if (infoDetailLevel != null && infoDetailLevel.equals(DetailEnumType.FINE)) {
                // add attributes
                if (location != null) {
                    used.getLocation().add(pFactory.newLocation(location, Name.QNAME_XSD_STRING));
                    // TODO : check Role
                }
                if (usedTime != null) {
                    org.openprovenance.prov.xml.Other timeAtt = pFactory.newOther(getKomaduAttQName("used-time"),
                            usedTime, Name.QNAME_XSD_DATETIME);
                    pFactory.addAttribute(used, timeAtt);
                }
                // add external attributes too
                addCustomAttributes(PROVSqlQuery.GET_EXE_USAGE_ATTRIBUTES_BY_ID,
                        usageID, used, connection);
            }
            // add the used element into the list of relationships
            relationships.put(activityEntityId, used);
        }
        l.debug("addUsages() successful");
    } catch (SQLException e) {
        l.error("Exiting addUsages() with error");
        l.error(e.toString());
    } finally {
        if (usedStmt != null) {
            usedStmt.close();
        }
        if (resultSet != null) {
            resultSet.close();
        }
    }
}
 
开发者ID:Data-to-Insight-Center,项目名称:komadu,代码行数:79,代码来源:NonContextGraphGenerator.java

示例4: addUsages

import org.openprovenance.prov.model.Used; //导入依赖的package包/类
private void addUsages(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 addUsages()");

    PreparedStatement usedStmt = null;
    ResultSet resultSet = null;

    try {
        usedStmt = connection.prepareStatement(PROVSqlQuery.GET_PROV_USAGES);
        usedStmt.setString(1, contextWorkflowURI);
        usedStmt.setString(2, contextWorkflowURI);

        resultSet = usedStmt.executeQuery();

        while (resultSet.next()) {
            String usageID = 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 usedActivity = activities.get(activityID);
            Entity usedEntity = entities.get(entityID);
            Used used = pFactory.newUsed(getIdQName(usageID), usedActivity.getId(), usedEntity.getId());

            if (informationDetailLevel != null
                    && informationDetailLevel.equals(DetailEnumType.FINE)) {
                // add attributes
                if (location != null) {
                    used.getLocation().add(pFactory.newLocation(location, Name.QNAME_XSD_STRING));
                    // TODO : check Role
                }
                if (usedTime != null) {
                    Other timeAtt = pFactory.newOther(getKomaduAttQName("used-time"),
                            usedTime, Name.QNAME_XSD_DATETIME);
                    pFactory.addAttribute(used, timeAtt);
                }
                // add external attributes too
                addCustomAttributes(PROVSqlQuery.GET_EXE_USAGE_ATTRIBUTES_BY_ID,
                        usageID, used, connection);
            }
            // add the used element into the list of relationships
            relationships.add(used);
        }
        l.debug("addUsages() successful");
    } catch (SQLException e) {
        l.error("Exiting addUsages() with error");
        l.error(e.toString());
    } finally {
        if (usedStmt != null) {
            usedStmt.close();
        }

        if (resultSet != null) {
            resultSet.close();
        }
    }
}
 
开发者ID:Data-to-Insight-Center,项目名称:komadu,代码行数:65,代码来源:ContextGraphGenerator.java


注:本文中的org.openprovenance.prov.model.Used类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。