當前位置: 首頁>>代碼示例>>Java>>正文


Java Triple.getObject方法代碼示例

本文整理匯總了Java中com.hp.hpl.jena.graph.Triple.getObject方法的典型用法代碼示例。如果您正苦於以下問題:Java Triple.getObject方法的具體用法?Java Triple.getObject怎麽用?Java Triple.getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.hp.hpl.jena.graph.Triple的用法示例。


在下文中一共展示了Triple.getObject方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildBGP

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
private void buildBGP(OpBGP op) {
final List<Triple> triples = op.getPattern().getList();
for (final Triple triple : triples) {
    final Node subjectNode = triple.getSubject();
    final Node predicateNode = triple.getPredicate();
    final Node objectNode = triple.getObject();

    final String subject = PrefixUtil.collapsePrefix(FmtUtils
	    .stringForNode(subjectNode, prefixes));
    final String object = PrefixUtil.collapsePrefix(FmtUtils
	    .stringForNode(objectNode, prefixes));
    final String predicate = PrefixUtil.collapsePrefix(FmtUtils
	    .stringForNode(predicateNode, prefixes));

    if (bgp == null) {
	bgp = new ArrayList<TriplePattern>();
    }
    bgp.add(new TriplePattern(subject, predicate, object));
}
   }
 
開發者ID:aschaetzle,項目名稱:S2X,代碼行數:21,代碼來源:SparkBGP.java

示例2: getMappingVarsOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
private HashMap<String, String[]> getMappingVarsOfTriple(Triple t) {
	HashMap<String, String[]> result = new HashMap<String, String[]>();
	Node subject = t.getSubject();
	Node predicate = t.getPredicate();
	Node object = t.getObject();
	if (subject.isVariable())
		result.put(subject.getName(),
				new String[] { Tags.SUBJECT_COLUMN_NAME });
	if (predicate.isVariable()) {
		result.put(predicate.getName(),
				new String[] { Tags.PREDICATE_COLUMN_NAME });
	}
	if (object.isVariable()) {
		result.put(object.getName(),
				new String[] { Tags.OBJECT_COLUMN_NAME });
	}
	return result;
}
 
開發者ID:aschaetzle,項目名稱:S2RDF,代碼行數:19,代碼來源:TripleGroup.java

示例3: getSchemaOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
protected ArrayList<String> getSchemaOfTriple(Triple t) {
	ArrayList<String> schema = new ArrayList<String>();
	Node subject = t.getSubject();
	Node predicate = t.getPredicate();
	Node object = t.getObject();
	if (subject.isVariable())
		schema.add(subject.getName());
	else
		schema.add(Tags.NO_VAR);
	if (predicate.isVariable())
		schema.add(predicate.getName());
	else
		schema.add(Tags.NO_VAR);
	if (object.isVariable())
		schema.add(object.getName());
	else
		schema.add(Tags.NO_VAR);
	return schema;
}
 
開發者ID:aschaetzle,項目名稱:PigSPARQL,代碼行數:20,代碼來源:PigBGP.java

示例4: getMappingVarsOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
private HashMap<String, String[]> getMappingVarsOfTriple(Triple t) {
	HashMap<String, String[]> result = new HashMap<String, String[]>();
	Node subject = t.getSubject();
	Node predicate = t.getPredicate();
	Node object = t.getObject();
	if (subject.isVariable()) {
		result.put(subject.getName(), new String[] { Tags.SUBJECT_COLUMN_NAME });
	}
	if (predicate.isVariable()) {
		selectFromTripleStore = true;
		result.put(predicate.getName(), new String[] { Tags.PREDICATE_COLUMN_NAME });
	}
	if (object.isVariable()) {
		if (selectFromTripleStore) {
			result.put(object.getName(), new String[] { Tags.OBJECT_COLUMN_NAME });
		} else {
			String objectString = object.getName();
			String predicateString = getPropertyFromURI(FmtUtils
					.stringForNode(predicate, prefixMapping), false);
			result.put(objectString, new String[] { SpecialCharFilter.filter(predicateString) });
		}
	}
	return result;
}
 
開發者ID:aschaetzle,項目名稱:Sempala,代碼行數:25,代碼來源:SparkComplexTripleGroup.java

