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


Java ImmutableSetMultimap.of方法代码示例

本文整理汇总了Java中com.google.common.collect.ImmutableSetMultimap.of方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSetMultimap.of方法的具体用法?Java ImmutableSetMultimap.of怎么用?Java ImmutableSetMultimap.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.ImmutableSetMultimap的用法示例。


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

示例1: testRoleInference_RoleHierarchyInvolved

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test //missing role is ambiguous without cardinality constraints
public void testRoleInference_RoleHierarchyInvolved() {
    GraknTx graph = unificationTestSet.tx();
    String relationString = "{($p, subRole2: $gc) isa binary;}";
    String relationString2 = "{(subRole1: $gp, $p) isa binary;}";
    RelationshipAtom relation = (RelationshipAtom) ReasonerQueries.atomic(conjunction(relationString, graph), graph).getAtom();
    RelationshipAtom relation2 = (RelationshipAtom) ReasonerQueries.atomic(conjunction(relationString2, graph), graph).getAtom();
    Multimap<Role, Var> roleMap = roleSetMap(relation.getRoleVarMap());
    Multimap<Role, Var> roleMap2 = roleSetMap(relation2.getRoleVarMap());

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role"), var("p"),
            graph.getRole("subRole2"), var("gc"));
    ImmutableSetMultimap<Role, Var> correctRoleMap2 = ImmutableSetMultimap.of(
            graph.getRole("role"), var("p"),
            graph.getRole("subRole1"), var("gp"));
    assertEquals(correctRoleMap, roleMap);
    assertEquals(correctRoleMap2, roleMap2);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:20,代码来源:AtomicTest.java

