本文整理了Java中org.intermine.metadata.Model.getPackageName()
方法的一些代码示例,展示了Model.getPackageName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.getPackageName()
方法的具体详情如下:
包路径:org.intermine.metadata.Model
类名称:Model
方法名:getPackageName
[英]Return name of the model's package.
[中]返回模型包的名称。
代码示例来源:origin: org.intermine/intermine-api
/**
* Create a new BagQueryHandler object.
*
* @param model
* the Model to use when checking types
*/
public BagQueryHandler(Model model) {
super();
this.model = model;
this.pkg = model.getPackageName();
}
代码示例来源:origin: intermine/intermine
/**
* Create a new BagQueryHandler object.
*
* @param model
* the Model to use when checking types
*/
public BagQueryHandler(Model model) {
super();
this.model = model;
this.pkg = model.getPackageName();
}
代码示例来源:origin: intermine/intermine
/**
* Return true if named ClassDescriptor is found in the model. Looking for fully qualified
* classname, eg. org.intermine.model.bio.Gene.
*
* @param name named of ClassDescriptor search for
* @return true if named descriptor found
*/
public boolean hasClassDescriptor(String name) {
boolean found = cldMap.containsKey(name);
if (!found) {
found = cldMap.containsKey(getPackageName() + "." + name);
}
return found;
}
代码示例来源:origin: org.intermine/intermine-model
/**
* Return true if named ClassDescriptor is found in the model. Looking for fully qualified
* classname, eg. org.intermine.model.bio.Gene.
*
* @param name named of ClassDescriptor search for
* @return true if named descriptor found
*/
public boolean hasClassDescriptor(String name) {
boolean found = cldMap.containsKey(name);
if (!found) {
found = cldMap.containsKey(getPackageName() + "." + name);
}
return found;
}
代码示例来源:origin: org.intermine/intermine-model
/**
* Get a ClassDescriptor by name, null if no ClassDescriptor of given name in Model.
* @param name unqualified or fully-qualified class name of ClassDescriptor requested
* @return the requested ClassDescriptor. Returns null if no match was found.
*/
public ClassDescriptor getClassDescriptorByName(String name) {
ClassDescriptor cd = cldMap.get(name);
if (cd == null) {
cd = cldMap.get(getPackageName() + "." + name);
}
if (cd == null) { // still, maybe it's in the default package?
cd = cldMap.get(DEFAULT_PACKAGE + "." + name);
}
return cd;
}
代码示例来源:origin: intermine/intermine
/**
* Get a ClassDescriptor by name, null if no ClassDescriptor of given name in Model.
* @param name unqualified or fully-qualified class name of ClassDescriptor requested
* @return the requested ClassDescriptor. Returns null if no match was found.
*/
public ClassDescriptor getClassDescriptorByName(String name) {
ClassDescriptor cd = cldMap.get(name);
if (cd == null) {
cd = cldMap.get(getPackageName() + "." + name);
}
if (cd == null) { // still, maybe it's in the default package?
cd = cldMap.get(DEFAULT_PACKAGE + "." + name);
}
return cd;
}
代码示例来源:origin: org.intermine/intermine-api
/**
* Get the fully qualified type of this bag
* @return the type of objects in this bag
*/
public String getQualifiedType() {
return os.getModel().getPackageName() + "." + type;
}
代码示例来源:origin: intermine/intermine
/**
* Get the fully qualified type of this bag
* @return the type of objects in this bag
*/
public String getQualifiedType() {
return os.getModel().getPackageName() + "." + type;
}
代码示例来源:origin: org.intermine/intermine-objectstore
/**
* Set the classDescriptor attribute to be the ClassDescriptor for the given className in the
* Model set by setModel(). Returns immediately if the Model hasn't been set or the className
* parameter is "".
*
* @param className the class name
*/
protected void setClassDescriptor(String className) {
if (model != null && !"".equals(className)) {
String fullClassName =
model.getPackageName() + "." + XmlUtil.getFragmentFromURI(className);
classDescriptor = getClassDescriptorByName(fullClassName);
}
}
代码示例来源:origin: intermine/intermine
/**
* Set the classDescriptor attribute to be the ClassDescriptor for the given className in the
* Model set by setModel(). Returns immediately if the Model hasn't been set or the className
* parameter is "".
*
* @param className the class name
*/
protected void setClassDescriptor(String className) {
if (model != null && !"".equals(className)) {
String fullClassName =
model.getPackageName() + "." + XmlUtil.getFragmentFromURI(className);
classDescriptor = getClassDescriptorByName(fullClassName);
}
}
代码示例来源:origin: intermine/intermine
/**
* For a given IQL query, return a Query object.
* @param iqlQueryString the IQL String
* @param key the key from the properties file
* @param model the Model
* @return a Query object
* @throws BuildException if the IQL String cannot be parsed.
*/
private static Query parseQuery(Model model, String iqlQueryString, String key) {
IqlQuery iqlQuery = new IqlQuery(iqlQueryString, model.getPackageName());
try {
return iqlQuery.toQuery();
} catch (IllegalArgumentException e) {
throw new BuildException("Exception while parsing query: " + key + " = "
+ iqlQueryString, e);
}
}
代码示例来源:origin: org.intermine/intermine-objectstore
/**
* For a given IQL query, return a Query object.
* @param iqlQueryString the IQL String
* @param key the key from the properties file
* @param model the Model
* @return a Query object
* @throws BuildException if the IQL String cannot be parsed.
*/
private static Query parseQuery(Model model, String iqlQueryString, String key) {
IqlQuery iqlQuery = new IqlQuery(iqlQueryString, model.getPackageName());
try {
return iqlQuery.toQuery();
} catch (IllegalArgumentException e) {
throw new BuildException("Exception while parsing query: " + key + " = "
+ iqlQueryString, e);
}
}
代码示例来源:origin: org.intermine/intermine-objectstore
/**
* For a given IQL query, return a Query object.
* @param iqlQueryString the IQL String
* @param model the Model
* @return a Query object
* @throws BuildException if the IQL String cannot be parsed.
*/
private static Query parseIqlQuery(Model model, String iqlQueryString) {
IqlQuery iqlQuery = new IqlQuery(iqlQueryString, model.getPackageName());
try {
return iqlQuery.toQuery();
} catch (IllegalArgumentException e) {
throw new BuildException("Exception while parsing query: "
+ " = " + iqlQueryString, e);
}
}
}
代码示例来源:origin: intermine/intermine
public void testConflictingAttributes() throws Exception {
String modelStr = "<model name=\"testmodel\" package=\"org.intermine.model.testmodel\"><class name=\"org.intermine.model.testmodel.Secretary\" is-interface=\"false\"><attribute name=\"name\" type=\"java.lang.String\"/></class></model>";
Model model = parser.process(new StringReader(modelStr));
String addition = "<class name=\"org.intermine.model.testmodel.Secretary\" is-interface=\"false\"><attribute name=\"name\" type=\"java.lang.Integer\"/></class>";
Set additionClds = parser.generateClassDescriptors(new StringReader(addition), model.getPackageName());
try {
ModelMerger.mergeModel(model, additionClds);
fail("Expected ModelMergerException");
} catch (ModelMergerException e) {
//e.printStackTrace();
}
}
代码示例来源:origin: intermine/intermine
public void testMergeClassAddingInheritance() throws Exception {
String modelStr = "<model name=\"testmodel\" package=\"\">"
+ "<class name=\"A\" is-interface=\"false\"></class>"
+ "<class name=\"B\" is-interface=\"false\"></class>"
+ "</model>";
Model model = parser.process(new StringReader(modelStr));
String addition = "<class name=\"A\" extends=\"B\" is-interface=\"false\"></class>";
ClassDescriptor cld1 = model.getClassDescriptorByName("A");
ClassDescriptor cld2 = (ClassDescriptor) parser
.generateClassDescriptors(new StringReader(addition), model.getPackageName())
.iterator().next();
ClassDescriptor res = ModelMerger.mergeClass(cld1, cld2, model, Collections.singleton(cld2));
Set supers = new HashSet();
supers.add("B");
assertEquals(supers, res.getSuperclassNames());
}
代码示例来源:origin: intermine/intermine
public void testCreateDefaultBagQueryMultiple() throws Exception {
Query q = BagQueryHelper.createDefaultBagQuery(model.getPackageName() + ".Manager",
bagQueryConfig, model, classKeys, input);
String expected = "SELECT DISTINCT a1_.id AS a2_, a1_.name AS a3_, a1_.title AS a4_ " +
"FROM org.intermine.model.testmodel.Manager AS a1_ " +
"WHERE (LOWER(a1_.name), LOWER(a1_.title)) IN ? 1: [employeea1, employeea2]";
assertEquals(expected, q.toString());
}
}
代码示例来源:origin: intermine/intermine
public void testCreateDefaultBagQuerySingle() throws Exception {
Query q = BagQueryHelper.createDefaultBagQuery(model.getPackageName() + ".Employee",
bagQueryConfig, model, classKeys, input);
String expected = "SELECT DISTINCT a1_.id AS a2_, a1_.name AS a3_ " +
"FROM org.intermine.model.testmodel.Employee AS a1_ " +
"WHERE LOWER(a1_.name) IN ? 1: [employeea1, employeea2]";
assertEquals(expected, q.toString());
}
代码示例来源:origin: intermine/intermine
public void testIsInterfaceMismatch() throws Exception {
String modelStr = "<model name=\"testmodel\" package=\"org.intermine.model.testmodel\">" +
"<class name=\"org.intermine.model.testmodel.Company\" is-interface=\"false\">" +
"</class>" +
"</model>";
Model model = parser.process(new StringReader(modelStr));
// Merge class with differing is-interface attribute
String addition = "<class name=\"org.intermine.model.testmodel.Company\" is-interface=\"true\">" +
"</class>";
Set additionClds = parser.generateClassDescriptors(new StringReader(addition), model.getPackageName());
try {
ModelMerger.mergeModel(model, additionClds);
fail("Expected ModelMergerException");
} catch (ModelMergerException err) {
}
}
代码示例来源:origin: intermine/intermine
public void testAddAttribute() throws Exception {
String modelStr = "<model name=\"testmodel\" package=\"org.intermine.model.testmodel\"><class name=\"org.intermine.model.testmodel.Secretary\" is-interface=\"false\"><attribute name=\"name\" type=\"java.lang.String\"/></class></model>";
Model model = parser.process(new StringReader(modelStr));
String addition = "<class name=\"org.intermine.model.testmodel.Secretary\" is-interface=\"false\"><attribute name=\"age\" type=\"java.lang.Integer\"/></class>";
Set additionClds = parser.generateClassDescriptors(new StringReader(addition), model.getPackageName());
String expected = "<model name=\"testmodel\" package=\"org.intermine.model.testmodel\"><class name=\"org.intermine.model.testmodel.Secretary\" is-interface=\"false\"><attribute name=\"name\" type=\"java.lang.String\"/><attribute name=\"age\" type=\"java.lang.Integer\"/></class></model>";
//assertXMLEqual(expected, xml);
assertEquals(parser.process(new StringReader(expected)).getClassDescriptors(), ModelMerger.mergeModel(model, additionClds).getClassDescriptors());
}
代码示例来源:origin: intermine/intermine
public void testCreateDefaultBagQueryWithExtra() throws Exception {
BagQuery bq = new BagQuery(bagQueryConfigWithExtraConstraint,
model, classKeys, model.getPackageName() + ".Employee");
String expected = "SELECT DISTINCT a1_.id AS a2_, a1_.name AS a3_ " +
"FROM org.intermine.model.testmodel.Employee AS a1_, " +
"org.intermine.model.testmodel.Department AS a4_ " +
"WHERE (LOWER(a1_.name) IN ? AND a1_.department CONTAINS a4_ " +
"AND a4_.name = \'DepartmentB1\') 1: [employeea1, employeea2]";
assertEquals(expected, bq.getQuery(input, "DepartmentB1").toString());
}
内容来源于网络,如有侵权,请联系作者删除!