本文整理汇总了C#中INode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# INode.ToString方法的具体用法?C# INode.ToString怎么用?C# INode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INode
的用法示例。
在下文中一共展示了INode.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryLoadObject
/// <summary>
/// Tries to load a SPARQL Dataset based on information from the Configuration Graph
/// </summary>
/// <param name="g">Configuration Graph</param>
/// <param name="objNode">Object Node</param>
/// <param name="targetType">Target Type</param>
/// <param name="obj">Output Object</param>
/// <returns></returns>
public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
{
obj = null;
switch (targetType.FullName)
{
case InMemoryDataset:
INode storeNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyUsingStore));
if (storeNode == null)
{
throw new DotNetRdfConfigurationException("Unable to load the In-Memory Dataset identified by the Node '" + objNode.ToString() + "' since there was no value given for the required property dnr:usingStore");
}
else
{
Object temp = ConfigurationLoader.LoadObject(g, storeNode);
if (temp is IInMemoryQueryableStore)
{
obj = new InMemoryDataset((IInMemoryQueryableStore)temp);
return true;
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the In-Memory Dataset identified by the Node '" + objNode.ToString() + "' since the Object pointed to by the dnr:usingStore property could not be loaded as an object which implements the IInMemoryQueryableStore interface");
}
}
#if !NO_DATA && !NO_STORAGE
case SqlDataset:
INode sqlManager = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertySqlManager));
if (sqlManager == null)
{
throw new DotNetRdfConfigurationException("Unable to load the SQL Dataset identified by the Node '" + objNode.ToString() + "' since there was no value given for the required property dnr:sqlManager");
}
else
{
Object temp = ConfigurationLoader.LoadObject(g, sqlManager);
if (temp is IDotNetRDFStoreManager)
{
obj = new SqlDataset((IDotNetRDFStoreManager)temp);
return true;
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the SQL Dataset identified by the Node '" + objNode.ToString() + "' since the Object pointed to by the dnr:sqlManager property could not be laoded as an object which implements the IDotNetRDFStoreManager interface");
}
}
#endif
}
return false;
}
示例2: TryLoadObject
public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
{
switch (targetType.FullName)
{
case FileManager:
String storeID = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDatabase));
if (storeID != null)
{
//Supports using dnr:loadMode to specify the indexes to be used
String indices = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyLoadMode));
if (indices == null)
{
obj = new AlexandriaFileManager(ConfigurationLoader.ResolvePath(storeID));
}
else
{
obj = new AlexandriaFileManager(ConfigurationLoader.ResolvePath(storeID), this.ParseIndexTypes(indices));
}
return true;
}
//If we get here then the required dnr:database property was missing
throw new DotNetRdfConfigurationException("Unable to load the File Manager identified by the Node '" + objNode.ToString() + "' since there was no value given for the required property dnr:database");
break;
case FileDataset:
INode managerNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, "dnr:genericManager"));
if (managerNode == null)
{
throw new DotNetRdfConfigurationException("Unable to load the File Dataset identified by the Node '" + objNode.ToString() + "' since there we no value for the required property dnr:genericManager");
}
Object temp = ConfigurationLoader.LoadObject(g, managerNode);
if (temp is AlexandriaFileManager)
{
obj = new AlexandriaFileDataset((AlexandriaFileManager)temp);
return true;
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the File Dataset identified by the Node '" + objNode.ToString() + "' since the value for the dnr:genericManager property pointed to an Object which could not be loaded as an object of type AlexandriaFileManager");
}
break;
}
obj = null;
return false;
}
示例3: TryLoadObject
/// <summary>
/// Tries to load a SPARQL Query/Algebra Optimiser based on information from the Configuration Graph
/// </summary>
/// <param name="g">Configuration Graph</param>
/// <param name="objNode">Object Node</param>
/// <param name="targetType">Target Type</param>
/// <param name="obj">Output Object</param>
/// <returns></returns>
public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
{
obj = null;
Object temp;
switch (targetType.FullName)
{
case QueryOptimiserDefault:
obj = new DefaultOptimiser();
break;
case QueryOptimiserNoReorder:
obj = new NoReorderOptimiser();
break;
case QueryOptimiserWeighted:
INode statsObj = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyUsingGraph));
if (statsObj != null)
{
temp = ConfigurationLoader.LoadObject(g, statsObj);
if (temp is IGraph)
{
obj = new WeightedOptimiser((IGraph)temp);
}
else
{
throw new DotNetRdfConfigurationException("Unable to create the Weighted Query Optimiser identified by the Node '" + objNode.ToString() + "' since the dnr:usingGraph property points to an object that cannot be loaded as an Object that imlements the required IGraph interface");
}
}
else
{
obj = new WeightedOptimiser();
}
break;
default:
//Try and create an Algebra Optimiser
try
{
obj = (IAlgebraOptimiser)Activator.CreateInstance(targetType);
}
catch
{
//Any error means this loader can't load this type
return false;
}
break;
}
//Return true only if we've loaded something into the output object
if (obj != null)
{
return true;
}
else
{
return false;
}
}
示例4: Generate
/// <summary>
/// Generates the specified node.
/// </summary>
/// <param name="node">The node.</param>
/// <param name="outputLocation">The location that the output should be placed.</param>
/// <returns>The result of the generation</returns>
public IMessage Generate(INode node, string outputLocation)
{
if (node == null)
return new Message("No data to generate");
if (string.IsNullOrEmpty(outputLocation))
return new Message("Output location not specified");
new FileInfo(outputLocation).Write(node.ToString());
return new Message("Successfully compiled");
}
示例5: ToJenaNode
public static RDFNode ToJenaNode(INode n, JenaMapping mapping)
{
switch (n.NodeType)
{
case NodeType.Uri:
return mapping.Model.createResource(n.ToString());
case NodeType.Blank:
if (mapping.OutputMapping.ContainsKey(n))
{
return mapping.OutputMapping[n];
}
else
{
AnonId id = new AnonId(((IBlankNode)n).InternalID);
Resource bnode = mapping.Model.createResource(id);
mapping.OutputMapping.Add(n, bnode);
if (!mapping.InputMapping.ContainsKey(bnode))
{
mapping.InputMapping.Add(bnode, n);
}
return bnode;
}
case NodeType.Literal:
ILiteralNode lit = (ILiteralNode)n;
if (lit.DataType != null)
{
return mapping.Model.createTypedLiteral(lit.Value, TypeMapper.getInstance().getSafeTypeByName(lit.DataType.ToString()));
}
else if (!lit.Language.Equals(String.Empty))
{
return mapping.Model.createLiteral(lit.Value, lit.Language);
}
else
{
return mapping.Model.createLiteral(lit.Value);
}
default:
throw new RdfException("Only URI/Blank/Literal Nodes can be converted to Jena Nodes");
}
}
示例6: BaseQueryHandlerConfiguration
/// <summary>
/// Creates a new Query Handler Configuration
/// </summary>
/// <param name="context">HTTP Context</param>
/// <param name="g">Configuration Graph</param>
/// <param name="objNode">Object Node</param>
public BaseQueryHandlerConfiguration(HttpContext context, IGraph g, INode objNode)
: base(context, g, objNode)
{
//Get the Query Processor to be used
ISparqlQueryProcessor processor;
INode procNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyQueryProcessor));
if (procNode == null) throw new DotNetRdfConfigurationException("Unable to load Query Handler Configuration as the RDF configuration file does not specify a dnr:queryProcessor property for the Handler");
Object temp = ConfigurationLoader.LoadObject(g, procNode);
if (temp is ISparqlQueryProcessor)
{
processor = (ISparqlQueryProcessor)temp;
}
else
{
throw new DotNetRdfConfigurationException("Unable to load Query Handler Configuration as the RDF configuration file specifies a value for the Handlers dnr:updateProcessor property which cannot be loaded as an object which implements the ISparqlQueryProcessor interface");
}
this._processor = processor;
//SPARQL Query Default Config
this._defaultGraph = ConfigurationLoader.GetConfigurationValue(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDefaultGraphUri)).ToSafeString();
this._defaultTimeout = ConfigurationLoader.GetConfigurationInt64(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyTimeout), this._defaultTimeout);
this._defaultPartialResults = ConfigurationLoader.GetConfigurationBoolean(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyPartialResults), this._defaultPartialResults);
//Handler Configuration
this._showQueryForm = ConfigurationLoader.GetConfigurationBoolean(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyShowQueryForm), this._showQueryForm);
String defQueryFile = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDefaultQueryFile));
if (defQueryFile != null)
{
defQueryFile = ConfigurationLoader.ResolvePath(defQueryFile);
if (File.Exists(defQueryFile))
{
using (StreamReader reader = new StreamReader(defQueryFile))
{
this._defaultQuery = reader.ReadToEnd();
reader.Close();
}
}
}
//Get Query Syntax to use
try
{
String syntaxSetting = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertySyntax));
if (syntaxSetting != null)
{
this._syntax = (SparqlQuerySyntax)Enum.Parse(typeof(SparqlQuerySyntax), syntaxSetting);
}
}
catch (Exception ex)
{
throw new DotNetRdfConfigurationException("Unable to set the Syntax for the HTTP Handler identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:syntax property was not a valid value from the enum VDS.RDF.Parsing.SparqlQuerySyntax", ex);
}
//Get the SPARQL Describe Algorithm
INode describeNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDescribeAlgorithm));
if (describeNode != null)
{
if (describeNode.NodeType == NodeType.Literal)
{
String algoClass = ((ILiteralNode)describeNode).Value;
try
{
Object desc = Activator.CreateInstance(Type.GetType(algoClass));
if (desc is ISparqlDescribe)
{
this._describer = (ISparqlDescribe)desc;
}
else
{
throw new DotNetRdfConfigurationException("Unable to set the Describe Algorithm for the HTTP Handler identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:describeAlgorithm property was not a type name of a type that implements the ISparqlDescribe interface");
}
}
catch (DotNetRdfConfigurationException)
{
throw;
}
catch (Exception ex)
{
throw new DotNetRdfConfigurationException("Unable to set the Describe Algorithm for the HTTP Handler identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:describeAlgorithm property was not a type name for a type that can be instantiated", ex);
}
}
}
//Get the Service Description Graph
INode descripNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyServiceDescription));
if (descripNode != null)
{
Object descrip = ConfigurationLoader.LoadObject(g, descripNode);
if (descrip is IGraph)
{
this._serviceDescription = (IGraph)descrip;
}
else
{
//.........这里部分代码省略.........
示例7: GetNextNodeID
/// <summary>
/// Gets the next available Database Node ID if the Node is not in the Database or the existing Database Node ID
/// </summary>
/// <param name="n">Node to get an ID for</param>
/// <param name="createRequired">Whether the Manager needs to create a Node Record in the Database</param>
/// <returns></returns>
protected virtual int GetNextNodeID(INode n, out bool createRequired)
{
int id = -1;
createRequired = false;
try
{
Monitor.Enter(this._nodeIDs);
if (this._nextNodeID == -1)
{
this.LoadNodeIDMap();
}
if (this._nodeIDs.ContainsKey(n.GetHashCode()))
{
id = this._nodeIDs[n.GetHashCode()];
//Use the Node Collection to record Nodes we've requested IDs for
//This allows us to take advantage of the Node Collections ability to detect
//when Node Hash Codes collide and then we can use this in the next step to
//do a Database lookup if necessary
if (!this._nodeCollection.Contains(n))
{
this._nodeCollection.Add(n);
}
if (id == -1 || n.Collides)
{
//There are multiple Nodes with this Hash Code
//Lookup from Database
String getNodeID = "SELECT nodeID FROM NODES WHERE nodeType=" + (int)n.NodeType + " AND nodeValue=N'" + this.EscapeString(n.ToString()) + "'";
Object nodeID = this.ExecuteScalar(getNodeID);
if (nodeID != null)
{
return Int32.Parse(nodeID.ToString());
}
else
{
id = ++this._nextNodeID;
createRequired = true;
}
}
}
else
{
id = ++this._nextNodeID;
this._nodeIDs.Add(n.GetHashCode(), id);
createRequired = true;
}
}
finally
{
Monitor.Exit(this._nodeIDs);
}
if (id != -1)
{
return id;
}
else
{
throw new RdfStorageException("Error obtaining a Node ID");
}
}
示例8: TryLoadObject
/// <summary>
/// Tries to load a SPARQL Endpoint based on information from the Configuration Graph
/// </summary>
/// <param name="g">Configuration Graph</param>
/// <param name="objNode">Object Node</param>
/// <param name="targetType">Target Type</param>
/// <param name="obj">Output Object</param>
/// <returns></returns>
public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
{
BaseEndpoint endpoint = null;
obj = null;
switch (targetType.FullName)
{
case Endpoint:
String endpointUri = ConfigurationLoader.GetConfigurationValue(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyEndpointUri));
if (endpointUri == null) return false;
//Get Default/Named Graphs if specified
IEnumerable<String> defaultGraphs = from n in ConfigurationLoader.GetConfigurationData(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDefaultGraphUri))
select n.ToString();
IEnumerable<String> namedGraphs = from n in ConfigurationLoader.GetConfigurationData(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyNamedGraphUri))
select n.ToString();
endpoint = new SparqlRemoteEndpoint(new Uri(endpointUri), defaultGraphs, namedGraphs);
break;
#if !SILVERLIGHT
case FederatedEndpoint:
IEnumerable<INode> endpoints = ConfigurationLoader.GetConfigurationData(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyEndpoint));
foreach (INode e in endpoints)
{
Object temp = ConfigurationLoader.LoadObject(g, e);
if (temp is SparqlRemoteEndpoint)
{
if (endpoint == null)
{
endpoint = new FederatedSparqlRemoteEndpoint((SparqlRemoteEndpoint)temp);
}
else
{
((FederatedSparqlRemoteEndpoint)endpoint).AddEndpoint((SparqlRemoteEndpoint)temp);
}
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the SPARQL Endpoint identified by the Node '" + e.ToString() + "' as one of the values for the dnr:endpoint property points to an Object which cannot be loaded as an object which is a SparqlRemoteEndpoint");
}
}
break;
#endif
}
if (endpoint != null)
{
//Are there any credentials specified?
String user, pwd;
ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);
if (user != null && pwd != null)
{
endpoint.SetCredentials(user, pwd);
}
#if !NO_PROXY
//Is there a Proxy Server specified
INode proxyNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyProxy));
if (proxyNode != null)
{
Object proxy = ConfigurationLoader.LoadObject(g, proxyNode);
if (proxy is WebProxy)
{
endpoint.Proxy = (WebProxy)proxy;
//Are we supposed to use the same credentials for the proxy as for the endpoint?
bool useCredentialsForProxy = ConfigurationLoader.GetConfigurationBoolean(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyUseCredentialsForProxy), false);
if (useCredentialsForProxy)
{
endpoint.UseCredentialsForProxy = true;
}
}
else
{
throw new DotNetRdfConfigurationException("Unable to load SPARQL Endpoint identified by the Node '" + objNode.ToString() + "' as the value for the dnr:proxy property points to an Object which cannot be loaded as an object of type WebProxy");
}
}
#endif
}
obj = endpoint;
return (endpoint != null);
}
示例9: getLabel
/// <summary>
/// Gets label of given node.
/// </summary>
/// <param name="node">Node</param>
/// <param name="endpointLink">Sparql query end-point url</param>
/// <returns>String of the node label</returns>
string getLabel(INode node,string endpointLink)
{
if (node.NodeType.ToString() == "Uri")
{
SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri(endpointLink));
SparqlResultSet results = endpoint.QueryWithResultSet("select ?x where {<" + node.ToString() + "> <http://www.w3.org/2000/01/rdf-schema#label> ?x}");
if (results.Count != 0)
{
return results[0].Value("x").ToString();
}
else
return "No Label";
}
else
return node.ToString();
}
示例10: EncapNode
/// <summary>
/// Take a node (subject, predicate, object) and return it
/// properly formatted as a string you could use in SPARQL;
/// ie http://fynydd.com = <http://fynydd.com>
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string EncapNode(INode value)
{
switch (value.NodeType)
{
case NodeType.Literal:
return "\"" + value.ToString() + "\"";
break;
case NodeType.Uri:
return "<" + value.ToString() + ">";
break;
case NodeType.Blank:
return "_:blank";
break;
case NodeType.GraphLiteral: // not sure if this is right
return "\"" + value.ToString() + "\"";
break;
case NodeType.Variable: // not sure if this is right or matters
return "?" + value.ToString();
break;
}
return "";
}
示例11: LoadObject
/// <summary>
/// Loads the Object identified by the given Node based on information from the Configuration Graph
/// </summary>
/// <param name="g">Configuration Graph</param>
/// <param name="objNode">Object Node</param>
/// <returns></returns>
/// <remarks>
/// <para>
/// Use this overload when you have a Node which identifies an Object and you don't know what the type of that Object is. This function looks up the <strong>dnr:type</strong> property for the given Object and then calls the other version of this function providing it with the relevant type information.
/// </para>
/// </remarks>
public static Object LoadObject(IGraph g, INode objNode)
{
String typeName = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, "dnr:type"));
if (typeName == null)
{
typeName = GetDefaultType(g, objNode);
if (typeName == null)
{
throw new DotNetRdfConfigurationException("Unable to load the Object identified by the Node '" + objNode.ToString() + "' since there is no dnr:type property associated with it");
}
else
{
return ConfigurationLoader.LoadObject(g, objNode, Type.GetType(typeName));
}
}
else
{
return ConfigurationLoader.LoadObject(g, objNode, Type.GetType(typeName));
}
}
示例12: CheckCircularReference
/// <summary>
/// Checks for circular references and throws an error if there is one
/// </summary>
/// <param name="a">Object you are attempting to load</param>
/// <param name="b">Object being referenced</param>
/// <param name="property">QName for the property that makes the reference</param>
/// <remarks>
/// <para>
/// If the Object you are trying to load and the Object you need to load are equal then this is a circular reference and an error is thrown
/// </para>
/// <para>
/// The <see cref="ConfigurationLoader">ConfigurationLoader</see> is not currently capable of detecting more subtle circular references
/// </para>
/// </remarks>
public static bool CheckCircularReference(INode a, INode b, String property)
{
if (a.Equals(b))
{
throw new DotNetRdfConfigurationException("Unable to load the Object identified by the Node '" + a.ToString() + "' as one of the values for the " + property + " property is a circular reference to the Object we are attempting to load");
}
else
{
return false;
}
}
示例13: Add
/// <summary>
/// Adds a node to the completion data
/// </summary>
/// <param name="Node"></param>
public void Add(INode Node)
{
expansions += Node.ToString() + "\n";
}
示例14: TryLoadObject
/// <summary>
/// Tries to load a SPARQL Query Processor based on information from the Configuration Graph
/// </summary>
/// <param name="g">Configuration Graph</param>
/// <param name="objNode">Object Node</param>
/// <param name="targetType">Target Type</param>
/// <param name="obj">Output Object</param>
/// <returns></returns>
public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
{
obj = null;
ISparqlQueryProcessor processor = null;
INode storeObj;
Object temp;
switch (targetType.FullName)
{
case LeviathanQueryProcessor:
INode datasetObj = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyUsingDataset));
if (datasetObj != null)
{
temp = ConfigurationLoader.LoadObject(g, datasetObj);
if (temp is ISparqlDataset)
{
processor = new LeviathanQueryProcessor((ISparqlDataset)temp);
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the Leviathan Query Processor identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:usingDataset property points to an Object that cannot be loaded as an object which implements the ISparqlDataset interface");
}
}
else
{
//If no dnr:usingDataset try dnr:usingStore instead
storeObj = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyUsingStore));
if (storeObj == null) return false;
temp = ConfigurationLoader.LoadObject(g, storeObj);
if (temp is IInMemoryQueryableStore)
{
processor = new LeviathanQueryProcessor((IInMemoryQueryableStore)temp);
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the Leviathan Query Processor identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:usingStore property points to an Object that cannot be loaded as an object which implements the IInMemoryQueryableStore interface");
}
}
break;
case SimpleQueryProcessor:
storeObj = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyUsingStore));
if (storeObj == null) return false;
temp = ConfigurationLoader.LoadObject(g, storeObj);
if (temp is INativelyQueryableStore)
{
processor = new SimpleQueryProcessor((INativelyQueryableStore)temp);
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the Simple Query Processor identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:usingStore property points to an Object that cannot be loaded as an object which implements the INativelyQueryableStore interface");
}
break;
#if !NO_STORAGE
case GenericQueryProcessor:
INode managerObj = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyGenericManager));
if (managerObj == null) return false;
temp = ConfigurationLoader.LoadObject(g, managerObj);
if (temp is IQueryableGenericIOManager)
{
processor = new GenericQueryProcessor((IQueryableGenericIOManager)temp);
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the Generic Query Processor identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:genericManager property points to an Object that cannot be loaded as an object which implements the IQueryableGenericIOManager interface");
}
break;
#endif
#if !SILVERLIGHT
case RemoteQueryProcessor:
INode endpointObj = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyEndpoint));
if (endpointObj == null) return false;
temp = ConfigurationLoader.LoadObject(g, endpointObj);
if (temp is SparqlRemoteEndpoint)
{
processor = new RemoteQueryProcessor((SparqlRemoteEndpoint)temp);
}
else
{
throw new DotNetRdfConfigurationException("Unable to load the Remote Query Processor identified by the Node '" + objNode.ToSafeString() + "' as the value given for the dnr:endpoint property points to an Object that cannot be loaded as an object which is a SparqlRemoteEndpoint");
}
break;
case PelletQueryProcessor:
String server = ConfigurationLoader.GetConfigurationValue(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyServer));
if (server == null) return false;
String kb = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyStore));
//.........这里部分代码省略.........
示例15: GeneratePredicateNode
private XmlElement GeneratePredicateNode(RdfXmlWriterContext context, INode p, ref int nextNamespaceID, List<String> tempNamespaces, XmlDocument doc, XmlElement subj)
{
XmlElement pred;
switch (p.NodeType)
{
case NodeType.GraphLiteral:
throw new RdfOutputException(WriterErrorMessages.GraphLiteralsUnserializable("RDF/XML"));
case NodeType.Blank:
throw new RdfOutputException(WriterErrorMessages.BlankPredicatesUnserializable("RDF/XML"));
case NodeType.Literal:
throw new RdfOutputException(WriterErrorMessages.LiteralPredicatesUnserializable("RDF/XML"));
case NodeType.Uri:
//OK
UriRefType rtype;
String predRef = this.GenerateUriRef(context, (IUriNode)p, UriRefType.QName, tempNamespaces, out rtype);
if (rtype != UriRefType.QName)
{
this.GenerateTemporaryNamespace(context, (IUriNode)p, ref nextNamespaceID, tempNamespaces, doc);
predRef = this.GenerateUriRef(context, (IUriNode)p, UriRefType.QName, tempNamespaces, out rtype);
if (rtype != UriRefType.QName)
{
throw new RdfOutputException(WriterErrorMessages.UnreducablePropertyURIUnserializable + " - '" + p.ToString() + "'");
}
}
pred = this.GenerateElement(context, predRef, doc);
break;
default:
throw new RdfOutputException(WriterErrorMessages.UnknownNodeTypeUnserializable("RDF/XML"));
}
//Write the Predicate
subj.AppendChild(pred);
return pred;
}