3using System.Runtime.ExceptionServices;
5using System.Threading.Tasks;
37 if (!Source.IsAbsoluteUri || !
IsLocal(Source))
38 return Grade.NotAtAll;
53 if (!
string.IsNullOrEmpty(Source.Query))
60 ResourceMap.TryGetFileName(Source.AbsolutePath,
true, out
string _) ||
61 ResourceMap.TryGetFileName(
"/" + Source.Host + Source.AbsolutePath,
true, out
string _);
76 string XmlString =
null;
83 throw new Exception(
"No appropriate resource map registered.");
85 if (!ResourceMap.TryGetFileName(Source.AbsolutePath,
true, out
string FileName))
86 throw new Exception(
"Local resource file not found.");
102 if (Result is XmlDocument Xml)
105 if (Result is
string s)
117 catch (XmlException ex)
129 ExceptionDispatchInfo.Capture(ex).Throw();
136 StringBuilder sb =
new StringBuilder();
138 sb.Append(
"Graph not a semantic cube or semantic model: ");
139 sb.Append(Source.ToString());
140 sb.Append(
" Type of content returned: ");
141 sb.Append(Result?.GetType().FullName);
Contains information about a response to a content request.
object Decoded
Decoded object.
void AssertOk()
Asserts response is OK.
Static class managing encoding and decoding of internet content.
static string GetContentType(string FileExtension)
Gets the content type of an item, given its file extension. It uses the TryGetContentType to see if a...
static bool IsLocalDomain(string DomainOrHost, bool IncludeAlternativeDomains)
Checks if a domain or nost name is local.
static Task< ContentResponse > DecodeAsync(string ContentType, byte[] Data, Encoding Encoding, KeyValuePair< string, string >[] Fields, Uri BaseUri)
Decodes an object.
static async Task< InMemorySemanticCube > Create(ISemanticModel Model)
Creates an in-memory semantic cube from a semantic model.
Contains semantic information stored in an RDF document.
Contains semantic information stored in a turtle document. https://www.w3.org/TR/rdf12-turtle/ https:...
Helps with common XML-related tasks.
static XmlException AnnotateException(XmlException ex)
Creates a new XML Exception object, with reference to the source XML file, for information.
static XmlDocument ParseXml(string Xml)
Parses an XML Document from its string representation.
static bool IsValidXml(string Xml)
Checks if a string is valid XML
static async Task< byte[]> ReadAllBytesAsync(string FileName)
Reads a binary file asynchronously.
Static class that dynamically manages types and interfaces available in the runtime environment.
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Script runtime exception.
Base class for all nodes in a parsed script tree.
Graph source on the local machine.
static bool IsLocal(Uri Source)
Checks if an URI corresponds to a local file name resource.
async Task< ISemanticCube > LoadGraph(Uri Source, ScriptNode Node, bool NullIfNotFound, RequestOrigin Caller)
Loads the graph
Grade Supports(Uri Source)
How well a source with a given URI can be loaded by the class.
LocalContentSource()
Graph source on the local machine.
Tokens available in request.
Basic interface for Resource maps.
Interface for semantic cubes.
Interface for semantic models.
Interface for graph sources.