本文整理汇总了Java中org.openrdf.model.impl.BooleanLiteralImpl类的典型用法代码示例。如果您正苦于以下问题:Java BooleanLiteralImpl类的具体用法?Java BooleanLiteralImpl怎么用?Java BooleanLiteralImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BooleanLiteralImpl类属于org.openrdf.model.impl包,在下文中一共展示了BooleanLiteralImpl类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: meet
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Override
public void meet(final Filter node) throws Exception {
super.meet(node);
final ValueExpr arg = node.getCondition();
if (arg instanceof FunctionCall) {
final FunctionCall fc = (FunctionCall) arg;
if (RANGE.stringValue().equals(fc.getURI())) {
//range(?var, start, end)
final List<ValueExpr> valueExprs = fc.getArgs();
if (valueExprs.size() != 3) {
throw new QueryEvaluationException("org.apache:range must have 3 parameters: variable, start, end");
}
final Var var = (Var) valueExprs.get(0);
final ValueConstant startVc = (ValueConstant) valueExprs.get(1);
final ValueConstant endVc = (ValueConstant) valueExprs.get(2);
final Value start = startVc.getValue();
final Value end = endVc.getValue();
rangeValues.put(var, new RangeValue(start, end));
node.setCondition(new ValueConstant(BooleanLiteralImpl.TRUE));
}
}
}
开发者ID:apache,项目名称:incubator-rya,代码行数:24,代码来源:FilterRangeVisitor.java
示例2: adaptValue
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
/**
* Convert from OpenRDF to rdf4j value used by Geo Functions.
*
* @param value
* Must be a URIImpl, Literal or a BooleanLiteralImpl, or throws error. Ignores language.
* @param rdf4jValueFactory
* @return an rdf4j Literal copied from the input
*/
public org.eclipse.rdf4j.model.Value adaptValue(Value value, org.eclipse.rdf4j.model.ValueFactory rdf4jValueFactory) {
if (value instanceof URIImpl) {
URIImpl uri = (URIImpl) value;
return rdf4jValueFactory.createIRI(uri.stringValue());
} else if (!(value instanceof Literal)) {
throw new UnsupportedOperationException("Not supported, value must be literal type, it was: " + value.getClass() + " value=" + value);
}
if (value instanceof BooleanLiteralImpl) {
BooleanLiteralImpl bl = (BooleanLiteralImpl) value;
if (bl.booleanValue())
return org.eclipse.rdf4j.model.impl.BooleanLiteral.TRUE;
else
return org.eclipse.rdf4j.model.impl.BooleanLiteral.FALSE;
}
final Literal literalValue = (Literal) value;
org.eclipse.rdf4j.model.ValueFactory vf = org.eclipse.rdf4j.model.impl.SimpleValueFactory.getInstance();
final String label = literalValue.getLabel();
final IRI datatype = vf.createIRI(literalValue.getDatatype().stringValue());
return vf.createLiteral(label, datatype);
}
开发者ID:apache,项目名称:incubator-rya,代码行数:29,代码来源:FunctionAdapter.java
示例3: equals
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Override
public boolean equals(final Object object) {
if (object == this) {
return true;
}
if (!(object instanceof Literal)) {
return false;
}
final Literal other = (Literal) object;
if (object.getClass() == this.getClass()) {
return this.datatype.equals(other.getDatatype()) && equalNumber(other);
}
if (object instanceof NumberLiteral || object instanceof BooleanLiteralImpl
|| object instanceof CalendarLiteralImpl || object instanceof StringLiteral) {
return false;
}
return other.getLanguage() == null && this.datatype.equals(other.getDatatype())
&& stringValue().equals(other.stringValue());
}
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:20,代码来源:CompactValueFactory.java
示例4: handleBoolean
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Override
public void handleBoolean(final boolean value) throws QueryResultHandlerException {
try {
this.writer.append("</head>\n<body>\n"//
+ "<table class=\"sparql\">\n<thead>\n" //
+ "<tr><th>boolean</th></tr>\n" //
+ "</thead>\n<tbody>\n" //
+ "<tr><td>");
RDFUtil.toHtml(value ? BooleanLiteralImpl.TRUE : BooleanLiteralImpl.FALSE,
this.prefixes, this.writer);
this.writer.append("</td></tr>\n" //
+ "</tbody>\n</table>\n" //
+ "</body>\n</html>\n");
this.writer.flush();
} catch (final IOException ex) {
throw new TupleQueryResultHandlerException(ex);
}
}
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:19,代码来源:HtmlSparql.java
示例5: toString_Boolean
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Test
public void toString_Boolean() throws BindingSetConversionException {
// Setup the binding set that will be converted.
final MapBindingSet originalBindingSet = new MapBindingSet();
originalBindingSet.addBinding("x", new BooleanLiteralImpl(true));
// Convert it to a String.
final VariableOrder varOrder = new VariableOrder("x");
final BindingSetConverter<String> converter = new BindingSetStringConverter();
final String bindingSetString = converter.convert(originalBindingSet, varOrder);
// Ensure it converted to the expected result.
final String expected = "true<<~>>http://www.w3.org/2001/XMLSchema#boolean";
assertEquals(expected, bindingSetString);
}
开发者ID:apache,项目名称:incubator-rya,代码行数:16,代码来源:BindingSetStringConverterTest.java
示例6: fromString_Boolean
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Test
public void fromString_Boolean() throws BindingSetConversionException {
// Setup the String that will be converted.
final String bindingSetString = "true<<~>>http://www.w3.org/2001/XMLSchema#boolean";
// Convert it to a BindingSet
final BindingSetConverter<String> converter = new BindingSetStringConverter();
final BindingSet bindingSet = converter.convert(bindingSetString, new VariableOrder("x"));
// Ensure it converted to the expected result.
final MapBindingSet expected = new MapBindingSet();
expected.addBinding("x", new BooleanLiteralImpl(true));
assertEquals(expected, bindingSet);
}
开发者ID:apache,项目名称:incubator-rya,代码行数:16,代码来源:BindingSetStringConverterTest.java
示例7: normalize
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Nullable
public <T> T normalize(@Nullable final T object) {
if (object instanceof Statement) {
if (!(object instanceof StatementImpl) && !(object instanceof ContextStatementImpl)) {
final Statement s = (Statement) object;
return s.getContext() == null ? (T) createStatement(s.getSubject(),
s.getPredicate(), s.getObject()) : (T) createStatement(s.getSubject(),
s.getPredicate(), s.getObject(), s.getContext());
}
} else if (object instanceof URI) {
if (!(object instanceof URIImpl)) {
return (T) createURI(((URI) object).stringValue());
}
} else if (object instanceof BNode) {
if (!(object instanceof BNodeImpl)) {
return (T) createBNode(((BNode) object).getID());
}
} else if (object instanceof Literal) {
if (!(object instanceof StringLiteral) && !(object instanceof NumberLiteral)
&& !(object instanceof BooleanLiteralImpl)
&& !(object instanceof CalendarLiteralImpl)) {
final Literal l = (Literal) object;
return l.getLanguage() != null ? (T) createLiteral(l.getLabel(), l.getLanguage())
: (T) createLiteral(l.getLabel(), l.getDatatype());
}
}
return object;
}
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:30,代码来源:CompactValueFactory.java
示例8: meet
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Override
public void meet(Bound bound) {
super.meet(bound);
if (bound.getArg().hasValue()) {
// variable is always bound
bound.replaceWith(new ValueConstant(BooleanLiteralImpl.TRUE));
}
}
开发者ID:esarbanis,项目名称:strabon,代码行数:10,代码来源:stSPARQLConstantOptimizer.java
示例9: convertSingleResult
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Override
public LdbcSnbBiQuery1PostingSummaryResult convertSingleResult(BindingSet bs) {
int messageYear = convertInteger(bs, "messageYear" );
boolean isComment = ((BooleanLiteralImpl) bs.getBinding("isComment" )).booleanValue();
int lengthCategory = convertInteger(bs, "lengthCategory" );
long messageCount = convertLong (bs, "messageCount" );
int averageMessageLength = convertInteger(bs, "averageMessageLength");
int sumMessageLength = convertInteger(bs, "totalMessageCount" );
double percentageOfMessages = convertDouble (bs, "percentageOfMessages");
return new LdbcSnbBiQuery1PostingSummaryResult(messageYear, isComment, lengthCategory, messageCount, averageMessageLength, sumMessageLength, (float) percentageOfMessages);
}
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:13,代码来源:SparqlBiDb.java
示例10: removeConcept
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
private void removeConcept(URI concept) throws RepositoryException {
repCon.add(concept, new URIImpl(OWL.NAMESPACE + "deprecated"), new BooleanLiteralImpl(true));
persistAndNotifyProvider.persistAndNotify(
Helper.createChangeSetModel(concept.stringValue(),
OWL.NAMESPACE + "deprecated",
new BooleanLiteralImpl(true),
ChangeTripleService.CHANGETYPE_ADD),
true);
}
开发者ID:rsine,项目名称:rsine,代码行数:11,代码来源:ConceptMergeTest.java
示例11: createLiteral
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
@Override
public Literal createLiteral(final String label, final URI datatype) {
try {
if (datatype == null) {
return new StringLiteral(label, (String) null);
} else if (datatype.equals(XMLSchema.STRING)) {
return new StringLiteral(label, XMLSchema.STRING);
} else if (datatype.equals(XMLSchema.BOOLEAN)) {
final boolean value = XMLDatatypeUtil.parseBoolean(label);
return value ? BooleanLiteralImpl.TRUE : BooleanLiteralImpl.FALSE;
} else if (datatype.equals(XMLSchema.INT)) {
return new LongLiteral(XMLSchema.INT, XMLDatatypeUtil.parseInt(label));
} else if (datatype.equals(XMLSchema.LONG)) {
return new LongLiteral(XMLSchema.LONG, XMLDatatypeUtil.parseLong(label));
} else if (datatype.equals(XMLSchema.SHORT)) {
return new LongLiteral(XMLSchema.SHORT, XMLDatatypeUtil.parseShort(label));
} else if (datatype.equals(XMLSchema.BYTE)) {
return new LongLiteral(XMLSchema.BYTE, XMLDatatypeUtil.parseByte(label));
} else if (datatype.equals(XMLSchema.DOUBLE)) {
return new DoubleLiteral(XMLSchema.DOUBLE, XMLDatatypeUtil.parseDouble(label));
} else if (datatype.equals(XMLSchema.FLOAT)) {
return new DoubleLiteral(XMLSchema.FLOAT, XMLDatatypeUtil.parseFloat(label));
} else if (datatype.equals(XMLSchema.DATETIME) || datatype.equals(XMLSchema.DATE)
|| datatype.equals(XMLSchema.TIME) || datatype.equals(XMLSchema.GYEARMONTH)
|| datatype.equals(XMLSchema.GMONTHDAY) || datatype.equals(XMLSchema.GYEAR)
|| datatype.equals(XMLSchema.GMONTH) || datatype.equals(XMLSchema.GDAY)) {
return createLiteral(XMLDatatypeUtil.parseCalendar(label));
} else if (datatype.equals(XMLSchema.DECIMAL)) {
return new BigDecimalLiteral(datatype, XMLDatatypeUtil.parseDecimal(label));
} else if (datatype.equals(XMLSchema.INTEGER)
|| datatype.equals(XMLSchema.NON_NEGATIVE_INTEGER)
|| datatype.equals(XMLSchema.POSITIVE_INTEGER)
|| datatype.equals(XMLSchema.NEGATIVE_INTEGER)) {
return new BigIntegerLiteral(datatype, XMLDatatypeUtil.parseInteger(label));
} else {
return new StringLiteral(label, datatype);
}
} catch (final Throwable ex) {
LOGGER.warn("Illegal literal: '" + label + "'^^<" + datatype + "> (dropping datatype)");
return createLiteral(label);
}
}
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:43,代码来源:CompactValueFactory.java
示例12: writeDataSource
import org.openrdf.model.impl.BooleanLiteralImpl; //导入依赖的package包/类
private static void writeDataSource(RepositoryConnection repositoryConnection, DataSource dataSource) throws RepositoryException, BridgeDBException {
Resource id = asResource(dataSource);
repositoryConnection.add(id, RdfConstants.TYPE_URI, BridgeDBConstants.DATA_SOURCE_URI);
if (dataSource.getFullName() != null){
repositoryConnection.add(id, BridgeDBConstants.FULL_NAME_URI, new LiteralImpl(dataSource.getFullName()));
}
if (dataSource.getSystemCode() != null && (!dataSource.getSystemCode().trim().isEmpty())){
repositoryConnection.add(id, BridgeDBConstants.SYSTEM_CODE_URI, new LiteralImpl(dataSource.getSystemCode()));
}
if (dataSource.getMainUrl() != null){
repositoryConnection.add(id, BridgeDBConstants.MAIN_URL_URI, new LiteralImpl(dataSource.getMainUrl()));
}
if (dataSource.getExample() != null && dataSource.getExample().getId() != null){
repositoryConnection.add(id, BridgeDBConstants.ID_EXAMPLE_URI, new LiteralImpl(dataSource.getExample().getId()));
}
if (dataSource.isPrimary()){
repositoryConnection.add(id, BridgeDBConstants.PRIMARY_URI, BooleanLiteralImpl.TRUE);
} else {
repositoryConnection.add(id, BridgeDBConstants.PRIMARY_URI, BooleanLiteralImpl.FALSE);
}
if (dataSource.getType() != null){
repositoryConnection.add(id, BridgeDBConstants.TYPE_URI, new LiteralImpl(dataSource.getType()));
}
Pattern regex = DataSourcePatterns.getPatterns().get(dataSource);
String url = dataSource.getKnownUrl("$id");
UriPattern urlPattern = UriPattern.byPattern(url);
if (urlPattern != null){
repositoryConnection.add(id, BridgeDBConstants.HAS_PRIMARY_URI_PATTERN_URI, urlPattern.getResourceId());
}
String identifersOrgSimple = dataSource.getIdentifiersOrgUri("$id");
UriPattern identifersOrgSimplePattern = UriPattern.byPattern(identifersOrgSimple);
if (identifersOrgSimplePattern != null){
repositoryConnection.add(id, BridgeDBConstants.HAS_IDENTIFERS_ORG_PATTERN_URI, identifersOrgSimplePattern.getResourceId());
String identifersOrgInfo = identifersOrgSimple.replace("identifiers.org","info.identifiers.org");
UriPattern identifersOrgInfoPattern = UriPattern.byPattern(identifersOrgInfo);
if (identifersOrgInfoPattern != null){
repositoryConnection.add(id, BridgeDBConstants.HAS_IDENTIFERS_ORG_INFO_PATTERN_URI, identifersOrgInfoPattern.getResourceId());
}
}
if (dataSource.getOrganism() != null){
Organism organism = (Organism)dataSource.getOrganism();
repositoryConnection.add(id, BridgeDBConstants.ABOUT_ORGANISM_URI, OrganismRdf.getResourceId(organism));
}
Pattern pattern = DataSourcePatterns.getPatterns().get(dataSource);
if (pattern != null && !pattern.toString().isEmpty()){
Value patternValue = new LiteralImpl(pattern.toString());
repositoryConnection.add(id, BridgeDBConstants.HAS_REGEX_PATTERN_URI, patternValue);
}
if (dataSource.getAlternative() != null){
repositoryConnection.add(id, DCTermsConstants.ALTERNATIVE_URI, new LiteralImpl(dataSource.getAlternative()));
}
if (dataSource.getDescription() != null){
repositoryConnection.add(id, DCatConstants.DESCRIPTION_URI, new LiteralImpl(dataSource.getDescription()));
}
SortedSet<UriPattern> sortedPatterns = UriPattern.byCodeAndType(dataSource.getSystemCode(), UriPatternType.dataSourceUriPattern);
if (sortedPatterns != null){
for (UriPattern uriPattern:sortedPatterns){
repositoryConnection.add(id, BridgeDBConstants.HAS_URI_PATTERN_URI, uriPattern.getResourceId());
}
}
writeCodeMapper(repositoryConnection, dataSource);
}
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:78,代码来源:BridgeDBRdfHandler.java
注:本文中的org.openrdf.model.impl.BooleanLiteralImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论