本文整理汇总了C#中System.Uri.ToSafeString方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.ToSafeString方法的具体用法?C# Uri.ToSafeString怎么用?C# Uri.ToSafeString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Uri
的用法示例。
在下文中一共展示了Uri.ToSafeString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: if
/// <summary>
/// Gets a Graph from the Dataset
/// </summary>
/// <param name="graphUri">Graph URI</param>
/// <returns></returns>
/// <remarks>
/// If the Graph has been modified during the active Transaction the modified version is returned rather than the original version
/// </remarks>
public sealed override IGraph this[Uri graphUri]
{
get
{
if (graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri))
{
if (this.DefaultGraph != null)
{
return this.DefaultGraph;
}
else if (this._modifiableGraphs.HasGraph(graphUri))
{
return this._modifiableGraphs.Graph(graphUri);
}
else
{
return this.GetGraphInternal(null);
}
}
else if (this._modifiableGraphs.HasGraph(graphUri))
{
return this._modifiableGraphs.Graph(graphUri);
}
else
{
return this.GetGraphInternal(graphUri);
}
}
}
示例2: GraphExists
/// <summary>
/// Sends a HEAD Command to the Protocol Server to determine whether a given Graph exists
/// </summary>
/// <param name="graphUri">URI of the Graph to check for</param>
public virtual bool GraphExists(Uri graphUri)
{
return this.GraphExists(graphUri.ToSafeString());
}
示例3: Load
/// <summary>
/// Loads a Graph from the SQL Store into a Graph object
/// </summary>
/// <param name="graphUri">Uri of the Graph to load</param>
/// <returns></returns>
public IGraph Load(Uri graphUri)
{
Graph g = new Graph();
try
{
//Get the Database Connection
this._manager.Open(true);
//Retrieve the existing Graph ID if any
if (!this._manager.Exists(graphUri))
{
throw new RdfStorageException("The Graph '" + graphUri.ToSafeString() + "' does not exist in the underlying Store");
}
String graphID = this._manager.GetGraphID(graphUri);
g.BaseUri = graphUri;
//Load Namespaces
this._manager.LoadNamespaces(g, graphID);
//Load Triples
this._manager.LoadTriples(g, graphID);
this._manager.Close(true);
}
catch
{
this._manager.Close(true, true);
throw;
}
return g;
}
示例4: RemoveGraph
/// <summary>
/// Removes a Graph from the Dataset
/// </summary>
/// <param name="graphUri">Graph URI</param>
public override sealed void RemoveGraph(Uri graphUri)
{
if (graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri))
{
if (this.DefaultGraphUris.Any())
{
foreach (Uri u in this.DefaultGraphUris)
{
if (this.IsDefaultGraph(u))
{
//Default Graph gets cleared
GraphPersistenceWrapper wrapper = new GraphPersistenceWrapper(this[u]);
wrapper.Clear();
this._actions.Add(new GraphPersistenceAction(wrapper, GraphPersistenceActionType.Modified));
}
else
{
//Other Graphs get actually deleted
this._actions.Add(new GraphPersistenceAction(this[u], GraphPersistenceActionType.Deleted));
}
}
}
else if (this.HasGraph(graphUri))
{
this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
this.RemoveGraphInternal(graphUri);
}
}
else if (this.HasGraph(graphUri))
{
this._actions.Add(new GraphPersistenceAction(this[graphUri], GraphPersistenceActionType.Deleted));
this.RemoveGraphInternal(graphUri);
}
}
示例5: LoadGraph
/// <summary>
/// Loads a Graph from the Store
/// </summary>
/// <param name="handler">RDF Handler</param>
/// <param name="graphUri">Uri of the Graph to load</param>
/// <remarks>If a Null Uri is specified then the default graph (statements with no context in Sesame parlance) will be loaded</remarks>
public virtual void LoadGraph(IRdfHandler handler, Uri graphUri)
{
this.LoadGraph(handler, graphUri.ToSafeString());
}
示例6: AffectsGraph
/// <summary>
/// Gets whether this Command affects the given Graph
/// </summary>
/// <param name="graphUri">Graph URI</param>
/// <returns></returns>
public override bool AffectsGraph(Uri graphUri)
{
switch (this._mode)
{
case ClearMode.All:
return true;
case ClearMode.Default:
return graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri);
case ClearMode.Named:
return graphUri != null && !graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri);
case ClearMode.Graph:
if (this._graphUri == null)
{
return graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri);
}
else
{
return this._graphUri.ToString().Equals(graphUri.ToSafeString());
}
default:
//No Other Clear Modes but have to keep the compiler happy
return true;
}
}
示例7: FusekiConnector
/// <summary>
/// Creates a new connection to a Fuseki Server
/// </summary>
/// <param name="serviceUri">The /data URI of the Fuseki Server</param>
public FusekiConnector(Uri serviceUri)
: this(serviceUri.ToSafeString())
{
}
示例8: DeleteGraph
/// <summary>
/// Deletes a Graph from the Sesame store
/// </summary>
/// <param name="graphUri">URI of the Graph to delete</param>
public virtual void DeleteGraph(Uri graphUri)
{
this.DeleteGraph(graphUri.ToSafeString());
}
示例9: IsValidPlainLiteral
/// <summary>
/// Determines whether a given String is a valid Plain Literal for the given Datatype
/// </summary>
/// <param name="value">Value</param>
/// <param name="dt">Datatype</param>
/// <param name="syntax">Turtle Syntax</param>
/// <returns></returns>
public static bool IsValidPlainLiteral(String value, Uri dt, TurtleSyntax syntax)
{
StringComparison comparison = (syntax == TurtleSyntax.Original ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
if ((value.Equals("true", comparison) || value.Equals("false", comparison)) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeBoolean))
{
return true;
}
else if (_validDecimal.IsMatch(value) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeDecimal))
{
return true;
}
else if (_validInteger.IsMatch(value) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeInteger))
{
return true;
}
else if (_validDouble.IsMatch(value) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeDouble))
{
return true;
}
else
{
return false;
}
}
示例10: RemoveGraphInternal
/// <summary>
/// Removes a Graph from the Dataset
/// </summary>
/// <param name="graphUri">Graph URI</param>
protected override void RemoveGraphInternal(Uri graphUri)
{
if (graphUri == null || graphUri.ToSafeString().Equals(GraphCollection.DefaultGraphUri))
{
if (this._store.HasGraph(null))
{
this._store.Graphs[null].Clear();
}
}
else
{
this._store.Remove(graphUri);
}
}
示例11: Contains
public override bool Contains(Uri graphUri)
{
if (base.Contains(graphUri))
{
return true;
}
else if (!this._removedGraphs.Contains(graphUri.ToSafeString()))
{
//Try and load the Graph and return true if anything is returned
Graph g = new Graph();
try
{
this._manager.LoadGraph(g, graphUri);
if (g.Triples.Count > 0)
{
//If we're going to return true we must also store the Graph in the collection
//for later use
g.BaseUri = graphUri;
this.Add(g, true);
return true;
}
else
{
return false;
}
}
catch
{
//If trying to load the Graph errors then it doesn't exist so return false
return false;
}
}
else
{
return false;
}
}
示例12: Describe
/// <summary>
/// Gets the Graph describing the given resource from the Store
/// </summary>
/// <param name="handler">RDF Handler</param>
/// <param name="resourceUri">URI of Resource to Describe</param>
public void Describe(IRdfHandler handler, Uri resourceUri)
{
if (!resourceUri.Equals(String.Empty))
{
this.DescribeInternal(handler, resourceUri.ToSafeString(), "meta");
}
}
示例13: SparqlHttpProtocolConnector
/// <summary>
/// Creates a new SPARQL Graph Store HTTP Protocol Connector
/// </summary>
/// <param name="serviceUri">URI of the Protocol Server</param>
/// <param name="proxy">Proxy Server</param>
public SparqlHttpProtocolConnector(Uri serviceUri, WebProxy proxy)
: this(serviceUri.ToSafeString(), proxy)
{
}
示例14: SparqlHttpProtocolConnector
/// <summary>
/// Creates a new SPARQL Graph Store HTTP Protocol Connector
/// </summary>
/// <param name="serviceUri">URI of the Protocol Server</param>
public SparqlHttpProtocolConnector(Uri serviceUri)
: this(serviceUri.ToSafeString()) { }
示例15: IsValidPlainLiteral
/// <summary>
/// Determines whether a given String is a valid Plain Literal for the given Datatype
/// </summary>
/// <param name="value">Value</param>
/// <param name="dt">Datatype</param>
/// <returns></returns>
public static bool IsValidPlainLiteral(String value, Uri dt)
{
if ((value.Equals("true") || value.Equals("false")) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeBoolean))
{
return true;
}
else if (_validDecimal.IsMatch(value) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeDecimal))
{
return true;
}
else if (_validInteger.IsMatch(value) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeInteger))
{
return true;
}
else if (_validDouble.IsMatch(value) && dt.ToSafeString().Equals(XmlSpecsHelper.XmlSchemaDataTypeDouble))
{
return true;
}
else
{
return false;
}
}