org.intermine.metadata.Model.getName()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.intermine.metadata.Model.getName()方法的一些代码示例,展示了Model.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.getName()方法的具体详情如下:
包路径:org.intermine.metadata.Model
类名称:Model
方法名:getName

Model.getName介绍

[英]Get the name of this model - i.e. package name.
[中]获取此模型的名称,即包名。

代码示例

代码示例来源:origin: org.intermine/intermine-pathquery

/** @param m The model to add. **/
public void addModel(Model m) {
  String name = m.getName();
  models.put(name, m);
}

代码示例来源:origin: intermine/intermine

/** @param m The model to add. **/
public void addModel(Model m) {
  String name = m.getName();
  models.put(name, m);
}

代码示例来源:origin: org.intermine/intermine-jbrowse-endpoint

/** Get the prefix used to namespace this service **/
private String getPropertyPrefix() {
  String modelName = im.getModel().getName();
  String prefix = "org.intermine.webservice.server.jbrowse." + modelName;
  return prefix;
}

代码示例来源:origin: org.intermine/intermine-jbrowse-endpoint

private String getPropertyPrefix() {
  String modelName = im.getModel().getName();
  String propertyPrefix = "org.intermine.webservice.server.jbrowse." + modelName + ".";
  return propertyPrefix;
}

代码示例来源:origin: intermine/intermine

private String getPropertyPrefix() {
  String modelName = im.getModel().getName();
  String propertyPrefix = "org.intermine.webservice.server.jbrowse." + modelName + ".";
  return propertyPrefix;
}

代码示例来源:origin: intermine/intermine

/** Get the prefix used to namespace this service **/
private String getPropertyPrefix() {
  String modelName = im.getModel().getName();
  String prefix = "org.intermine.webservice.server.jbrowse." + modelName;
  return prefix;
}

代码示例来源:origin: org.intermine/intermine-pathquery

/**
 * Convert a PathQuery to XML.
 *
 * @param version the version number of the XML format
 * @return this template query as XML.
 */
public synchronized String toXml(int version) {
  StringWriter sw = new StringWriter();
  XMLOutputFactory factory = XMLOutputFactory.newInstance();
  try {
    XMLStreamWriter writer = factory.createXMLStreamWriter(sw);
    PathQueryBinding.marshal(this, "query", model.getName(), writer, version);
  } catch (XMLStreamException e) {
    throw new RuntimeException(e);
  }
  return sw.toString();
}

代码示例来源:origin: intermine/intermine

/**
 * Convert a PathQuery to XML.
 *
 * @param version the version number of the XML format
 * @return this template query as XML.
 */
public synchronized String toXml(int version) {
  StringWriter sw = new StringWriter();
  XMLOutputFactory factory = XMLOutputFactory.newInstance();
  try {
    XMLStreamWriter writer = factory.createXMLStreamWriter(sw);
    PathQueryBinding.marshal(this, "query", model.getName(), writer, version);
  } catch (XMLStreamException e) {
    throw new RuntimeException(e);
  }
  return sw.toString();
}

代码示例来源:origin: org.intermine/intermine-objectstore

/**
 * Construct an ObjectStore with some metadata
 * @param model the name of the model
 */
protected ObjectStoreAbstractImpl(Model model) {
  this.model = model;
  Properties props = PropertiesUtil.getPropertiesStartingWith("os.query");
  props = PropertiesUtil.stripStart("os.query", props);
  if (props.get("max-limit") != null) {
    maxLimit = Integer.parseInt((String) props.get("max-limit"));
  }
  if (props.get("max-offset") != null) {
    maxOffset = Integer.parseInt((String) props.get("max-offset"));
  }
  if (props.get("max-time") != null) {
    maxTime = Long.parseLong((String) props.get("max-time"));
  }
  if (props.get("max-query-parse-time") != null) {
    maxQueryParseTime = Long.parseLong((String) props.get("max-query-parse-time"));
  }
  LOG.info("Creating new " + getClass().getName() + " with sequence = " + sequenceNumber
      + ", model = \"" + model.getName() + "\"");
  cache = new CacheMap<Integer, InterMineObject>(getClass().getName() + " with sequence = "
      + sequenceNumber + ", model = \"" + model.getName() + "\" getObjectById cache");
}

代码示例来源:origin: intermine/intermine

/**
 * Construct an ObjectStore with some metadata
 * @param model the name of the model
 */
