1

我真的不明白如何从主题 URINode 中读取谓词(URINodes)。

另外,是否有通过特定谓词值查找 IURINodes 的方法?

4

1 回答 1

1

我似乎在这篇文章中找到了我需要的方法!

我的解决方案:

//Path to RDF/XML file
pathToRDF = "c:\dotNetRdfExample\exampleRDF.xml"

// A IGraph Parser, implementing the IRdfReader interface (So it can work with RDF/XML formats)
RdfXmlParser rxpparser = new RdfXmlParser();

// Create a graph for the rdf data
Graph g = new Graph();

// Makes sure that the XML file is UTF8
StreamReader sr = new StreamReader(pathToRDF, true);

// Fill the empty IGraph, using the rdfXmlParser
rxpparser.Load(g, sr);

// Retrieve all triples with the specified predicate and object
IEnumerable<Triple> specificTriples = g.GetTriplesWithPredicateObject(g.CreateUriNode(UriFactory.Create("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")), 
        g.CreateUriNode(UriFactory.Create("http://www.projectenportfolio.nl/wiki/index.php/Speciaal:URIResolver/Category-3AHandelingsperspectief")));
于 2017-09-21T11:48:52.780 回答