本文整理了Java中org.apache.stanbol.entityhub.servicesapi.yard.Yard.getQueryFactory()
方法的一些代码示例,展示了Yard.getQueryFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yard.getQueryFactory()
方法的具体详情如下:
包路径:org.apache.stanbol.entityhub.servicesapi.yard.Yard
类名称:Yard
方法名:getQueryFactory
[英]Getter for the FieldQueryFactory used by this Yard
[中]这个院子使用的FieldQueryFactory的Getter
代码示例来源:origin: apache/stanbol
@Override
public FieldQueryFactory getQueryFactory() {
return getYard().getQueryFactory();
}
代码示例来源:origin: apache/stanbol
@Override
protected FieldQuery createQuery() {
return yard.getQueryFactory().createFieldQuery();
}
@Override
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core
@Override
public final FieldQueryFactory getQueryFactory() {
Yard entityhubYard = getYard();
return entityhubYard==null? //if no yard available
DefaultQueryFactory.getInstance(): //use the default
entityhubYard.getQueryFactory(); //else return the query factory used by the yard
}
@Override
代码示例来源:origin: apache/stanbol
@Override
public final FieldQueryFactory getQueryFactory() {
Yard entityhubYard = getYard();
return entityhubYard==null? //if no yard available
DefaultQueryFactory.getInstance(): //use the default
entityhubYard.getQueryFactory(); //else return the query factory used by the yard
}
@Override
代码示例来源:origin: apache/stanbol
@Test
public void testGetQueryFactory() {
assertNotNull("The QueryFactory MUST NOT be NULL", getYard().getQueryFactory());
}
代码示例来源:origin: apache/stanbol
/**
* Simple test for the QueryFactory
*/
@Test
public void testQeuryFactory(){
FieldQueryFactory qf = getYard().getQueryFactory();
Assert.assertNotNull("The getter for the FieldQueryFactory MUST NOT return NULL!", qf);
FieldQuery query = qf.createFieldQuery();
Assert.assertNotNull("The FieldQueryFactory returned NULL as query", query);
}
/**
代码示例来源:origin: apache/stanbol
@Test
public void testFindTextWildcards(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//prefix search with *
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
String wildcard = data.textValue1.getText();
wildcard = wildcard.substring(0, wildcard.length()-1) + "*";
query.setConstraint(data.textField, new TextConstraint(wildcard,PatternType.wildcard,false, "en"));
query.addSelectedField(data.refField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r1en.getId(), data.r2en.getId()),
Arrays.asList(data.refField, data.textField));
//wildcard with ?
query = getYard().getQueryFactory().createFieldQuery();
//selects r1en and r2en
wildcard = data.textValue1.getText();
wildcard = wildcard.substring(0, wildcard.length()-1) + "?";
query.setConstraint(data.textField, new TextConstraint(wildcard,PatternType.wildcard,false, "de"));
query.addSelectedField(data.refField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r1de.getId(), data.r2de.getId()),
Arrays.asList(data.refField, data.textField));
}
代码示例来源:origin: apache/stanbol
/**
* Same as {@link #testFindText()} but using
* {@link Yard#findRepresentation(FieldQuery)} to execute the queries
*/
@Test
public void testFindRepresentationText(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue1.getText()));
validateQueryResults(query, getYard().findRepresentation(query),
Arrays.asList( data.r1.getId(), data.r1en.getId(), data.r1de.getId()),
Arrays.asList(data.textField, data.refField, data.intField));
//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText()));
validateQueryResults(query, getYard().findRepresentation(query),
Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()),
Arrays.asList(data.textField, data.refField, data.intField));
}
/**
代码示例来源:origin: apache/stanbol
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(
Arrays.asList(data.textValue1.getText(), data.textValue2.getText()),
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(
Arrays.asList(data.textValue1.getText(), data.textValue2.getText()),
代码示例来源:origin: apache/stanbol
/**
* Tests simple {@link RangeConstraint}
*/
@Test
public void testFindRange(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.intField, new RangeConstraint(data.intValue2,data.intValue5,true));
query.addSelectedField(data.intField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r2.getId(), data.r2en.getId(), data.r2de.getId(), data.r5.getId()),
Arrays.asList(data.intField, data.refField));
//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.intField, new RangeConstraint(data.intValue2,data.intValue10,false));
query.addSelectedField(data.intField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r5.getId()),
Arrays.asList(data.intField, data.textField));
}
/**
代码示例来源:origin: apache/stanbol
/**
* Tests simple {@link ValueConstraint}s
*/
@Test
public void testFindValues(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.intField, new ValueConstraint(data.intValue1));
query.addSelectedField(data.intField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r1.getId(), data.r1en.getId(), data.r1de.getId()),
Arrays.asList(data.intField, data.textField));
//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.intField, new ValueConstraint(data.intValue2));
query.addSelectedField(data.intField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r2.getId(), data.r2en.getId(), data.r2de.getId()),
Arrays.asList(data.intField, data.textField));
}
/**
代码示例来源:origin: apache/stanbol
/**
* Test a simple {@link TextConstraint} for any language
*/
@Test
public void testFindText(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue1.getText()));
query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query),
Arrays.asList( data.r1.getId(), data.r1en.getId(), data.r1de.getId()),
Arrays.asList(data.textField, data.refField));
//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText()));
query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query),
Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()),
Arrays.asList(data.textField, data.refField));
}
/**
代码示例来源:origin: apache/stanbol
/**
* Same as {@link #testFindText()} but using
* {@link Yard#findReferences(FieldQuery)} to execute the queries
*/
@Test
public void testFindReferencesText(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue1.getText()));
validateQueryResults(query, getYard().findReferences(query),
Arrays.asList(data.r1.getId(), data.r1en.getId(), data.r1de.getId()));
//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText()));
validateQueryResults(query, getYard().findReferences(query),
Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()));
}
代码示例来源:origin: apache/stanbol
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query = getYard().getQueryFactory().createFieldQuery();
query = getYard().getQueryFactory().createFieldQuery();
代码示例来源:origin: apache/stanbol
/**
* Test a {@link ReferenceConstraint}
*/
@Test
public void testFindReference(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.refField, new ReferenceConstraint(data.refValue1.getReference()));
query.addSelectedField(data.intField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r1.getId(), data.r1en.getId(), data.r1de.getId(), data.r5.getId()),
Arrays.asList(data.intField, data.refField));
//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.refField, new ReferenceConstraint(data.refValue2.getReference()));
query.addSelectedField(data.intField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r2.getId(), data.r2en.getId(), data.r2de.getId(), data.r10.getId()),
Arrays.asList(data.intField, data.refField));
}
代码示例来源:origin: apache/stanbol
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(
data.textValue1.getText(), "en"));
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(
data.textValue2.getText(), "de"));
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(
data.textValue1.getText(), (String)null));
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(
data.textValue1.getText(), null, "en"));
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(
data.textValue1.getText(), "en", "de"));
内容来源于网络,如有侵权,请联系作者删除!