protected ObjectStoreAbstractImpl(Model model) {
  this.model = model;
  Properties props = PropertiesUtil.getPropertiesStartingWith("os.query");
  props = PropertiesUtil.stripStart("os.query", props);
  if (props.get("max-limit") != null) {
    maxLimit = Integer.parseInt((String) props.get("max-limit"));
  }
  if (props.get("max-offset") != null) {
    maxOffset = Integer.parseInt((String) props.get("max-offset"));
  }
  if (props.get("max-time") != null) {
    maxTime = Long.parseLong((String) props.get("max-time"));
  }
  if (props.get("max-query-parse-time") != null) {
    maxQueryParseTime = Long.parseLong((String) props.get("max-query-parse-time"));
  }
  LOG.info("Creating new " + getClass().getName() + " with sequence = " + sequenceNumber
      + ", model = \"" + model.getName() + "\"");
  cache = new CacheMap<Integer, InterMineObject>(getClass().getName() + " with sequence = "
      + sequenceNumber + ", model = \"" + model.getName() + "\" getObjectById cache");
}

代码示例来源:origin: org.intermine/intermine-objectstore

/**
 * Save a model, in serialized form, to the specified directory
 * @param model the model
 * @param destDir the destination directory
 * @throws IOException if an error occurs
 */
public static void saveModel(Model model, File destDir) throws IOException {
  write(model.toString(), new File(destDir, getFilename(MODEL, model.getName())));
}

代码示例来源:origin: intermine/intermine

/**
 * Save a model, in serialized form, to the specified directory
 * @param model the model
 * @param destDir the destination directory
 * @throws IOException if an error occurs
 */
public static void saveModel(Model model, File destDir) throws IOException {
  write(model.toString(), new File(destDir, getFilename(MODEL, model.getName())));
}

代码示例来源:origin: org.intermine/intermine-api

/**
 * Convert a SavedQuery to XML and write XML to given writer.
 *
 * @param query the SavedQuery
 * @param writer the XMLStreamWriter to write to
 * @param version the version number of the XML format, an attribute of the ProfileManager
 */
