public static Object LoadFromFile(java.io.File f, string baseUri, org.openrdf.rio.RDFFormat rdff) { Object obj; if (rdff == dotSesameFormats.RDFFormat.N3) { obj = new Graph(); if (baseUri != null) ((IGraph)obj).BaseUri = new Uri(baseUri); FileLoader.Load((IGraph)obj, f.getPath(), new Notation3Parser()); } else if (rdff == dotSesameFormats.RDFFormat.NTRIPLES) { obj = new Graph(); if (baseUri != null) ((IGraph)obj).BaseUri = new Uri(baseUri); FileLoader.Load((IGraph)obj, f.getPath(), new NTriplesParser()); } else if (rdff == dotSesameFormats.RDFFormat.RDFXML) { obj = new Graph(); if (baseUri != null) ((IGraph)obj).BaseUri = new Uri(baseUri); FileLoader.Load((IGraph)obj, f.getPath(), new RdfXmlParser()); } else if (rdff == dotSesameFormats.RDFFormat.TRIG) { obj = new TripleStore(); TriGParser trig = new TriGParser(); trig.Load((ITripleStore)obj, new StreamParams(f.getPath())); } else if (rdff == dotSesameFormats.RDFFormat.TRIX) { obj = new TripleStore(); TriXParser trix = new TriXParser(); trix.Load((ITripleStore)obj, new StreamParams(f.getPath())); } else if (rdff == dotSesameFormats.RDFFormat.TURTLE) { obj = new Graph(); if (baseUri != null) ((IGraph)obj).BaseUri = new Uri(baseUri); FileLoader.Load((IGraph)obj, f.getPath(), new TurtleParser()); } else { throw new RdfParserSelectionException("The given Input Format is not supported by dotNetRDF"); } return obj; }
/// <summary>Constructs a new File using the path of the specified URI.</summary> /// <remarks> /// Constructs a new File using the path of the specified URI. /// <code>uri</code> /// needs to be an absolute and hierarchical Unified Resource Identifier with /// file scheme and non-empty path component, but with undefined authority, /// query or fragment components. /// </remarks> /// <param name="uri"> /// the Unified Resource Identifier that is used to construct this /// file. /// </param> /// <exception cref="System.ArgumentException"> /// if /// <code>uri</code> /// does not comply with the conditions above. /// </exception> /// <seealso cref="toURI()">toURI()</seealso> /// <seealso cref="java.net.URI">java.net.URI</seealso> public File (java.net.URI uri) { // check pre-conditions checkURI (uri); this.path = fixSlashes (uri.getPath ()); this.info = new FileInfo (this.path); }
/// <summary>Constructs a new file using the specified directory and name.</summary> /// <remarks>Constructs a new file using the specified directory and name.</remarks> /// <param name="dir">the directory where the file is stored.</param> /// <param name="name">the file's name.</param> /// <exception cref="System.ArgumentNullException"> /// if /// <code>name</code> /// is /// <code>null</code> /// . /// </exception> public File (java.io.File dir, string name) : this(dir == null ? null : dir.getPath(), name) { }
private static string GetPathFromFile(java.io.File file) { #if FIRST_PASS return null; #else return file.getPath(); #endif }