当前位置: 首页>>代码示例>>Java>>正文


Java NodeFactory.createLiteral方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.graph.NodeFactory.createLiteral方法的典型用法代码示例。如果您正苦于以下问题:Java NodeFactory.createLiteral方法的具体用法?Java NodeFactory.createLiteral怎么用?Java NodeFactory.createLiteral使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.graph.NodeFactory的用法示例。


在下文中一共展示了NodeFactory.createLiteral方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyValue

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
protected QueryIterator verifyValue(Binding binding, Graph graph, Node product, Geometry geometry, Node object,
		ExecutionContext execCxt) {
	boolean b = false;
	try {
		if (product.getLocalName().equals("IfcWallStandardCase_5397")){
			System.out.println("");
		}
		HashSet<Geometry> allGeometries=getProcessableElements(graph);
		b = new ExternalQuadTreeImpl(geometry, allGeometries).getIsExternal();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	Node node = NodeFactory.createLiteral(Boolean.toString(b), null, XSDDatatype.XSDboolean);
	if (node.equals(object)) {
		return IterLib.result(binding, execCxt);
	} else {
		return IterLib.noResults(execCxt);
	}
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:22,代码来源:IsOutsidePF.java

示例2: termToNode

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
private Node termToNode( Term term, QueryVars queryVars) {
	if (term instanceof FunctionalTerm) {
		try {
			URI uri = new URI(term.getName());
			return NodeFactory.createURI(uri.toString());
		} catch (MalformedURIException e) {
			return NodeFactory.createLiteral(term.toString());
		}
	} else if (term instanceof Variable) {	
		//Check for blank node
		QueryVar queryVar =queryVars.get(term.getMinVariableIndex());
		if (queryVar!=null){
			return NodeFactory.createURI(HTTP_INOVA8_COM_VARIABLE + queryVar.getName());
		}else{
			return  NodeFactory.createURI(HTTP_INOVA8_COM_BLANKNODE + term.getMinVariableIndex());	
		}
	} else {
		return null;
	}
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:21,代码来源:QueryClause.java

示例3: testAssessNodes1

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void testAssessNodes1() throws NotImplementedException, SQLException {
	String metricName = "test01";
	metric.setName(metricName);
	metric.setParentDimension("parent");
	metric.initMeasureDataSink();
	
	// too long
	Node subj = NodeFactory.createURI("http://example.org/too/long/resource/identifier/aaa");
	// too long
	Node pred = NodeFactory.createURI("http://example.org/too/long/resource/identifier/aa");
	// should be ignored
	Node obj = NodeFactory.createLiteral("foo");
	
	Triple triple = new Triple(subj, pred, obj);
	metric.assessNodes(triple);
	
	assertTrue(sink.nodeMeasureWritten(metricName, TriplePosition.SUBJECT));
	assertTrue(sink.nodeMeasureWritten(metricName, TriplePosition.PREDICATE));
	assertFalse(sink.nodeMeasureWritten(metricName, TriplePosition.OBJECT));
}
 
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:22,代码来源:ShortUriTest.java

示例4: test25

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Ignore
@Test
public synchronized void test25() throws NotImplementedException, SQLException {
	String metricName = "test25";
	metric.setName(metricName);
	metric.setParentDimension("parent");
	metric.initMeasureDataSink();
	
	Node subj = NodeFactory.createURI("http://ex.org/foo/bar");
	Node pred = NodeFactory.createURI("http://ex.org/properties/fooProp");
	Node obj = NodeFactory.createLiteral("foo", "az-Arab-x-AZE-derbend", false);
	Triple triple = new Triple(subj, pred, obj);
	metric.assessNodes(triple);
	
	assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName, TriplePosition.OBJECT));
}
 
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:17,代码来源:ValidLanguageTagTest.java

示例5: getChildren

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
/**
 * Get the Object and Datastream nodes that are children of the current Object.
 *
 * @param mixin If not null, limit to results that have this mixin.
 */
public Collection<FedoraResource> getChildren(final String mixin) throws FedoraException {
    Node mixinLiteral = null;
    if ( mixin != null ) {
        mixinLiteral = NodeFactory.createLiteral(mixin);
    }
    final ExtendedIterator<Triple> it = graph.find(Node.ANY, CONTAINS.asNode(), Node.ANY);
    final Set<FedoraResource> set = new HashSet<>();
    while (it.hasNext()) {
        final Node child = it.next().getObject();
        if ( mixin == null || graph.contains(child, HAS_MIXIN_TYPE.asNode(), mixinLiteral) ) {
            final String path = child.getURI().toString()
                    .replaceAll(repository.getRepositoryUrl(),"");
            if ( graph.contains(child, HAS_MIXIN_TYPE.asNode(), binaryType) ) {
                set.add( repository.getDatastream(path) );
            } else {
                set.add( repository.getObject(path) );
            }
        }
    }
    return set;
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo4-client,代码行数:27,代码来源:FedoraObjectImpl.java

示例6: test16

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Ignore
@Test
public synchronized void test16() throws NotImplementedException, SQLException {
	String metricName = "test16";
	metric.setName(metricName);
	metric.setParentDimension("parent");
	metric.initMeasureDataSink();
	
	Node subj = NodeFactory.createURI("http://ex.org/foo/bar");
	Node pred = NodeFactory.createURI("http://ex.org/properties/fooProp");
	Node obj = NodeFactory.createLiteral("foo", "sl-rozaj-biske", false);
	Triple triple = new Triple(subj, pred, obj);
	metric.assessNodes(triple);
	
	assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName, TriplePosition.OBJECT));
}
 
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:17,代码来源:ValidLanguageTagTest.java

