Tabnine Logo
CollectionDescriptor.relationType
Code IndexAdd Tabnine to your IDE (free)

How to use
relationType
method
in
org.intermine.metadata.CollectionDescriptor

Best Java code snippets using org.intermine.metadata.CollectionDescriptor.relationType (Showing top 19 results out of 315)

origin: org.intermine/intermine-objectstore

/**
 * Given a ClassDescriptor find names of all related indirection tables.
 * @param cld class to find tables for
 * @return a set of all indirection table names
 */
public static Set<String> getIndirectionTableNames(ClassDescriptor cld) {
  Set<String> tables = new HashSet<String>();
  for (CollectionDescriptor col : cld.getAllCollectionDescriptors()) {
    if (FieldDescriptor.M_N_RELATION == col.relationType()) {
      tables.add(getIndirectionTableName(col));
    }
  }
  return tables;
}
origin: intermine/intermine

/**
 * Given a ClassDescriptor find names of all related indirection tables.
 * @param cld class to find tables for
 * @return a set of all indirection table names
 */
public static Set<String> getIndirectionTableNames(ClassDescriptor cld) {
  Set<String> tables = new HashSet<String>();
  for (CollectionDescriptor col : cld.getAllCollectionDescriptors()) {
    if (FieldDescriptor.M_N_RELATION == col.relationType()) {
      tables.add(getIndirectionTableName(col));
    }
  }
  return tables;
}
origin: org.intermine/intermine-objectstore

/**
 * Creates an indirection table name for a many-to-many collection descriptor
 *
 * @param col CollectionDescriptor
 * @return a valid table name
 */
public static String getIndirectionTableName(CollectionDescriptor col) {
  if (FieldDescriptor.M_N_RELATION != col.relationType()) {
    throw new IllegalArgumentException("Argument must be a CollectionDescriptor for a "
                      + "many-to-many relation");
  }
  String name1 = getInwardIndirectionColumnName(col, 0);
  String name2 = getOutwardIndirectionColumnName(col, 0);
  return name1.compareTo(name2) < 0 ? name1 + name2 : name2 + name1;
}
origin: intermine/intermine

/**
 * Creates an indirection table name for a many-to-many collection descriptor
 *
 * @param col CollectionDescriptor
 * @return a valid table name
 */
public static String getIndirectionTableName(CollectionDescriptor col) {
  if (FieldDescriptor.M_N_RELATION != col.relationType()) {
    throw new IllegalArgumentException("Argument must be a CollectionDescriptor for a "
                      + "many-to-many relation");
  }
  String name1 = getInwardIndirectionColumnName(col, 0);
  String name2 = getOutwardIndirectionColumnName(col, 0);
  return name1.compareTo(name2) < 0 ? name1 + name2 : name2 + name1;
}
origin: org.intermine/intermine-objectstore