示例5: getMappingVarsOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
private HashMap<String, String[]> getMappingVarsOfTriple(Triple t) {
	HashMap<String, String[]> result = new HashMap<String, String[]>();
	Node subject = t.getSubject();
	Node predicate = t.getPredicate();
	Node object = t.getObject();
	if (subject.isVariable())
		result.put(subject.getName(),
				new String[] { Tags.SUBJECT_COLUMN_NAME });
	if (predicate.isVariable()) {
		selectFromTripleStore = true;
		result.put(predicate.getName(),
				new String[] { Tags.PREDICATE_COLUMN_NAME });
	}
	if (object.isVariable()) {
		if (selectFromTripleStore) {
			result.put(object.getName(),
					new String[] { Tags.OBJECT_COLUMN_NAME });
		} else {
			result.put(object.getName(), new String[] { SpecialCharFilter
					.filter(FmtUtils
							.stringForNode(predicate, prefixMapping)) });
		}
	}
	return result;
}
 
開發者ID:aschaetzle,項目名稱:Sempala,代碼行數:26,代碼來源:TripleGroup.java

示例6: getVarsOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
private ArrayList<String> getVarsOfTriple(Triple t) {
    ArrayList<String> vars = new ArrayList<String>();
    Node subject = t.getSubject();
    Node predicate = t.getPredicate();
    Node object = t.getObject();
    if(subject.isVariable())
        vars.add(subject.getName());
    if(predicate.isVariable())
        vars.add(predicate.getName());
    if(object.isVariable())
        vars.add(object.getName());
    return vars;
}
 
開發者ID:aschaetzle,項目名稱:S2RDF,代碼行數:14,代碼來源:ReorderNoCross.java

示例7: getVarsOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
protected ArrayList<String> getVarsOfTriple(Triple t) {
	ArrayList<String> vars = new ArrayList<String>();
	Node subject = t.getSubject();
	Node predicate = t.getPredicate();
	Node object = t.getObject();
	if (subject.isVariable())
		vars.add(subject.getName());
	if (predicate.isVariable())
		vars.add(predicate.getName());
	if (object.isVariable())
		vars.add(object.getName());
	return vars;
}
 
開發者ID:aschaetzle,項目名稱:PigSPARQL,代碼行數:14,代碼來源:ReorderNoCross.java

示例8: getVarsOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
private ArrayList<String> getVarsOfTriple(Triple t) {
	ArrayList<String> vars = new ArrayList<String>();
	Node subject = t.getSubject();
	Node predicate = t.getPredicate();
	Node object = t.getObject();
	if(subject.isVariable())
		vars.add(subject.getName());
	if(predicate.isVariable())
		vars.add(predicate.getName());
	if(object.isVariable())
		vars.add(object.getName());
	return vars;
}
 
開發者ID:aschaetzle,項目名稱:Sempala,代碼行數:14,代碼來源:ReorderNoCross.java

示例9: getMappingVarsOfTriple

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
/**
 * From a triple the method extracts the variable names 
 * and the columns to be selected from the table referring to that variable.
 * 
 * @param t
 * @return
 */
private HashMap<String, String[]> getMappingVarsOfTriple(Triple t) {
	HashMap<String, String[]> result = new HashMap<String, String[]>();
	Node subject = t.getSubject();
	Node predicate = t.getPredicate();
	Node object = t.getObject();
	if (subject.isVariable()){
		result.put(subject.getName(),
				new String[] { Tags.SUBJECT_COLUMN_NAME });
	}
	if (predicate.isVariable()) {
		selectFromTripleStore = true;
		result.put(predicate.getName(),
				new String[] { Tags.PREDICATE_COLUMN_NAME });
	}
	if (object.isVariable()) {
		if (selectFromTripleStore) {
			result.put(object.getName(),
					new String[] { Tags.OBJECT_COLUMN_NAME });
		} else {
			String objectString = object.getName();
			String predicateString = getPropertyFromURI(FmtUtils
					.stringForNode(predicate, prefixMapping), false);
			
			
			result.put(objectString, new String[] { SpecialCharFilter
					.filter(predicateString) });
		}
	}
	return result;
}
 
開發者ID:aschaetzle,項目名稱:Sempala,代碼行數:38,代碼來源:ImpalaComplexTripleGroup.java

示例10: selectWithVariables

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
/**
 * Creates a {@link NodeRelation} by applying a triple pattern
 * to the TripleRelation. If the triple contains variables, then
 * the variables will be bound to the corresponding values
 * in the resulting NodeRelation. {@link Node#ANY} will be
 * converted to a variable "subject", "predicate", "object"
 * depending on its position in the triple pattern.
 * 
 * For example, selecting (?x :name ?name) would produce a
 * NodeRelation with ?x bound to the subjects and ?name bound to the
 * objects of this TripleRelation.
 * 
 * TODO This is never called at the moment. Why!?
 * 
 * @param t A triple pattern involving variables
 * @return A NodeRelation over the variables occurring in the triple pattern 
 */
