Results 1 to 1 of 1

Thread: Reading a UDF

  1. #1
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    213
    Rep Power
    12

    Default Reading a UDF

    I am trying to read an RDF, and, following a tutorial I pasted the following code, however I am puzzled at how to query the "URI:" tags, I feel I am on the wrong track.

    I have reviewed some video tutorials on YouTube, not sure if they are complete.

    Java Code:
    import org.jsoup.Jsoup;
    import org.jsoup.nodes.Document;
    import org.apache.commons.*;
    import org.apache.jena.util.FileManager;
    import org.apache.jena.rdf.model.ModelFactoryBase; 
    import java.lang.Object;
    
    public class parseRDF {
    	public static void main (String... args)
    	{
    		Document result = Jsoup.parse("http://microsoft.com");
    		System.out.println(result.toString());
    		
    	}
    	static void sparqlTest()
    	{
    		String path = "C:\\Users\Administrator\\Downloads\\ics_5111_dataset\\ics_5111_dataset\\user_2\\User Activity";
    		FileManager.get().addLocatorClassLoader(Main.class.getClassLoader());
    		Model model = FileManager.get().loadModel(path);
    		String queryString = 
    				"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#"> 
    						+ "PREFIX foaf: <http:///xmlns.com/foaf/0.1/>"
    						+ "SELECT * WHERE { " + 
    						" ?uri?." +
    						"}";
    				Query query = QueryFactory.create(queryString);
    				QueryExecution qexec = QueryExecutionFactory.create(query,model);
    				try {
    					ResultSet results = qexec.execSelect();
    					while (results.hasNext())
    					{
    						QuerySolution soln = results.nextSolution();
    						Literal name = soln.Literal("x");
    						System.out.println(queryString);
    						Model m = Model;
    						
    					}
    				}
    				catch (Exception e) { System.out.println(e.Message())};
    				finally {
    					qexec.close();
    				}
    		
    	}
    }
    I am using Apache Jena, and, I was suggested to use JSoup, although there are other technologies to read RDFs that I might experiment with such as Python RDFLibraries

    It is noted that unfortunately it not possible to highlight
    Java Code:
     code
    tags in bold when one attempts to use bold.
    Last edited by jon80; 12-17-2015 at 09:41 AM.

Similar Threads

  1. Reading XML
    By JSN1 in forum XML
    Replies: 6
    Last Post: 05-16-2012, 06:43 PM
  2. Reading log
    By Darth Blue Ray in forum New To Java
    Replies: 1
    Last Post: 03-15-2011, 09:35 PM
  3. reading from a .txt
    By Flamespewer in forum New To Java
    Replies: 1
    Last Post: 09-14-2009, 08:35 AM
  4. Replies: 5
    Last Post: 08-21-2009, 11:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •