Exemple #1
0
        private void createIdentityNode(IGraph target, IUriNode provCreatingAction)
        {
            string myUriStr = Properties.Settings.Default.ResourceBaseURI + "Service_trainUID_" + TrainUID;

            IdentityNode = target.CreateUriNode(UriFactory.Create(myUriStr));
            if (provCreatingAction != null)
            {
                IdentityNode.AssertResponibility(provCreatingAction);
            }
        }
Exemple #2
0
        public void SaveToGraph(VDS.RDF.IGraph target, VDS.RDF.IUriNode provCreatingAction)
        {
            createIdentityNode(target, provCreatingAction);
            //Set the type
            target.Assert(IdentityNode, UriNodeExt.RdfType(target), target.CreateUriNode(UriFactory.Create(Properties.Settings.Default.ScheduledService)));
            IdentityNode.IdentifyNode(target.CreateLiteralNode(TrainUID));
            IUriNode serviceNodePredicate = target.CreateUriNode(Properties.Settings.Default.serviceNodePredicate);

            //TODO: most of the save to graph!
            foreach (ServiceNodeBase node in ServiceNodes)
            {
                //Note that order is crucail here: parent must be set before you try to save to graph and serviceAsNode will be null and afterwards
                //This feels some what fragile and probably needs a good look taking at it
                node.Parent = this;

                node.SaveToGraph(target, provCreatingAction);
                target.Assert(IdentityNode, serviceNodePredicate, node.ServiceAsNode);
            }
        }
        public void IdentityNodeTest()
        {
            StreamLocation expectedLocation = new StreamLocation(3, 2, 1);
            Expression expectedExpr = Expression.Constant(43L, typeof(long));

            IdentityNode sut = new IdentityNode(new TestNode(expectedExpr), expectedLocation);

            Assert.AreEqual(TNode.IDENTITY, sut.NodeType);
            Assert.AreEqual(expectedLocation, sut.Location);
            Assert.IsTrue(sut.Description.Contains("IDENTITY"));
            Assert.IsInstanceOfType(sut.SubExpression, typeof(ConstantExpression));
            Assert.AreEqual(ExpressionType.Constant, sut.SubExpression.NodeType);
            Assert.AreEqual(typeof(long), sut.SubExpression.Type);
            Assert.AreEqual(expectedExpr, sut.SubExpression);
        }