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


Java Node.getURI方法代碼示例

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


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

示例1: transform

import org.apache.jena.graph.Node; //導入方法依賴的package包/類
public static GraphTraversal<?, ?> transform(final Triple triple) {
    final GraphTraversal<Vertex, ?> matchTraversal = __.as(triple.getSubject().getName());
    
    final Node predicate = triple.getPredicate();
    final String uri = predicate.getURI();
    final String uriValue = Prefixes.getURIValue(uri);
    final String prefix = Prefixes.getPrefix(uri);

    switch (prefix) {
        case "edge":
            return matchTraversal.out(uriValue).as(triple.getObject().getName());
        case "property":
            return matchProperty(matchTraversal, uriValue, PropertyType.PROPERTY, triple.getObject());
        case "value":
            return matchProperty(matchTraversal, uriValue, PropertyType.VALUE, triple.getObject());
        default:
            throw new IllegalStateException(String.format("Unexpected predicate: %s", predicate));
    }
}
 
開發者ID:LITMUS-Benchmark-Suite,項目名稱:sparql-to-gremlin,代碼行數:20,代碼來源:TraversalBuilder.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: MotifFilter

import org.apache.jena.graph.Node; //導入方法依賴的package包/類
public MotifFilter(Node s, Node p, Node o) {
	this.s = s;
	this.p = p;
	this.o = o;
	
/*	if (!s.isConcrete()) {
		this.v = s.getName();
	}else {
		this.v=s.toString();
		v=v.substring(1, v.length()-1);	
	} */
	
	if (!s.isVariable()) {
		if (s.isLiteral()) {
			v=s.getLiteral().toString();
			vs=v;
		}else if (s.isURI()) {
			vs=s.getURI();
			PrefixBuilder subjectPrefix = new PrefixBuilder(s.getURI());
			v=subjectPrefix.getUriValue();
		}else if (s.isBlank()) {
			v = null;
		}
	}  
				
	if (!p.isVariable()) {
		if (p.isLiteral()) {
			e=p.getLiteral().toString();
			ep=e;
		}else if (p.isURI()) {
			ep=p.getURI();
			PrefixBuilder predicatePrefix = new PrefixBuilder(p.getURI());
			e= predicatePrefix.getUriValue();
		}else if (p.isBlank()) {
			e = null;
		}
	}
	if (!o.isVariable()) {
		if (o.isLiteral()) {
			v2=o.getLiteral().toString();
			v2o=v2;
		}else if (o.isURI()) {
			v2o=o.getURI();
			PrefixBuilder objectPrefix = new PrefixBuilder(o.getURI());
			v2=objectPrefix.getUriValue();
			
		}else if (o.isBlank()) {
			v2 = null;
		}
	}   
}
 
開發者ID:koneksys,項目名稱:SPARQL_to_GraphFrames,代碼行數:52,代碼來源:MotifFilter.java


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