I need a source code with java and jena (or other languages) that ables to extract triples from a RDF file that has multiple ontology.
There is a source code in This Page but this code needs to determine an ontology in source code.
I need a source code that itself read ontology from rdf files and print Sujects,Predicate and Objects as string in URL format.
This is my rdf file: My Files
Can anybody help me to solve this problem?
You just need to have the same code as in here:
How to extract RDF triples from xml file using existing Ontology in java?
But without the predicate that filters the statements. For example ...
FileManager fManager = FileManager.get();
Model model = fManager.loadModel("some_file.rdf");
SimpleSelector selector = new SimpleSelector(null, null, (RDFNode)null) {
public boolean selects(Statement s)
{ return true; }
}
StmtIterator iter = model.listStatements(selector);
while(it.hasNext()) {
Statement stmt = iter.nextStatement();
System.out.print(stmt.getSubject().toString());
System.out.print(stmt.getPredicate().toString());
System.out.println(stmt.getObject().toString());
}
If this is not what you need, please explain your question in further detail. I do not fully understand it.