本文整理汇总了C#中VDS.RDF.Graph.GetTriplesWithSubjectPredicate方法的典型用法代码示例。如果您正苦于以下问题:C# Graph.GetTriplesWithSubjectPredicate方法的具体用法?C# Graph.GetTriplesWithSubjectPredicate怎么用?C# Graph.GetTriplesWithSubjectPredicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VDS.RDF.Graph
的用法示例。
在下文中一共展示了Graph.GetTriplesWithSubjectPredicate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComparisonElement
/// <summary>
/// Constructor creates new comparison element.
/// </summary>
/// <param name="uri">URI of the element</param>
/// <param name="node">Graph node of the element</param>
/// <param name="graph">Graph of the element</param>
public ComparisonElement(string uri, INode node, Graph graph)
{
elementURI = uri;
elementNode = node;
elementGraph = graph;
INode label = graph.CreateUriNode(new Uri("http://www.w3.org/2000/01/rdf-schema#label"));
List<Triple> t = new List<Triple>();
t.AddRange(graph.GetTriplesWithSubjectPredicate(node,label));
elementLabel = t[0].Object.ToString();
}
示例2: RunDeploy
//.........这里部分代码省略.........
config.AppSettings.Settings.Remove("dotNetRDFConfig");
config.AppSettings.Settings.Add("dotNetRDFConfig", "~/App_Data/" + Path.GetFileName(args[2]));
Console.WriteLine("rdfWebDeploy: Set the \"dotNetRDFConfig\" appSetting to \"~/App_Data/" + Path.GetFileName(args[2]) + "\"");
//Now load the Configuration Graph from the App_Data folder
Graph g = new Graph();
FileLoader.Load(g, Path.Combine(appDataFolder, args[2]));
Console.WriteLine("rdfWebDeploy: Successfully deployed required DLLs and appSettings");
Console.WriteLine();
//Get the sections of the Configuration File we want to edit
HttpHandlersSection handlersSection = config.GetSection("system.web/httpHandlers") as HttpHandlersSection;
if (handlersSection == null)
{
Console.Error.WriteLine("rdfWebDeploy: Error: Unable to access the Handlers section of the web applications Web.Config file");
return;
}
//Detect Handlers from the Configution Graph and deploy
IUriNode rdfType = g.CreateUriNode(new Uri(RdfSpecsHelper.RdfType));
IUriNode dnrType = g.CreateUriNode(new Uri(ConfigurationLoader.ConfigurationNamespace + "type"));
IUriNode httpHandler = g.CreateUriNode(new Uri(ConfigurationLoader.ConfigurationNamespace + "HttpHandler"));
//Deploy for IIS Classic Mode
if (!this._noClassicRegistration)
{
Console.WriteLine("rdfWebDeploy: Attempting deployment for IIS Classic Mode");
foreach (INode n in g.GetTriplesWithPredicateObject(rdfType, httpHandler).Select(t => t.Subject))
{
if (n.NodeType == NodeType.Uri)
{
String handlerPath = ((IUriNode)n).Uri.AbsolutePath;
INode type = g.GetTriplesWithSubjectPredicate(n, dnrType).Select(t => t.Object).FirstOrDefault();
if (type == null)
{
Console.Error.WriteLine("rdfWebDeploy: Error: Cannot deploy the Handler <" + n.ToString() + "> as there is no dnr:type property specified");
continue;
}
if (type.NodeType == NodeType.Literal)
{
String handlerType = ((ILiteralNode)type).Value;
//First remove any existing registration
handlersSection.Handlers.Remove("*", handlerPath);
//Then add the new registration
handlersSection.Handlers.Add(new HttpHandlerAction(handlerPath, handlerType, "*"));
Console.WriteLine("rdfWebDeploy: Deployed the Handler <" + n.ToString() + "> to the web applications Web.Config file");
}
else
{
Console.Error.WriteLine("rdfWebDeploy: Error: Cannot deploy the Handler <" + n.ToString() + "> as the value given for the dnr:type property is not a Literal");
continue;
}
}
else
{
Console.Error.WriteLine("rdfWebDeploy: Error: Cannot deploy a Handler which is not specified as a URI Node");
}
}
//Deploy Negotiate by File Extension if appropriate
if (this._negotiate)
{
示例3: RunXmlDeploy
//.........这里部分代码省略.........
}
else if (systemWebNodes.Count > 1)
{
Console.Error.WriteLine("rdfWebDeploy: Error: The Configuration File for the Web Application appears to be invalid as more than one <system.web> node exists");
return;
}
else
{
systemWeb = (XmlElement)systemWebNodes[0];
}
XmlNodeList httpHandlersNodes = systemWeb.GetElementsByTagName("httpHandlers");
XmlElement httpHandlers;
if (httpHandlersNodes.Count == 0)
{
httpHandlers = config.CreateElement("httpHandlers");
systemWeb.AppendChild(httpHandlers);
}
else if (httpHandlersNodes.Count > 1)
{
Console.Error.WriteLine("rdfWebDeploy: Error: The Configuration File for the Web Application appears to be invalid as more than one <httpHandlers> node exists");
return;
}
else
{
httpHandlers = (XmlElement)httpHandlersNodes[0];
}
foreach (INode n in g.GetTriplesWithPredicateObject(rdfType, httpHandlerType).Select(t => t.Subject))
{
if (n.NodeType == NodeType.Uri)
{
String handlerPath = ((IUriNode)n).Uri.AbsolutePath;
INode type = g.GetTriplesWithSubjectPredicate(n, dnrType).Select(t => t.Object).FirstOrDefault();
if (type == null)
{
Console.Error.WriteLine("rdfWebDeploy: Error: Cannot deploy the Handler <" + n.ToString() + "> as there is no dnr:type property specified");
continue;
}
if (type.NodeType == NodeType.Literal)
{
String handlerType = ((ILiteralNode)type).Value;
//Add XML to register the Handler
reg = null;
foreach (XmlNode existingReg in httpHandlers.ChildNodes)
{
if (existingReg.Attributes.GetNamedItem("path") != null)
{
if (existingReg.Attributes["path"].Value.Equals(handlerPath))
{
reg = existingReg;
break;
}
}
}
if (reg == null)
{
reg = config.CreateElement("add");
XmlAttribute attr = config.CreateAttribute("path");
attr.Value = handlerPath;
reg.Attributes.Append(attr);
attr = config.CreateAttribute("verb");
attr.Value = "*";
reg.Attributes.Append(attr);
attr = config.CreateAttribute("type");