if (FieldDescriptor.M_N_RELATION == collection.relationType()) {
  if (!indirections.contains(collection.getReverseReferenceDescriptor())) {
    indirections.add(collection);
origin: intermine/intermine

if (FieldDescriptor.M_N_RELATION == collection.relationType()) {
  if (!indirections.contains(collection.getReverseReferenceDescriptor())) {
    indirections.add(collection);
origin: intermine/intermine

public void testRelationTypeUnidirectional() throws Exception {
  CollectionDescriptor col = new CollectionDescriptor("col1", "package.name.Class1", null);
  Set<CollectionDescriptor> cols = Collections.singleton(col);
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false, noAttrs, noRefs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.M_N_RELATION, col.relationType());
}
origin: intermine/intermine

public void testRelationTypeOneToMany() throws Exception {
  CollectionDescriptor col = new CollectionDescriptor("col1", "package.name.Class1", "ref1");
  ReferenceDescriptor ref  = new ReferenceDescriptor("ref1", "package.name.Class1", null);
  Set<CollectionDescriptor> cols = Collections.singleton(col);
  Set<ReferenceDescriptor> refs = Collections.singleton(ref);
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false, noAttrs, refs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.ONE_N_RELATION, col.relationType());
}
origin: intermine/intermine

public void testRelationTypeManyToMany() throws Exception {
  CollectionDescriptor col1 = new CollectionDescriptor("col1", "package.name.Class1", "col2");
  CollectionDescriptor col2 = new CollectionDescriptor("col2", "package.name.Class1", null);
  Set<CollectionDescriptor> cols = new HashSet<CollectionDescriptor>(Arrays.asList(col1, col2));
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false, noAttrs, noRefs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.M_N_RELATION, col1.relationType());
}
origin: org.intermine/intermine-objectstore

if (FieldDescriptor.M_N_RELATION == col.relationType()) {
  String tableName = DatabaseUtil.getIndirectionTableName(col).toLowerCase();
  String columnName = DatabaseUtil.getInwardIndirectionColumnName(col,
origin: intermine/intermine

if (FieldDescriptor.M_N_RELATION == col.relationType()) {
  String tableName = DatabaseUtil.getIndirectionTableName(col).toLowerCase();
  String columnName = DatabaseUtil.getInwardIndirectionColumnName(col,
origin: org.intermine/intermine-objectstore

if (collection.relationType() == FieldDescriptor.M_N_RELATION) {
  String indirectTableName =
    DatabaseUtil.getIndirectionTableName(collection);
origin: intermine/intermine

if (collection.relationType() == FieldDescriptor.M_N_RELATION) {
  String indirectTableName =
    DatabaseUtil.getIndirectionTableName(collection);
origin: org.intermine/intermine-objectstore

/**
 * Creates a column name for the "inward" key of a many-to-many collection descriptor.
 *
 * @param col CollectionDescriptor
 * @param version the database version number
 * @return a valid column name
 */
public static String getInwardIndirectionColumnName(CollectionDescriptor col, int version) {
  if (FieldDescriptor.M_N_RELATION != col.relationType()) {
    throw new IllegalArgumentException("Argument must be a CollectionDescriptor for a "
                      + "many-to-many relation");
  }
  if (version == 0) {
    return StringUtil.capitalise(generateSqlCompatibleName(col.getName()));
  } else if (version == 1) {
    ReferenceDescriptor rd = col.getReverseReferenceDescriptor();
    String colName = (rd == null
      ? TypeUtil.unqualifiedName(col.getClassDescriptor().getName())
      : rd.getName());
    return StringUtil.capitalise(generateSqlCompatibleName(colName));
  } else {
    throw new IllegalArgumentException("Database version number " + version
        + " not recognised");
  }
}
origin: intermine/intermine

/**
 * Creates a column name for the "outward" key of a many-to-many collection descriptor.
 *
 * @param col CollectionDescriptor
 * @param version the database version number
 * @return a valid column name
 */
public static String getOutwardIndirectionColumnName(CollectionDescriptor col, int version) {
  if (FieldDescriptor.M_N_RELATION != col.relationType()) {
    throw new IllegalArgumentException("Argument must be a CollectionDescriptor for a "
                      + "many-to-many relation");
  }
  if (version == 0) {
    ReferenceDescriptor rd = col.getReverseReferenceDescriptor();
    String colName = (rd == null
      ? TypeUtil.unqualifiedName(col.getClassDescriptor().getName())
      : rd.getName());
    return StringUtil.capitalise(generateSqlCompatibleName(colName));
  } else if (version == 1) {
    return StringUtil.capitalise(generateSqlCompatibleName(col.getName()));
  } else {
    throw new IllegalArgumentException("Database version number " + version
        + " not recognised");
  }
}
origin: org.intermine/intermine-objectstore

/**
 * Creates a column name for the "outward" key of a many-to-many collection descriptor.
 *
 * @param col CollectionDescriptor
 * @param version the database version number
 * @return a valid column name
 */
public static String getOutwardIndirectionColumnName(CollectionDescriptor col, int version) {
  if (FieldDescriptor.M_N_RELATION != col.relationType()) {
    throw new IllegalArgumentException("Argument must be a CollectionDescriptor for a "
                      + "many-to-many relation");
  }
  if (version == 0) {
    ReferenceDescriptor rd = col.getReverseReferenceDescriptor();
    String colName = (rd == null
      ? TypeUtil.unqualifiedName(col.getClassDescriptor().getName())
      : rd.getName());
    return StringUtil.capitalise(generateSqlCompatibleName(colName));
  } else if (version == 1) {
    return StringUtil.capitalise(generateSqlCompatibleName(col.getName()));
  } else {
    throw new IllegalArgumentException("Database version number " + version
        + " not recognised");
  }
}
origin: intermine/intermine

/**
 * Creates a column name for the "inward" key of a many-to-many collection descriptor.
 *
 * @param col CollectionDescriptor
 * @param version the database version number
 * @return a valid column name
 */
public static String getInwardIndirectionColumnName(CollectionDescriptor col, int version) {
  if (FieldDescriptor.M_N_RELATION != col.relationType()) {
    throw new IllegalArgumentException("Argument must be a CollectionDescriptor for a "
                      + "many-to-many relation");
  }
  if (version == 0) {
    return StringUtil.capitalise(generateSqlCompatibleName(col.getName()));
  } else if (version == 1) {
    ReferenceDescriptor rd = col.getReverseReferenceDescriptor();
    String colName = (rd == null
      ? TypeUtil.unqualifiedName(col.getClassDescriptor().getName())
      : rd.getName());
    return StringUtil.capitalise(generateSqlCompatibleName(colName));
  } else {
    throw new IllegalArgumentException("Database version number " + version
        + " not recognised");
  }
}
origin: intermine/intermine

if (coll.relationType() == FieldDescriptor.ONE_N_RELATION) {
  QueryClass qc = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
        ConstraintOp.LESS_THAN_EQUALS,
        new QueryValue(new Integer(highestId))));
  if (coll.relationType() == FieldDescriptor.ONE_N_RELATION) {
    QueryForeignKey reverseIdField = new QueryForeignKey(qc2,
        coll.getReverseReferenceFieldName());
origin: org.intermine/intermine-objectstore

if (coll.relationType() == FieldDescriptor.ONE_N_RELATION) {
  QueryClass qc = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
        ConstraintOp.LESS_THAN_EQUALS,
        new QueryValue(new Integer(highestId))));
  if (coll.relationType() == FieldDescriptor.ONE_N_RELATION) {
    QueryForeignKey reverseIdField = new QueryForeignKey(qc2,
        coll.getReverseReferenceFieldName());
org.intermine.metadataCollectionDescriptorrelationType

Popular methods of CollectionDescriptor

  • <init>
    Construct a CollectionDescriptor. name and referencedType may not be null.
  • getReferencedClassDescriptor
  • getReverseReferenceDescriptor
  • getClassDescriptor
  • getName
  • getReferencedClassName
  • getReverseReferenceFieldName
  • findReferencedDescriptor
  • equals
  • hashCode
  • setClassDescriptor
  • toString
  • setClassDescriptor,
  • toString

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Notification (javax.management)
  • JFileChooser (javax.swing)
  • JTable (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now