示例7: getValue

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
protected QueryIterator getValue(Binding binding, Graph graph, Node product, Geometry geometry, Var alloc,
		ExecutionContext execCxt) {
	boolean b = false;
	try {
		HashSet<Geometry> allGeometries=getProcessableElements(graph);
		b = new ExternalQuadTreeImpl(geometry, allGeometries).getIsExternal();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	Node node = NodeFactory.createLiteral(Boolean.toString(b), null, XSDDatatype.XSDboolean);
	return IterLib.oneResult(binding, alloc, node, execCxt);
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:15,代码来源:IsOutsidePF.java

示例8: getValue

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
protected QueryIterator getValue(Binding binding, Graph graph, Node product, Geometry geometry, Var alloc,
		ExecutionContext execCxt) {
	String b=computeValue(geometry);
	if(b!=null){
       Node node=NodeFactory.createLiteral(b,null,XSDDatatype.XSDstring);
	return IterLib.oneResult(binding, alloc, node, execCxt);
	}else{
		return IterLib.noResults(execCxt);
	}
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:12,代码来源:FunctionBaseProductEwktValue.java

示例9: getValue

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
protected QueryIterator getValue(Binding binding, Graph graph, Node product, Geometry geometry, Var alloc,
		ExecutionContext execCxt) {
    double a=computeValueByMVBB(geometry);
    double b=computeValueBySurfaceArea(product,geometry,execCxt);
    double area=Double.min(a, b);
    if(area!=Double.NaN){
        Node node=NodeFactory.createLiteral(Double.toString(area),null,XSDDatatype.XSDdouble);
		return IterLib.oneResult(binding, alloc, node, execCxt);
		}else{
			return IterLib.noResults(execCxt);
		}
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:14,代码来源:HasGrossWallAreaPF.java

示例10: getValue

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
protected QueryIterator getValue(Binding binding, Graph graph, Node product, Geometry geometry, Var alloc,
		ExecutionContext execCxt) {
	double b=computeValue(geometry);
	if(b!=Double.NaN){
       Node node=NodeFactory.createLiteral(Double.toString(b),null,XSDDatatype.XSDdouble);
	return IterLib.oneResult(binding, alloc, node, execCxt);
	}else{
		return IterLib.noResults(execCxt);
	}
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:12,代码来源:FunctionBaseProductNumericalValue.java

示例11: toNode

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
private Node toNode(String value) {
  if (value.startsWith("http://") || value.startsWith("https://")) {
    return NodeFactory.createURI(value);
  } else if (value.contains("^^")) {
    String[] parts = value.split("\\^\\^");
    RDFDatatype dtype = NodeFactory.getType(toUri(parts[1]));
    return NodeFactory.createLiteral(unquoting(parts[0]), dtype);
  } else {
    return NodeFactory.createLiteral(value);
  }
}
 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:12,代码来源:CSPARQL.java

示例12: evaluate

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
public Expr evaluate(NodeTest nodeTest, ElementGroup elementGroup, Var var, LDPathEvaluatorConfiguration evaluatorConfiguration) {
    PathEqualityTest pathEqualityTest = (PathEqualityTest) nodeTest;
    Var tmpVar =  LDPathEvaluator.evaluate(pathEqualityTest.getPath(), elementGroup, var, evaluatorConfiguration);
    if(pathEqualityTest.getNode() instanceof org.openrdf.model.impl.LiteralImpl) {
        return new E_Equals(new ExprVar(tmpVar.asNode()), new NodeValueNode(NodeFactory.createLiteral(((LiteralImpl) pathEqualityTest.getNode()).getLabel().toString())));
    } else {
        return new E_Equals(new ExprVar(tmpVar.asNode()), new NodeValueNode(NodeFactory.createURI(pathEqualityTest.getNode().toString())));
    }
}
 
开发者ID:anno4j,项目名称:anno4j,代码行数:11,代码来源:PathEqualityTestEvaluator.java

示例13: getLiteralFromStringWithLanguage

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
/**
 * Method to obtain a Literal with language from String.
 * 
 * @param s
 *            Receives the string in format "[email protected]".
 * @return Returns the literal node.
 */
public Node getLiteralFromStringWithLanguage(String s) throws Exception {
	String parts[] = s.split("@");
	if (parts.length == 2) {
		return NodeFactory.createLiteral(parts[0], parts[1], false);
	} else {
		throw new Exception("Error getting literal and language from: " + s);
	}
}
 
开发者ID:wilkinsonlab,项目名称:DDx2NP,代码行数:16,代码来源:NanopubBasis.java

示例14: test01

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test01() throws NotImplementedException, SQLException {
	String metricName = "test01";
	metric.setName(metricName);
	metric.setParentDimension("parent");
	metric.initMeasureDataSink();
	
	Node subj = NodeFactory.createURI("http://ex.org/foo/bar");
	Node pred = NodeFactory.createURI("http://ex.org/properties/fooProp");
	Node obj = NodeFactory.createLiteral("foo", "de", false);
	Triple triple = new Triple(subj, pred, obj);
	metric.assessNodes(triple);
	
	assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName, TriplePosition.OBJECT));
}
 
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:16,代码来源:ValidLanguageTagTest.java

示例15: test02

import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test02() throws NotImplementedException, SQLException {
	String metricName = "test02";
	metric.setName(metricName);
	metric.setParentDimension("parent");
	metric.initMeasureDataSink();
	
	Node subj = NodeFactory.createURI("http://ex.org/foo/bar");
	Node pred = NodeFactory.createURI("http://ex.org/properties/fooProp");
	Node obj = NodeFactory.createLiteral("foo", "fr", false);
	Triple triple = new Triple(subj, pred, obj);
	metric.assessNodes(triple);
	
	assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName, TriplePosition.OBJECT));
}
 
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:16,代码来源:ValidLanguageTagTest.java


注:本文中的com.hp.hpl.jena.graph.NodeFactory.createLiteral方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。