예제 #1
0
 private IEnumerable <Triple> GetTriples(Resource r, Property p, RDFNode rdfn)
 {
     if (r == null)
     {
         if (p == null)
         {
             //Object specified
             return(this._g.GetTriplesWithObject(JenaConverter.FromJenaNode(rdfn, this._mapping)));
         }
         else if (rdfn == null)
         {
             //Predicate specified
             return(this._g.GetTriplesWithPredicate(JenaConverter.FromJenaProperty(p, this._mapping)));
         }
         else
         {
             //Object and Predicate specified
             return(this._g.GetTriplesWithPredicateObject(JenaConverter.FromJenaProperty(p, this._mapping), JenaConverter.FromJenaNode(rdfn, this._mapping)));
         }
     }
     else if (p == null)
     {
         if (rdfn == null)
         {
             //Subject specified
             return(this._g.GetTriplesWithSubject(JenaConverter.FromJenaResource(r, this._mapping)));
         }
         else
         {
             //Subject and Object specified
             return(this._g.GetTriplesWithSubjectObject(JenaConverter.FromJenaResource(r, this._mapping), JenaConverter.FromJenaNode(rdfn, this._mapping)));
         }
     }
     else if (rdfn == null)
     {
         //Subject and Predicate specified
         return(this._g.GetTriplesWithSubjectPredicate(JenaConverter.FromJenaResource(r, this._mapping), JenaConverter.FromJenaProperty(p, this._mapping)));
     }
     else
     {
         Triple t = new Triple(JenaConverter.FromJenaResource(r, this._mapping), JenaConverter.FromJenaProperty(p, this._mapping), JenaConverter.FromJenaNode(rdfn, this._mapping));
         if (this._g.ContainsTriple(t))
         {
             return(t.AsEnumerable());
         }
         else
         {
             return(Enumerable.Empty <Triple>());
         }
     }
 }
예제 #2
0
 public bool contains(Resource r, Property p)
 {
     return(this._g.GetTriplesWithSubjectPredicate(JenaConverter.FromJenaResource(r, this._mapping), JenaConverter.FromJenaProperty(p, this._mapping)).Any());
 }