public TripleRelation selectWithVariables(Triple t) {
	// Select non-variable parts of the triple
	TripleRelation selected = selectTriple(t);
	
	// Replace Node.ANY with "subject", "predicate", "object"
	Node s = t.getSubject() == Node.ANY ? SUBJECT : t.getSubject();
	Node p = t.getPredicate() == Node.ANY ? PREDICATE : t.getPredicate();
	Node o = t.getObject() == Node.ANY ? OBJECT : t.getObject();
	
	// Collect variable names and their bound node makers 
	VariableConstraints nodeMakers = new VariableConstraints();
	nodeMakers.addIfVariable(s, nodeMaker(SUBJECT), baseRelation().aliases());
	nodeMakers.addIfVariable(p, nodeMaker(PREDICATE), baseRelation().aliases());
	nodeMakers.addIfVariable(o, nodeMaker(OBJECT), baseRelation().aliases());

	// Did the same variable occur more than once in the pattern, rendering it unsatisfiable?
	if (!nodeMakers.satisfiable()) {
		return TripleRelation.EMPTY;
	}
	
	MutableRelation mutator = new MutableRelation(selected.baseRelation());

	Expression constraint = nodeMakers.constraint();
	if (!constraint.isTrue()) {
		// Same variable occured more than once, so we add a constraint to the base relation 
		mutator.select(constraint);
	}
	
	mutator.project(nodeMakers.allProjections());
	return fromNodeRelation(new NodeRelation(
			mutator.immutableSnapshot(), nodeMakers.toMap()));
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:50,代碼來源:TripleRelation.java

示例11: instanceOf

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
protected boolean instanceOf(Node node, Node clazz,Graph graph){
	ExtendedIterator<Triple> it=graph.find(node, RDF.type.asNode(), null);
	while(it.hasNext()) {
		Triple s = it.next();
			Node actualType = s.getObject();
			if(actualType.equals(clazz) || hasSuperClass(actualType, clazz,new HashSet<Node>(),graph)) {
				it.close();
				return true;
			}
	}
	return false;
}
 
開發者ID:BenzclyZhang,項目名稱:BimSPARQL,代碼行數:13,代碼來源:IsOutsidePF.java

示例12: convertToBoundingBox

import com.hp.hpl.jena.graph.Triple; //導入方法依賴的package包/類
public void convertToBoundingBox(InputStream in, OutputStream out, String baseUri,boolean mvbb){
	setRdfWriter(new WriterStreamRDFBlocks(out));
	getRdfWriter().base(baseUri);
	getRdfWriter().prefix("inst", baseUri);
	getRdfWriter().prefix("rdf", Namespace.RDF);
	getRdfWriter().prefix("xsd", Namespace.XSD);
	getRdfWriter().prefix("owl", Namespace.OWL);
	getRdfWriter().prefix("geom", GEOM.getURI());
	getRdfWriter().start();

	getRdfWriter().finish();
		PipedRDFIterator<Triple> iter = new PipedRDFIterator<Triple>();
		final PipedRDFStream<Triple> stream = new PipedTriplesStream(iter);
		ExecutorService executor = Executors.newSingleThreadExecutor();
		Runnable parser = new Runnable() {
			public void run() {
				RDFDataMgr.parse(stream, in, RDFLanguages.TTL);
			}
		};
		executor.submit(parser);
		while (iter.hasNext()) {
			Triple t = iter.next();
			Node subject = t.getSubject();
			Node predicate = t.getPredicate();
			Node object = t.getObject();
			if(predicate.equals(GEOM.asBody.asNode())){
				Geometry g=EwktReader.parseGeometry((String)object.getLiteralValue());
				if(!g.isEmpty()){
				AABBVisitor av=new AABBVisitor();					
				g.accept(av);
				AABB aabb=av.getAABB();
				getRdfWriter().triple(new Triple(subject,GEOM.asAABB.asNode(),NodeFactory.createLiteral(EwktWriter.writeGeometry(aabb.toPolyhedralSurface()))));
				if(mvbb){
					MVBBVisitor mv=new MVBBVisitor();
					g.accept(mv);
					Box mvbbb=mv.getMVBB();
					getRdfWriter().triple(new Triple(subject,GEOM.asMVBB.asNode(),NodeFactory.createLiteral(EwktWriter.writeGeometry(mvbbb.toPolyhedralSurface()))));
				}
				}
			}

		}
		executor.shutdown();
		System.out.println("Model parsed!");	
		System.out.println("Finished!");
}
 
開發者ID:BenzclyZhang,項目名稱:BimSPARQL,代碼行數:47,代碼來源:BoundingBoxConverter.java


注:本文中的com.hp.hpl.jena.graph.Triple.getObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。