Beispiel #1
0
 public bool HasOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     return(Graph.ContainsTriple(new Triple(
                                     Graph.CreateUriNode(registration.GetUri(Base)),
                                     Graph.CreateUriNode(Schema.Predicates.Owner),
                                     Graph.CreateUriNode(owner.GetUri(Base)))));
 }
Beispiel #2
0
 public void RemoveOwner(OwnershipOwner owner)
 {
     foreach (Triple triple in Graph.GetTriples(Graph.CreateUriNode(owner.GetUri(Base))).ToList())
     {
         Graph.Retract(triple);
     }
 }
Beispiel #3
0
 public void RemoveOwnerFromRegistration(OwnershipRegistration registration, OwnershipOwner owner)
 {
     Graph.Retract(
         Graph.CreateUriNode(registration.GetUri(Base)),
         Graph.CreateUriNode(Schema.Predicates.Owner),
         Graph.CreateUriNode(owner.GetUri(Base)));
 }
        //  updates

        public void AddVersion(OwnershipRegistration registration, OwnershipOwner owner, string version)
        {
            INode registrationNode = Graph.CreateUriNode(registration.GetUri(Base));
            INode ownerNode = Graph.CreateUriNode(owner.GetUri(Base));
            INode recordNode = Graph.CreateUriNode(GetRecordUri());

            Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.Record));
            Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Registration), registrationNode);
            Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Owner), ownerNode);

            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.RecordRegistration));
            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Namespace), Graph.CreateLiteralNode(registration.Namespace));
            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Id), Graph.CreateLiteralNode(registration.Id));
            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Owner), ownerNode);

            if (version != null)
            {
                Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Version), Graph.CreateLiteralNode(version));
            }

            Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.RecordOwner));
            Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.NameIdentifier), Graph.CreateLiteralNode(owner.NameIdentifier));

            if (owner.Name != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Name), Graph.CreateLiteralNode(owner.Name));
            }

            if (owner.GivenName != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.GivenName), Graph.CreateLiteralNode(owner.GivenName));
            }

            if (owner.Surname != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Surname), Graph.CreateLiteralNode(owner.Surname));
            }

            if (owner.Email != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Email), Graph.CreateLiteralNode(owner.Email));
            }

            if (owner.Iss != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Iss), Graph.CreateLiteralNode(owner.Iss));
            }

            Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Registration), registrationNode);
        }
Beispiel #5
0
        //  updates

        public void AddVersion(OwnershipRegistration registration, OwnershipOwner owner, string version)
        {
            INode registrationNode = Graph.CreateUriNode(registration.GetUri(Base));
            INode ownerNode        = Graph.CreateUriNode(owner.GetUri(Base));
            INode recordNode       = Graph.CreateUriNode(GetRecordUri());

            Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.Record));
            Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Registration), registrationNode);
            Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Owner), ownerNode);

            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.RecordRegistration));
            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Namespace), Graph.CreateLiteralNode(registration.Namespace));
            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Id), Graph.CreateLiteralNode(registration.Id));
            Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Owner), ownerNode);

            if (version != null)
            {
                Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Version), Graph.CreateLiteralNode(version));
            }

            Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.RecordOwner));
            Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.NameIdentifier), Graph.CreateLiteralNode(owner.NameIdentifier));

            if (owner.Name != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Name), Graph.CreateLiteralNode(owner.Name));
            }

            if (owner.GivenName != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.GivenName), Graph.CreateLiteralNode(owner.GivenName));
            }

            if (owner.Surname != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Surname), Graph.CreateLiteralNode(owner.Surname));
            }

            if (owner.Email != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Email), Graph.CreateLiteralNode(owner.Email));
            }

            if (owner.Iss != null)
            {
                Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Iss), Graph.CreateLiteralNode(owner.Iss));
            }

            Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Registration), registrationNode);
        }
        public IEnumerable<OwnershipRegistration> GetRegistrations(OwnershipOwner owner)
        {
            IList<OwnershipRegistration> result = new List<OwnershipRegistration>();

            foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(owner.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Registration)))
            {
                string ns = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Namespace)).First().Object.ToString();
                string id = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Id)).First().Object.ToString();
                result.Add(new OwnershipRegistration { Namespace = ns, Id = id });
            }
            
            return result;
        }
 public bool HasOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     return Graph.ContainsTriple(new Triple(
         Graph.CreateUriNode(registration.GetUri(Base)),
         Graph.CreateUriNode(Schema.Predicates.Owner),
         Graph.CreateUriNode(owner.GetUri(Base))));
 }
 public void RemoveOwner(OwnershipOwner owner)
 {
     foreach (Triple triple in Graph.GetTriples(Graph.CreateUriNode(owner.GetUri(Base))).ToList())
     {
         Graph.Retract(triple);
     }
 }
 public void RemoveOwnerFromRegistration(OwnershipRegistration registration, OwnershipOwner owner)
 {
     Graph.Retract(
         Graph.CreateUriNode(registration.GetUri(Base)), 
         Graph.CreateUriNode(Schema.Predicates.Owner),
         Graph.CreateUriNode(owner.GetUri(Base)));
 }
Beispiel #10
0
        public IEnumerable <OwnershipRegistration> GetRegistrations(OwnershipOwner owner)
        {
            IList <OwnershipRegistration> result = new List <OwnershipRegistration>();

            foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(owner.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Registration)))
            {
                string ns = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Namespace)).First().Object.ToString();
                string id = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Id)).First().Object.ToString();
                result.Add(new OwnershipRegistration {
                    Namespace = ns, Id = id
                });
            }

            return(result);
        }