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


Java Node.isURI方法代码示例

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


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

示例1: processObject

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private NPPhraseSpec processObject(Node object, boolean isClass) throws IOException {
	NPPhraseSpec element;
	if (object.isVariable()) {
		element = processVarNode(object);
	} else if (object.isLiteral()) {
		element = processLiteralNode(object);
	} else if (object.isURI()) {
		if (isClass) {
			element = processClassNode(object, false);
		} else {
			element = processResourceNode(object);
		}
	} else {
		throw new IllegalArgumentException("Can not convert blank node " + object + ".");
	}
	return element;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:18,代码来源:TripleConverterPortuguese.java

示例2: processObject

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private NPPhraseSpec processObject(Node object, boolean isClass) {
	NPPhraseSpec element;
	if (object.isVariable()) {
		element = processVarNode(object);
	} else if (object.isLiteral()) {
		element = processLiteralNode(object);
	} else if (object.isURI()) {
		if (isClass) {
			element = processClassNode(object, false);
		} else {
			element = processResourceNode(object);
		}
	} else {
		throw new IllegalArgumentException("Can not convert blank node " + object + ".");
	}
	return element;
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:18,代码来源:TripleConverter.java

示例3: getActualSource

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
 *
 * @param binding -
 * @return the actual URI that represents the location of the query to be
 * fetched.
 */
private String getActualSource(
        final BindingHashMapOverwrite binding) {
    if (node.isVariable()) {
        Node actualSource = binding.get((Var) node);
        if (actualSource == null) {
            return null;
        }
        if (!actualSource.isURI()) {
            throw new SPARQLGenerateException("Variable " + node.getName()
                    + " must be bound to a IRI that represents the location"
                    + " of the query to be fetched.");
        }
        return actualSource.getURI();
    } else {
        if (!node.isURI()) {
            throw new SPARQLGenerateException("The source must be a IRI"
                    + " that represents the location of the query to be"
                    + " fetched. Got " + node.getURI());
        }
        return node.getURI();
    }
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:29,代码来源:SourcePlanImpl.java

示例4: translateToExternalUri

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private Node translateToExternalUri(final Node node) {
    if (node.isURI()) {
        final String uri = node.getURI();
        if (uri.startsWith(INTERNAL_URI_PREFIX)) {
            return createURI(toExternalURI(URI.create(uri), headers).toString());
        }
    }
    return node;
}
 
开发者ID:duraspace,项目名称:lambdora,代码行数:10,代码来源:LambdoraLdp.java

示例5: MotifPattern

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
public MotifPattern(Node s, Node p, Node o) {
	
	if (!s.isConcrete()) {
		this.v = s.getName();
	}else if (s.isURI()) {
		PrefixBuilder subjectPrefix = new PrefixBuilder(s.getURI());
		v= subjectPrefix.getUriValue();
	}else {
		this.v=s.toString();
		v=v.substring(1, v.length()-1);	
	}
	
	if (!p.isConcrete()) {
		this.e = p.getName();
	}else if (p.isURI()) {
		PrefixBuilder predicatePrefix = new PrefixBuilder(p.getURI());
		e= predicatePrefix.getUriValue();
	}else {
		this.e=p.toString();
		e=e.substring(1, e.length()-1);	
	}
	
	if (!o.isConcrete()) {
		this.v2 = o.getName();
	}else if (o.isURI()) {
		PrefixBuilder objectPrefix = new PrefixBuilder(o.getURI());
		v2= objectPrefix.getUriValue();
	}else if (o.isLiteral()) {
		this.v2 = o.getLiteral().toString();
		
	}
	
	//code for object node with special symbol
	/*else if (o.isLiteral()) {
		this.v2= "object"; 
	} */
	
}
 
开发者ID:koneksys,项目名称:SPARQL_to_GraphFrames,代码行数:39,代码来源:MotifPattern.java

示例6: processNode

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
 * Process the node and return an NLG element that contains the textual
 * representation. The output depends on the node type, i.e. variable, URI
 * or literal.
 * 
 * @param node
 *            the node to process
 * @return the NLG element containing the textual representation of the node
 * @throws IOException
 */
public NLGElement processNode(Node node) throws IOException {
	NLGElement element;
	if (node.isVariable()) {
		element = processVarNode(node);
	} else if (node.isURI()) {
		element = processResourceNode(node);
	} else if (node.isLiteral()) {
		element = processLiteralNode(node);
	} else {
		throw new UnsupportedOperationException("Can not convert blank node.");
	}
	return element;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:24,代码来源:TripleConverterPortuguese.java

示例7: processSubject

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private NLGElement processSubject(Node subject) throws IOException {
	NLGElement element;
	if (subject.isVariable()) {
		element = processVarNode(subject);
	} else if (subject.isURI()) {
		element = processResourceNode(subject);
	} else if (subject.isLiteral()) {
		element = processLiteralNode(subject);
	} else {
		throw new UnsupportedOperationException("Can not convert " + subject);
	}
	return element;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:14,代码来源:TripleConverterPortuguese.java

示例8: addUri

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
protected void addUri(CrawleableUri uri, Node node) {
    if (node.isURI()) {
        try {
            addNewUri(uri, new CrawleableUri(new URI(node.getURI())));
        } catch (URISyntaxException e) {
            LOGGER.error("Couldn't process extracted URI. It will be ignored.", e);
        }
    }
}
 
开发者ID:dice-group,项目名称:Squirrel,代码行数:10,代码来源:SqlBasedUriCollector.java

示例9: rebase

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private Node rebase(final Node node) {
    if (node.isURI() && sourceURI != null && destinationURI != null
            && node.getURI().startsWith(sourceURI)) {
        return createURI(node.getURI().replaceFirst(sourceURI, destinationURI));
    }

    return node;
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo-import-export,代码行数:9,代码来源:SubjectMappingStreamRDF.java

示例10: processNode

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
 * Process the node and return an NLG element that contains the textual
 * representation. The output depends on the node type, i.e. variable, URI
 * or literal.
 * 
 * @param node
 *            the node to process
 * @return the NLG element containing the textual representation of the node
 */
public NLGElement processNode(Node node) {
	NLGElement element;
	if (node.isVariable()) {
		element = processVarNode(node);
	} else if (node.isURI()) {
		element = processResourceNode(node);
	} else if (node.isLiteral()) {
		element = processLiteralNode(node);
	} else {
		throw new UnsupportedOperationException("Can not convert blank node.");
	}
	return element;
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:23,代码来源:TripleConverter.java

示例11: processSubject

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private NLGElement processSubject(Node subject) {
	NLGElement element;
	if (subject.isVariable()) {
		element = processVarNode(subject);
	} else if (subject.isURI()) {
		element = processResourceNode(subject);
	} else if (subject.isLiteral()) {
		element = processLiteralNode(subject);
	} else {
		throw new UnsupportedOperationException("Can not convert " + subject);
	}
	return element;
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:14,代码来源:TripleConverter.java

示例12: extractNamespacesAndNames

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private void extractNamespacesAndNames() {
	StmtIterator iter = model.listStatements();

	while (iter.hasNext()) {
		Statement r = iter.nextStatement();
		Triple triple = r.asTriple();

		Node[] nodes = new Node[2];

		nodes[0] = triple.getPredicate();
		nodes[1] = triple.getObject();
		// nodes[2] = triple.getSubject();

		for (int i = 0; i < 2; i++) {
			Node node = nodes[i];

			if (!node.isBlank() && !node.isLiteral() && node.isURI()) {
				String uri = "";
				try {
					uri = node.getNameSpace();
					addToMap(uri, node.getLocalName());
				} catch (Exception e) {

				}
			}
		}

	}
}
 
开发者ID:AKSW,项目名称:semantic-ci,代码行数:30,代码来源:LocalGraph.java

示例13: fromNode

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
 * Convert a {@link Node} to an {@code Id}. The {@link Node} can be a URI or
 * a string literal. The preferred form is a {@code <uuid:...>}.
 * <p>
 * An argument of {@code null} returns {@code null}.
 * 
 * @param node
 * @return Id
 */
public static Id fromNode(Node node) {
    if ( node == null )
        return null ;
    
    String s = null ;
    
    if ( node.isURI() )
        s = node.getURI() ;
    else if ( Util.isSimpleString(node) )
        s = node.getLiteralLexicalForm() ;
    if ( s == null )
        throw new IllegalArgumentException("Id input is not a URI or a string") ;
    return fromString$(s) ;
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:24,代码来源:Id.java

示例14: SourcePlanImpl

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
 * The generation plan of a <code>{@code SOURCE <node> ACCEPT <mime> AS
 * <var>}</code> clause.
 *
 * @param node0 The IRI or the Variable node where a GET must be operated.
 * Must not be null.
 * @param accept0 The IRI or the Variable node that represent the accepted
 * Internet Media Type. May be null.
 * @param var0 The variable to bound the potentially retrieved document.
 * Must not be null.
 */
public SourcePlanImpl(
        final Node node0,
        final Node accept0,
        final Var var0) {
    Objects.requireNonNull(node0, "Node must not be null");
    Objects.requireNonNull(var0, "Var must not be null");
    if (!node0.isURI() && !node0.isVariable()) {
        throw new IllegalArgumentException("Source node must be a IRI or a"
                + " Variable. got " + node0);
    }
    this.node = node0;
    this.accept = accept0;
    this.var = var0;
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:26,代码来源:SourcePlanImpl.java

示例15: getAcceptHeader

import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
 * returns the accept header computed from ACCEPT clause.
 *
 * @param binding -
 * @return the actual accept header to use.
 */
private String getAcceptHeader(
        final BindingHashMapOverwrite binding) {
    Node actualAccept = accept;
    if (accept == null) {
        return "*/*";
    }
    if (accept.isVariable()) {
        actualAccept = binding.get((Var) accept);
        if (accept == null) {
            return "*/*";
        }
    }
    if (!actualAccept.isURI()) {
        throw new SPARQLGenerateException("Variable " + node.getName()
                + " must be bound to a IRI that represents the internet"
                + " media type of the source to be fetched. For"
                + " instance, <http://www.iana.org/assignments/media-types/application/xml>.");
    }
    if (!actualAccept.getURI().startsWith("http://www.iana.org/assignments/media-types/")) {
        throw new SPARQLGenerateException("Variable " + node.getName()
                + " must be bound to a IANA MIME URN (RFC to be"
                + " written). For instance,"
                + " <http://www.iana.org/assignments/media-types/application/xml>.");
    }
    return actualAccept.getURI();

}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:34,代码来源:SourcePlanImpl.java


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