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


Java GraphUtils类代码示例

本文整理汇总了Java中org.apache.jena.sparql.util.graph.GraphUtils的典型用法代码示例。如果您正苦于以下问题:Java GraphUtils类的具体用法?Java GraphUtils怎么用?Java GraphUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GraphUtils类属于org.apache.jena.sparql.util.graph包,在下文中一共展示了GraphUtils类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractGraphTags2

import org.apache.jena.sparql.util.graph.GraphUtils; //导入依赖的package包/类
public static Collection<?> extractGraphTags2(org.apache.jena.graph.Graph graph) {
    // TODO: All nodes does not include predicates
    Set<Node> result = Streams.stream(GraphUtils.allNodes(graph))
            .filter(n -> n.isURI() || n.isLiteral())
            .collect(Collectors.toSet());

    return result;
}
 
开发者ID:SmartDataAnalytics,项目名称:SubgraphIsomorphismIndex,代码行数:9,代码来源:SubgraphIsomorphismIndexJena.java

示例2: open

import org.apache.jena.sparql.util.graph.GraphUtils; //导入依赖的package包/类
@Override
public Model open(Assembler a, Resource root, Mode mode)
{
    String url = GraphUtils.getStringValue(root, ResourceFactory.createProperty(JENA_NS + "url")) ;

    try {
        // FIXME: Read more properties. Cache config?
        LinkedDataFragmentGraph graph = new LinkedDataFragmentGraph(url);
        return ModelFactory.createModelForGraph(graph);
    } catch (Exception e) {
        e.printStackTrace();
        throw new AssemblerException(root, "Error reading LDF url: "+url+" / "+e.toString());
    }
}
 
开发者ID:LinkedDataFragments,项目名称:Client.Java,代码行数:15,代码来源:LinkedDataFragmentsGraphAssembler.java

示例3: main

import org.apache.jena.sparql.util.graph.GraphUtils; //导入依赖的package包/类
public static void main(String... argv)
{
    String assemblerFile = "Store/tdb-assembler.ttl" ;
    
    // Find a particular description in the file where there are several: 
    Model spec = RDFDataMgr.loadModel(assemblerFile) ;

    // Find the right starting point for the description in some way.
    Resource root = null ;

    if ( false )
        // If you know the Resource URI:
        root = spec.createResource("http://example/myChoiceOfURI" );
    else
    {
        // Alternatively, look for the a single resource of the right type. 
        try {
            // Find the required description - the file can contain descriptions of many different types.
            root = GraphUtils.findRootByType(spec, VocabTDB.tDatasetTDB) ;
            if ( root == null )
                throw new JenaException("Failed to find a suitable root") ;
        } catch (TypeNotUniqueException ex)
        { throw new JenaException("Multiple types for: "+DatasetAssemblerVocab.tDataset) ; }
    }

    Dataset ds = (Dataset)Assembler.general.open(root) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:28,代码来源:ExTDB3.java


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