I am trying to extract RDF triples from XML files by using an existing ontology. I am using Java, and can use XPath to extract data from XML and Jena to read and write RDF documents and ontologies. How can I extract the relevant triples from the XML according to the existing ontology?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Forget about XPath to extract triples, it way easier and less problematic with Jena.
You can use the interface
SimpleSelector
together withmodel.listStatements
from Jena.In this example I am using SimpleSelector to find all the triples with a single property but you can implement the any search you need by customizing the method
selects
.You'll find more information here.
If you describe a bit more the ontology you are using and the type of search you need we might be able to help more.