public static void marshal(SavedQuery query, XMLStreamWriter writer, int version) {
  try {
    writer.writeCharacters("\n");
    writer.writeStartElement("saved-query");
    writer.writeAttribute("name", query.getName());
    if (query.getDateCreated() != null) {
      writer.writeAttribute("date-created", "" + query.getDateCreated().getTime());
    }
    PathQueryBinding.marshal(query.getPathQuery(),
                 query.getName(),
                 query.getPathQuery().getModel().getName(),
                 writer, version);
    writer.writeEndElement();
  } catch (XMLStreamException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: intermine/intermine

/**
 * Convert a SavedQuery to XML and write XML to given writer.
 *
 * @param query the SavedQuery
 * @param writer the XMLStreamWriter to write to
 * @param version the version number of the XML format, an attribute of the ProfileManager
 */
public static void marshal(SavedQuery query, XMLStreamWriter writer, int version) {
  try {
    writer.writeCharacters("\n");
    writer.writeStartElement("saved-query");
    writer.writeAttribute("name", query.getName());
    if (query.getDateCreated() != null) {
      writer.writeAttribute("date-created", "" + query.getDateCreated().getTime());
    }
    PathQueryBinding.marshal(query.getPathQuery(),
                 query.getName(),
                 query.getPathQuery().getModel().getName(),
                 writer, version);
    writer.writeEndElement();
  } catch (XMLStreamException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.intermine/intermine-jbrowse-endpoint

@Override
protected void execute() throws ServiceException {
  Command cmd = getCommand();
  CommandRunner runner = CommandRunner.getRunner(getProperty(CMD_RUNNER
      + im.getModel().getName()), im);
  runner.addListener(getListener());
  String intro = runner.getIntro(cmd);
  if (intro != null) {
    attrs.put(JSONFormatter.KEY_INTRO, intro);
  }
  String outro = runner.getOutro(cmd);
  if (outro != null) {
    attrs.put(JSONFormatter.KEY_OUTRO, outro);
  }
  runner.run(cmd);
}

代码示例来源:origin: intermine/intermine

@Override
protected void execute() throws ServiceException {
  Command cmd = getCommand();
  CommandRunner runner = CommandRunner.getRunner(getProperty(CMD_RUNNER
      + im.getModel().getName()), im);
  runner.addListener(getListener());
  String intro = runner.getIntro(cmd);
  if (intro != null) {
    attrs.put(JSONFormatter.KEY_INTRO, intro);
  }
  String outro = runner.getOutro(cmd);
  if (outro != null) {
    attrs.put(JSONFormatter.KEY_OUTRO, outro);
  }
  runner.run(cmd);
}

代码示例来源:origin: org.intermine/intermine-api

/**
 * Construct a new multi-type constraint.
 * @param model The model to look for types within.
 * @param field The subject of the constraint.
 * @param pcmt The constraint itself.
 * @return A constraint.
 * @throws ObjectStoreException if the constraint names types that are not in the model.
 */
protected static Constraint makeMultiTypeConstraint(
    Model model,
    QueryNode field,
    PathConstraintMultitype pcmt) throws ObjectStoreException {
  QueryField typeClass = new QueryField((QueryClass) field, "class");
  ConstraintOp op = (pcmt.getOp() == ConstraintOp.ISA)
      ? ConstraintOp.IN : ConstraintOp.NOT_IN;
  Set<Class<?>> classes = new TreeSet<Class<?>>(new ClassNameComparator());
  for (String name: pcmt.getValues()) {
    ClassDescriptor cd = model.getClassDescriptorByName(name);
    if (cd == null) { // PathQueries should take care of this, but you know.
      throw new ObjectStoreException(
          String.format("%s is not a class in the %s model", name, model.getName()));
    }
    classes.add(cd.getType());
  }
  return new BagConstraint(typeClass, op, classes);
}

代码示例来源:origin: intermine/intermine

/**
 * Construct a new multi-type constraint.
 * @param model The model to look for types within.
 * @param field The subject of the constraint.
 * @param pcmt The constraint itself.
 * @return A constraint.
 * @throws ObjectStoreException if the constraint names types that are not in the model.
 */
protected static Constraint makeMultiTypeConstraint(
    Model model,
    QueryNode field,
    PathConstraintMultitype pcmt) throws ObjectStoreException {
  QueryField typeClass = new QueryField((QueryClass) field, "class");
  ConstraintOp op = (pcmt.getOp() == ConstraintOp.ISA)
      ? ConstraintOp.IN : ConstraintOp.NOT_IN;
  Set<Class<?>> classes = new TreeSet<Class<?>>(new ClassNameComparator());
  for (String name: pcmt.getValues()) {
    ClassDescriptor cd = model.getClassDescriptorByName(name);
    if (cd == null) { // PathQueries should take care of this, but you know.
      throw new ObjectStoreException(
          String.format("%s is not a class in the %s model", name, model.getName()));
    }
    classes.add(cd.getType());
  }
  return new BagConstraint(typeClass, op, classes);
}

代码示例来源:origin: intermine/intermine

/**
 * Attach the model. Throws IllegalArgumentExceptions if node doesn't map onto the model.
 *
 * @param model model to attach
 * @throws IllegalArgumentException if class or field are not found in the model
 */
public void setModel(Model model) {
  ClassDescriptor cld = model.getClassDescriptorByName(getParentType());
  if (cld == null) {
    throw new IllegalArgumentException("No class '" + getParentType()
      + "' found in model '" + model.getName() + "'.");
  }
  fd = cld.getFieldDescriptorByName(fieldName);
  if (fd == null) {
    throw new IllegalArgumentException("Class '" + cld.getName()
      + "' does not have field '" + fieldName + "'.");
  }
  type = TypeUtil.unqualifiedName(fd.isAttribute()
                  ? ((AttributeDescriptor) fd).getType()
                  : ((ReferenceDescriptor) fd)
                  .getReferencedClassDescriptor().getName());
  attribute = fd.isAttribute();
  reference = fd.isReference();
  collection = fd.isCollection();
  this.model = model;
}

代码示例来源:origin: org.intermine/intermine-pathquery

/**
 * Attach the model. Throws IllegalArgumentExceptions if node doesn't map onto the model.
 *
 * @param model model to attach
 * @throws IllegalArgumentException if class or field are not found in the model
 */
public void setModel(Model model) {
  ClassDescriptor cld = model.getClassDescriptorByName(getParentType());
  if (cld == null) {
    throw new IllegalArgumentException("No class '" + getParentType()
      + "' found in model '" + model.getName() + "'.");
  }
  fd = cld.getFieldDescriptorByName(fieldName);
  if (fd == null) {
    throw new IllegalArgumentException("Class '" + cld.getName()
      + "' does not have field '" + fieldName + "'.");
  }
  type = TypeUtil.unqualifiedName(fd.isAttribute()
                  ? ((AttributeDescriptor) fd).getType()
                  : ((ReferenceDescriptor) fd)
                  .getReferencedClassDescriptor().getName());
  attribute = fd.isAttribute();
  reference = fd.isReference();
  collection = fd.isCollection();
  this.model = model;
}

相关文章