示例2: testZipEntryFilter

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test public void testZipEntryFilter() throws Exception {
  ZipFilterEntryFilter filter =
      new ZipFilterEntryFilter(
          ".*R.class.*",
          ImmutableSetMultimap.of("foo.class", 1L, "baz.class", 2L),
          ImmutableMap.of("foo.class", 1L, "bar.class", 2L, "baz.class", 3L, "res/R.class", 4L),
          HashMismatchCheckMode.WARN);
  filter.accept("foo.class", callback);
  callback.assertOp(FilterOperation.SKIP);
  filter.accept("bar.class", callback);
  callback.assertOp(FilterOperation.COPY);
  filter.accept("baz.class", callback);
  callback.assertOp(FilterOperation.COPY);
  filter.accept("res/R.class", callback);
  callback.assertOp(FilterOperation.SKIP);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:17,代码来源:ZipFilterActionTest.java

示例3: testZipEntryFilter_ErrorOnMismatch

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test public void testZipEntryFilter_ErrorOnMismatch() throws Exception {
  ZipFilterEntryFilter filter =
      new ZipFilterEntryFilter(
          ".*R.class.*",
          ImmutableSetMultimap.of("foo.class", 1L, "baz.class", 2L),
          ImmutableMap.of("foo.class", 1L, "bar.class", 2L, "baz.class", 3L, "res/R.class", 4L),
          HashMismatchCheckMode.ERROR);
  filter.accept("foo.class", callback);
  callback.assertOp(FilterOperation.SKIP);
  filter.accept("bar.class", callback);
  callback.assertOp(FilterOperation.COPY);
  filter.accept("res/R.class", callback);
  callback.assertOp(FilterOperation.SKIP);
  thrown.expect(IllegalStateException.class);
  thrown.expectMessage("name matches but the hash does not.");
  filter.accept("baz.class", callback);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:18,代码来源:ZipFilterActionTest.java

示例4: beforeNode

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Override
public void beforeNode(Object obj, DescriptorPath path) {
  Preconditions.checkState(!refsStack.containsKey(path));

  SetMultimap<ReferenceType, String> refs = getRelatedPaths(obj, path);
  SetMultimap<ReferenceType, String> newRefs = LinkedHashMultimap.create();

  for (Map.Entry<ReferenceType, Collection<String>> entry : refs.asMap().entrySet()) {
    ReferenceType type = entry.getKey();
    for (String reference : entry.getValue()) {
      if (!allowedRefs.containsEntry(type, reference)) {
        newRefs.put(type, reference);
        allowedRefs.put(type, reference);
      }
    }
  }

  // consolidate into the singleton if it's empty
  newRefs = newRefs.size() == 0 ? ImmutableSetMultimap
      .<ReferenceType, String> of() : newRefs;
  refsStack.put(path, newRefs);

  callReferenceConstraints(obj, path);
}
 
开发者ID:cloudera,项目名称:cm_ext,代码行数:25,代码来源:ReferenceValidatorImpl.java

示例5: testRuleApplicability_WithWildcard_MissingMappings

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test
public void testRuleApplicability_WithWildcard_MissingMappings(){
    GraknTx graph = ruleApplicabilitySet.tx();
    //although singleRoleEntity plays only one role it can also play an implicit role of the resource so mapping ambiguous
    String relationString = "{($x, $y, $z);$y isa singleRoleEntity; $z isa singleRoleEntity;}";
    RelationshipAtom relation = (RelationshipAtom) ReasonerQueries.atomic(conjunction(relationString, graph), graph).getAtom();
    ImmutableSetMultimap<Role, Var> roleMap = ImmutableSetMultimap.of(
            graph.getRole("role"), var("x"),
            graph.getRole("role"), var("y"),
            graph.getRole("role"), var("z"));
    assertEquals(roleMap, roleSetMap(relation.getRoleVarMap()));
    assertThat(relation.getApplicableRules().collect(toSet()), empty());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例6: testRoleInference_TypedBinaryRelation

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
/**
 * ##################################
 *
 *       ROLE INFERENCE Tests
 *
 * ##################################
 */

@Test
public void testRoleInference_TypedBinaryRelation(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{($x, $y); $x isa entity1; $y isa entity2;}";
    String patternString2 = "{($x, $y) isa binary; $x isa entity1; $y isa entity2;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role2"), var("y"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:21,代码来源:AtomicTest.java

示例7: testRoleInference_TypedBinaryRelation_SingleTypeMissing

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test
public void testRoleInference_TypedBinaryRelation_SingleTypeMissing(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{($x, $y); $x isa entity1;}";
    String patternString2 = "{($x, $y) isa binary; $x isa entity1;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role"), var("y"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:13,代码来源:AtomicTest.java

示例8: testRoleInference_TypedTernaryRelationWithKnownRole

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test //each type maps to a specific role
public void testRoleInference_TypedTernaryRelationWithKnownRole(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{($x, $y, role3: $z);$x isa entity1;$y isa entity2;}";
    String patternString2 = "{($x, $y, role3: $z) isa ternary;$x isa entity1;$y isa entity2;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role2"), var("y"),
            graph.getRole("role3"), var("z"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例9: testRoleInference_TypedTernaryRelation

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test //without cardinality constraints the $y variable can be mapped to any of the three roles hence metarole is assigned
public void testRoleInference_TypedTernaryRelation(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{($x, $y, $z);$x isa entity1;$y isa entity2;}";
    String patternString2 = "{($x, $y, $z) isa ternary;$x isa entity1;$y isa entity2;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role2"), var("y"),
            graph.getRole("role"), var("z"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例10: testRoleInference_TernaryRelationWithRepeatingRolePlayers

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test
public void testRoleInference_TernaryRelationWithRepeatingRolePlayers(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{(role1: $x, role2: $y, $y);}";
    String patternString2 = "{(role1: $x, role2: $y, $y) isa ternary;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role2"), var("y"),
            graph.getRole("role"), var("y"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例11: testRoleInference_TypedTernaryRelation_TypesPlaySubRoles_SubRolesAreCorrectlyIdentified

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test
public void testRoleInference_TypedTernaryRelation_TypesPlaySubRoles_SubRolesAreCorrectlyIdentified(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{(role: $x, role: $y, role: $z); $x isa anotherEntity1; $y isa anotherEntity2; $z isa anotherEntity3;}";
    String patternString2 = "{(role: $x, role: $y, role: $z) isa ternary; $x isa anotherEntity1; $y isa anotherEntity2; $z isa anotherEntity3;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("subRole1"), var("x"),
            graph.getRole("subRole2"), var("y"),
            graph.getRole("subRole3"), var("z"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例12: testRoleInference_TypedTernaryRelationWithMetaRoles_MetaRolesShouldBeOverwritten

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test
public void testRoleInference_TypedTernaryRelationWithMetaRoles_MetaRolesShouldBeOverwritten(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{(role: $x, role: $y, role: $z); $x isa entity1; $y isa entity2; $z isa entity3;}";
    String patternString2 = "{(role: $x, role: $y, role: $z) isa ternary; $x isa entity1; $y isa entity2; $z isa entity3;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role2"), var("y"),
            graph.getRole("role3"), var("z"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例13: testRoleInference_TypedTernaryRelation_TypesAreSubTypes_TopRolesShouldBeChosen

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test
public void testRoleInference_TypedTernaryRelation_TypesAreSubTypes_TopRolesShouldBeChosen(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{(role: $x, role: $y, role: $z); $x isa subEntity1; $y isa subEntity2; $z isa subEntity3;}";
    String patternString2 = "{(role: $x, role: $y, role: $z) isa ternary; $x isa subEntity1; $y isa subEntity2; $z isa subEntity3;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role2"), var("y"),
            graph.getRole("role3"), var("z"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例14: testRoleInference_TypedTernaryRelation_TypesCanPlayMultipleRoles_MetaRoleIsChosen

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test
public void testRoleInference_TypedTernaryRelation_TypesCanPlayMultipleRoles_MetaRoleIsChosen(){
    GraknTx graph = roleInferenceSet.tx();
    String patternString = "{($x, $y, $z); $x isa genericEntity; $y isa genericEntity; $z isa genericEntity;}";
    String patternString2 = "{($x, $y, $z) isa ternary; $x isa genericEntity; $y isa genericEntity; $z isa genericEntity;}";

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role"), var("x"),
            graph.getRole("role"), var("y"),
            graph.getRole("role"), var("z"));
    roleInference(patternString, correctRoleMap, graph);
    roleInference(patternString2, correctRoleMap, graph);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:14,代码来源:AtomicTest.java

示例15: testRoleInference_RoleMappingUnambiguous

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Test //entity1 plays role1, entity2 plays 2 roles, entity3 plays 3 roles hence ambiguous and metarole has to be assigned, EXPECTED TO CHANGE WITH CARDINALITY CONSTRAINTS
public void testRoleInference_RoleMappingUnambiguous(){
    GraknTx graph = ruleApplicabilitySet.tx();
    String relationString = "{($x, $y, $z) isa ternary;$x isa singleRoleEntity; $y isa twoRoleEntity; $z isa threeRoleEntity;}";
    RelationshipAtom relation = (RelationshipAtom) ReasonerQueries.atomic(conjunction(relationString, graph), graph).getAtom();
    ImmutableSetMultimap<Role, Var> roleMap = ImmutableSetMultimap.of(
            graph.getRole("role1"), var("x"),
            graph.getRole("role"), var("y"),
            graph.getRole("role"), var("z"));
    assertEquals(roleMap, roleSetMap(relation.getRoleVarMap()));
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:12,代码来源:AtomicTest.java


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