2017-09-21 38 views

回答

1

我似乎找到了我需要梅索德上this post

我的解決辦法:

//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")));