本文整理汇总了Java中com.hp.hpl.jena.graph.NodeFactory.createURI方法的典型用法代码示例。如果您正苦于以下问题:Java NodeFactory.createURI方法的具体用法?Java NodeFactory.createURI怎么用?Java NodeFactory.createURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.graph.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.createURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMaterialTriples
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
public void addMaterialTriples(InstanceGeometry ig){
if(ig.getColors()!=null&&ig.getColors().length>0){
String materials=""+ig.getColors()[0];
for(int i=1;i<ig.getColors().length;i++){
materials=materials+" "+ig.getColors()[i];
}
String indices=""+ig.getMaterialIndices()[0];
for(int i=1;i<ig.getMaterialIndices().length;i++){
indices=indices+" "+ig.getMaterialIndices()[i];
}
Node hasMaterials=NodeFactory.createURI(GEOM.getURI()+"hasMaterials");
Node hasMaterialIndices=NodeFactory.createURI(GEOM.getURI()+"hasMaterialIndices");
getRdfWriter().triple(new Triple(NodeFactory.createURI(baseUri+"Geometry"+"_"+ig.getId()),hasMaterials,NodeFactory.createLiteral(materials)));
getRdfWriter().triple(new Triple(NodeFactory.createURI(baseUri+"Geometry"+"_"+ig.getId()),hasMaterialIndices,NodeFactory.createLiteral((indices))));
}
}
示例2: getRelatedSubjects
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
protected HashSet<Node> getRelatedSubjects(Node node, ExecutionContext execCxt) {
HashSet<Node> results = new HashSet<Node>();
Graph graph = execCxt.getActiveGraph();
Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
LinkedList<Storey> storeys = new LinkedList<Storey>();
if (graph.contains(node, RDF.type.asNode(), clazz)) {
Storey storey = new Storey(node, elevation(node, graph));
ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
while (triples.hasNext()) {
Node subject = triples.next().getSubject();
Storey s = new Storey(subject, elevation(subject, graph));
if (s.elevation > storey.elevation) {
addStorey(storeys, s, graph);
}
}
if (storeys.size() > 0) {
results.add(storeys.get(0).storey);
}
}
return results;
}
示例3: getRelatedObjects
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Override
protected HashSet<Node> getRelatedObjects(Node node, ExecutionContext execCxt) {
HashSet<Node> results = new HashSet<Node>();
Graph graph = execCxt.getActiveGraph();
Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
LinkedList<Storey> storeys = new LinkedList<Storey>();
if (graph.contains(node, RDF.type.asNode(), clazz)) {
Storey storey = new Storey(node, elevation(node, graph));
ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
while (triples.hasNext()) {
Node subject = triples.next().getSubject();
Storey s = new Storey(subject, elevation(subject, graph));
if (s.elevation < storey.elevation) {
addStorey(storeys, s, graph);
}
}
if (storeys.size() > 0) {
results.add(storeys.get(storeys.size() - 1).storey);
}
}
return results;
}
示例4: test12
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test12() throws NotImplementedException, SQLException {
String metricName = "test12";
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/someProp");
Node obj = RDF.Statement.asNode();
Triple triple = new Triple(subj, pred, obj);
metric.assessTriple(triple);
assertFalse(sink.measureWritten(metricName));
}
示例5: addObjectProperty
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
/**
* Call this method to add a triple to the context when the URI is known for subject, property, and object value.
* @param context - the RuleContext from the calling built-in
* @param subject - the subject node
* @param predUri - the property URI
* @param object - the object value node
*/
public static synchronized void addObjectProperty(RuleContext context, Node_URI subject, String predUri, Node_URI object) {
if (subject == null) {
_logger.error("addObjectProperty called with null subject");
return;
}
if (predUri == null) {
_logger.error("addObjectProperty called with null property URI");
return;
}
if (object == null) {
_logger.error("addObjectProperty called with null object");
return;
}
Node_URI prop = (Node_URI) NodeFactory.createURI(predUri);
Triple t = new Triple(subject, prop, object);
doAddTriple(t, context, true);
if (_logger.isDebugEnabled()) {
_logger.debug("in Rule " + context.getRule().getName() + " added new triple (" + t.toString() + ") (notify deductions true)");
}
// Utils.deleteReplaceCreateValue(context, subject, prop, object);
}
示例6: 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.setPrefixes(prefixes);
metric.initMeasureDataSink();
Node subj = NodeFactory.createURI("http://" + hostName + ":" + port + okPath);
Node pred = NodeFactory.createURI("http://ex.org/properties/fooProp");
Node obj = NodeFactory.createURI("http://ex.org/Foo");
Triple triple = new Triple(subj, pred, obj);
metric.assessNodes(triple);
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.SUBJECT));
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.PREDICATE));
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.OBJECT));
}
示例7: 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));
}
示例8: termToNode
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
private Node termToNode(QueryVars queryVars, Term term) {
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) {
QueryVar queryVar = queryVars.get(term.getMinVariableIndex());
if (queryVar!=null){
return Var.alloc(queryVar.getLinkedName(this));
}else{
return Var.alloc(Integer.toString(term.getMinVariableIndex()));
}
} else {
return null;
}
}
示例9: test05
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test05() throws NotImplementedException, SQLException {
String metricName = "test05";
metric.setName(metricName);
metric.setParentDimension("parent");
metric.initMeasureDataSink();
Node subj = NodeFactory.createURI("http://ex.org/statement/foo");
Node pred = RDF.predicate.asNode();
Node obj = NodeFactory.createURI("http://ex.org/things/sth");
Triple triple = new Triple(subj, pred, obj);
metric.assessTriple(triple);
assertTrue(sink.measureWritten(metricName));
}
示例10: test34
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test34() throws NotImplementedException, SQLException {
String metricName = "test34";
metric.setName(metricName);
metric.setParentDimension("parent");
metric.initMeasureDataSink();
Node subj = NodeFactory.createURI("http://ex.org/collectionProperties/foorst");
Node pred = RDFS.subPropertyOf.asNode();
Node obj = RDF.first.asNode();
Triple triple = new Triple(subj, pred, obj);
metric.assessTriple(triple);
assertFalse(sink.measureWritten(metricName));
}
示例11: test09
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test09() throws NotImplementedException, SQLException {
String metricName = "test09";
metric.setName(metricName);
metric.setParentDimension("parent");
metric.setPrefixes(prefixes);
metric.initMeasureDataSink();
Node subj = NodeFactory.createURI("http://ex.org/foo/bar");
Node pred = NodeFactory.createURI("http://ex.org/properties/fooProp");
Node obj = NodeFactory.createURI("http://" + hostName + ":" + port + notFoundPath);
Triple triple = new Triple(subj, pred, obj);
metric.assessNodes(triple);
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.SUBJECT));
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.PREDICATE));
assertTrue(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.OBJECT));
}
示例12: test12
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test12() throws NotImplementedException, SQLException {
String metricName = "test12";
metric.setName(metricName);
metric.setParentDimension("parent");
metric.setPrefixes(prefixes);
metric.initMeasureDataSink();
Node subj = NodeFactory.createURI("http://ex.org/foo/bar");
Node pred = NodeFactory.createURI("http://ex.org/properties/fooProp");
Node obj = NodeFactory.createURI("http://" + hostName + ":" + port + serverErrPath);
Triple triple = new Triple(subj, pred, obj);
metric.assessNodes(triple);
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.SUBJECT));
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.PREDICATE));
assertTrue(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.OBJECT));
}
示例13: test14
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test14() throws NotImplementedException, SQLException {
String metricName = "test14";
metric.setName(metricName);
metric.setParentDimension("parent");
metric.setPrefixes(prefixes);
metric.initMeasureDataSink();
Node subj = NodeFactory.createURI("http://ex.org/foo/bar");
Node pred = NodeFactory.createURI("http://" + hostName + ":" + portNotServed + okPath);
Node obj = NodeFactory.createURI("http://ex.org/Foo");
Triple triple = new Triple(subj, pred, obj);
metric.assessNodes(triple);
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.SUBJECT));
assertTrue(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.PREDICATE));
assertFalse(((BooleanTestingSink) sink).nodeMeasureWritten(metricName,
TriplePosition.OBJECT));
}
示例14: test10
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
@Test
public synchronized void test10() throws NotImplementedException, SQLException {
String metricName = "test10";
metric.setName(metricName);
metric.setParentDimension("parent");
metric.initMeasureDataSink();
Node subj = NodeFactory.createURI("http://ex.org/properties/fooProp");
Node pred = RDFS.subPropertyOf.asNode();
Node obj = RDF.object.asNode();
Triple triple = new Triple(subj, pred, obj);
metric.assessTriple(triple);
assertFalse(sink.measureWritten(metricName));
}
示例15: transformPathToBasicPattern
import com.hp.hpl.jena.graph.NodeFactory; //导入方法依赖的package包/类
public static BasicPattern transformPathToBasicPattern(Node subject, String sPath, Node object){
BasicPattern res= new BasicPattern();
boolean inverse = checkInverse(sPath);
if (inverse)
{
sPath = sPath.substring(1);
Node temp = subject;
subject = object;
object = temp;
}
sPath = TransformerHelper.removeScopes(sPath);
int operatorPos = TransformerHelper.getPosOfNextOperator(sPath);
if (operatorPos < 0)
{
Triple triple = new Triple(subject, NodeFactory.createURI(sPath.substring(1, sPath.length()-1)), object);
res.add(triple);
return res;
}
String leftStringPath = sPath.substring(0, operatorPos);
String rightStringPath = sPath.substring(operatorPos+1);
Node newConection = NodeFactory.createVariable(getNextVaribleName());
BasicPattern leftPattern = transformPathToBasicPattern(subject, leftStringPath, newConection);
BasicPattern rightPattern = transformPathToBasicPattern(newConection, rightStringPath, object);
res.addAll(leftPattern);
res.addAll(rightPattern);
return res;
}