RDFResource represents a generic resource in the RDF model.
Inheritance: RDFPatternMember
コード例 #1
0
 /// <summary>
 /// Default-ctor to build an ontology complement class of the given class and with the given name
 /// </summary>
 public RDFOntologyComplementClass(RDFResource className, RDFOntologyClass complementOf): base(className) {
     if (complementOf     != null) {
         this.ComplementOf = complementOf;
     }
     else {
         throw new RDFSemanticsException("Cannot create RDFOntologyComplementClass because given \"complementOf\" parameter is null.");
     }
 }
コード例 #2
0
 /// <summary>
 /// Default-ctor to build an "owl:HasValue" ontology restriction with the given name on the given property and the given required value
 /// </summary>
 public RDFOntologyHasValueRestriction(RDFResource restrictionName, RDFOntologyProperty onProperty, RDFOntologyLiteral requiredValue): base(restrictionName, onProperty) {
     if (requiredValue     != null) {
         this.RequiredValue = requiredValue;
     }
     else {
         throw new RDFSemanticsException("Cannot create RDFOntologyHasValueRestriction because given \"requiredValue\" parameter is null.");
     }
 }
コード例 #3
0
 /// <summary>
 /// Default-ctor to build an "owl:SomeValuesFrom" ontology restriction with the given name on the given property and the given fromClass
 /// </summary>
 public RDFOntologySomeValuesFromRestriction(RDFResource restrictionName, RDFOntologyProperty onProperty, RDFOntologyClass fromClass): base(restrictionName, onProperty) {
     if (fromClass     != null) {
         this.FromClass = fromClass;
     }
     else {
         throw new RDFSemanticsException("Cannot create RDFOntologySomeValuesFromRestriction because given \"fromClass\" parameter is null.");
     }
 }
コード例 #4
0
 /// <summary>
 /// Default-ctor to build an ontology fact with the given name
 /// </summary>
 public RDFOntologyFact(RDFResource factName) {
     if (factName  != null) {
         this.Value           = factName;
         this.PatternMemberID = factName.PatternMemberID;
     }
     else {
         throw new RDFSemanticsException("Cannot create RDFOntologyFact because given \"factName\" parameter is null.");
     }
 }
コード例 #5
0
ファイル: RDFDescribeQuery.cs プロジェクト: mdesalvo/RDFSharp
 /// <summary>
 /// Adds the given resource to the describe terms of the query
 /// </summary>
 public RDFDescribeQuery AddDescribeTerm(RDFResource describeTerm)
 {
     if (describeTerm != null) {
         if (!this.DescribeTerms.Exists(dt => dt.Equals(describeTerm))) {
              this.DescribeTerms.Add(describeTerm);
         }
     }
     return this;
 }
コード例 #6
0
 /// <summary>
 /// Default-ctor to build an ontology class with the given name
 /// </summary>
 public RDFOntologyClass(RDFResource className) {
     if (className != null) {
         this.Value           = className;
         this.PatternMemberID = className.PatternMemberID;
     }
     else {
         throw new RDFSemanticsException("Cannot create RDFOntologyClass because given \"className\" parameter is null.");
     }
 }
コード例 #7
0
 /// <summary>
 /// Default-ctor to build a class constraint with the given class
 /// </summary>
 public RDFClassConstraint(RDFResource classType) : base()
 {
     if (classType != null)
     {
         this.ClassType = classType;
     }
     else
     {
         throw new RDFModelException("Cannot create RDFClassConstraint because given \"classType\" parameter is null.");
     }
 }
コード例 #8
0
 /// <summary>
 /// Default-ctor to build a disjoint constraint with the given predicate
 /// </summary>
 public RDFDisjointConstraint(RDFResource disjointPredicate) : base()
 {
     if (disjointPredicate != null)
     {
         this.DisjointPredicate = disjointPredicate;
     }
     else
     {
         throw new RDFModelException("Cannot create RDFDisjointConstraint because given \"disjointPredicate\" parameter is null.");
     }
 }
コード例 #9
0
 /// <summary>
 /// Selects the triples indexed by the given object
 /// </summary>
 internal HashSet <long> SelectIndexByObject(RDFResource objectResource)
 {
     if (objectResource != null)
     {
         if (this.Objects.ContainsKey(objectResource.PatternMemberID))
         {
             return(this.Objects[objectResource.PatternMemberID]);
         }
     }
     return(new HashSet <long>());
 }
コード例 #10
0
 /// <summary>
 /// Selects the triples indexed by the given predicate
 /// </summary>
 internal HashSet <long> SelectIndexByPredicate(RDFResource predicateResource)
 {
     if (predicateResource != null)
     {
         if (this.Predicates.ContainsKey(predicateResource.PatternMemberID))
         {
             return(this.Predicates[predicateResource.PatternMemberID]);
         }
     }
     return(new HashSet <long>());
 }
コード例 #11
0
 /// <summary>
 /// Default-ctor to build a lessThan constraint with the given predicate
 /// </summary>
 public RDFLessThanConstraint(RDFResource lessThanPredicate) : base()
 {
     if (lessThanPredicate != null)
     {
         this.LessThanPredicate = lessThanPredicate;
     }
     else
     {
         throw new RDFModelException("Cannot create RDFLessThanConstraint because given \"lessThanPredicate\" parameter is null.");
     }
 }
コード例 #12
0
 /// <summary>
 /// Selects the triples indexed by the given subject
 /// </summary>
 internal HashSet <Int64> SelectIndexBySubject(RDFResource subjectResource)
 {
     if (subjectResource != null)
     {
         if (this.Subjects.ContainsKey(subjectResource.PatternMemberID))
         {
             return(this.Subjects[subjectResource.PatternMemberID]);
         }
     }
     return(new HashSet <Int64>());
 }
コード例 #13
0
 /// <summary>
 /// Default-ctor to build a property constraint with the given property shape identifier
 /// </summary>
 public RDFPropertyConstraint(RDFResource propertyShapeUri) : base()
 {
     if (propertyShapeUri != null)
     {
         this.PropertyShapeUri = propertyShapeUri;
     }
     else
     {
         throw new RDFModelException("Cannot create RDFPropertyConstraint because given \"propertyShapeUri\" parameter is null.");
     }
 }
コード例 #14
0
ファイル: RDFNotConstraint.cs プロジェクト: dgerding/RDFSharp
 /// <summary>
 /// Default-ctor to build a not constraint with the given shape
 /// </summary>
 public RDFNotConstraint(RDFResource notShape) : base()
 {
     if (notShape != null)
     {
         this.NotShape = notShape;
     }
     else
     {
         throw new RDFModelException("Cannot create RDFNotConstraint because given \"notShape\" parameter is null.");
     }
 }
コード例 #15
0
 /// <summary>
 /// Default-ctor to build an equals constraint with the given predicate
 /// </summary>
 public RDFEqualsConstraint(RDFResource equalsPredicate) : base()
 {
     if (equalsPredicate != null)
     {
         this.EqualsPredicate = equalsPredicate;
     }
     else
     {
         throw new RDFModelException("Cannot create RDFEqualsConstraint because given \"equalsPredicate\" parameter is null.");
     }
 }
コード例 #16
0
 /// <summary>
 /// Adds the given resource to the values of this constraint (if ItemType has been set to Resource)
 /// </summary>
 public RDFInConstraint AddValue(RDFResource resource)
 {
     if (this.ItemType == RDFModelEnums.RDFItemTypes.Resource)
     {
         if (resource != null && !this.InValues.ContainsKey(resource.PatternMemberID))
         {
             this.InValues.Add(resource.PatternMemberID, resource);
         }
     }
     return(this);
 }
コード例 #17
0
 /// <summary>
 /// Default-ctor to build a minInclusive constraint with the given resource value
 /// </summary>
 public RDFMinInclusiveConstraint(RDFResource value) : base()
 {
     if (value != null)
     {
         this.Value = value;
     }
     else
     {
         throw new RDFModelException("Cannot create RDFMinInclusiveConstraint because given \"value\" parameter is null.");
     }
 }
コード例 #18
0
ファイル: RDFOntology.cs プロジェクト: Acidburn0zzz/RDFSharp
 /// <summary>
 /// Default-ctor to build an empty ontology with the given name
 /// </summary>
 public RDFOntology(RDFResource ontologyName) {
     if (ontologyName        != null) {
         this.Value           = ontologyName;
         this.PatternMemberID = ontologyName.PatternMemberID;
         this.Model           = new RDFOntologyModel();
         this.Data            = new RDFOntologyData();
         this.Annotations     = new RDFOntologyAnnotationsMetadata();
         RDFSemanticsUtilities.InitializeOntology(this);
     }
     else {
         throw new RDFSemanticsException("Cannot create RDFOntology because given \"ontologyName\" parameter is null.");
     }
 }
コード例 #19
0
ファイル: RDFGraphIndex.cs プロジェクト: ruo2012/RDFSharp
        /// <summary>
        /// Selects the triples indexed by the given object
        /// </summary>
        internal Dictionary <Int64, Object> SelectIndexByObject(RDFResource objectResource)
        {
            var result = new Dictionary <Int64, Object>();

            if (objectResource != null)
            {
                if (this.Objects.ContainsKey(objectResource.PatternMemberID))
                {
                    result = this.Objects[objectResource.PatternMemberID];
                }
            }
            return(result);
        }
コード例 #20
0
ファイル: RDFGraphIndex.cs プロジェクト: ruo2012/RDFSharp
        /// <summary>
        /// Selects the triples indexed by the given predicate
        /// </summary>
        internal Dictionary <Int64, Object> SelectIndexByPredicate(RDFResource predicateResource)
        {
            var result = new Dictionary <Int64, Object>();

            if (predicateResource != null)
            {
                if (this.Predicates.ContainsKey(predicateResource.PatternMemberID))
                {
                    result = this.Predicates[predicateResource.PatternMemberID];
                }
            }
            return(result);
        }
コード例 #21
0
 /// <summary>
 /// Default-ctor to build an ontology fact from the given resource
 /// </summary>
 public RDFOntologyFact(RDFResource factName) {
     if (factName  != null) {
         this.Value              = factName;
         this.PatternMemberID    = factName.PatternMemberID;
         this.ClassTypes         = new Dictionary<Int64, RDFOntologyClass>();
         this.SameAs             = new Dictionary<Int64, RDFOntologyFact>();
         this.DifferentFrom      = new Dictionary<Int64, RDFOntologyFact>();
         this.OntologyAttributes = new Dictionary<Int64, RDFOntologyAttribute>();
     }
     else {
         throw new RDFSemanticsException("Cannot create ontology fact because given \"factName\" parameter is null.");
     }
 }
コード例 #22
0
 /// <summary>
 /// Default-ctor to build a named property shape on the given property
 /// </summary>
 public RDFPropertyShape(RDFResource propertyShapeName, RDFResource path) : base(propertyShapeName)
 {
     if (path != null)
     {
         this.Path         = path;
         this.Descriptions = new List <RDFLiteral>();
         this.Names        = new List <RDFLiteral>();
     }
     else
     {
         throw new RDFModelException("Cannot create RDFPropertyShape because given \"path\" parameter is null.");
     }
 }
コード例 #23
0
 /// <summary>
 /// Default-ctor to build an ontology property with the given non-blank name
 /// </summary>
 internal RDFOntologyProperty(RDFResource propertyName) {
     if (propertyName != null) {
         if (!propertyName.IsBlank) {
             this.Value           = propertyName;
             this.PatternMemberID = propertyName.PatternMemberID;
         }
         else {
             throw new RDFSemanticsException("Cannot create RDFOntologyProperty because given \"propertyName\" parameter is a blank resource.");
         }
     }
     else {
         throw new RDFSemanticsException("Cannot create RDFOntologyProperty because given \"propertyName\" parameter is null.");
     }
 }
コード例 #24
0
ファイル: RDFGraph.cs プロジェクト: MMTim/RDFSharp
 /// <summary>
 /// Removes the triples with the given resource as object
 /// </summary>
 public RDFGraph RemoveTriplesByObject(RDFResource objectResource)
 {
     if (objectResource != null)
     {
         foreach (RDFTriple triple in this.SelectTriplesByObject(objectResource))
         {
             //Remove triple
             this.Triples.Remove(triple.TripleID);
             //Remove index
             this.GraphIndex.RemoveIndex(triple);
         }
     }
     return(this);
 }
コード例 #25
0
 /// <summary>
 /// Removes the given item from the collection
 /// </summary>
 public RDFCollection RemoveItem(RDFResource item)
 {
     if (item != null && this.ItemType == RDFModelEnums.RDFItemTypes.Resource)
     {
         //Remove item from collection
         this.Items.RemoveAll(x => x.Equals(item));
         //Update ReificationSubject (if collection has turned back into "rdf:Nil" configuration)
         if (this.ItemsCount == 0)
         {
             this.ReificationSubject = RDFVocabulary.RDF.NIL;
         }
     }
     return(this);
 }
コード例 #26
0
ファイル: RDFGraph.cs プロジェクト: MMTim/RDFSharp
 /// <summary>
 /// Removes the triples with the given predicate
 /// </summary>
 public RDFGraph RemoveTriplesByPredicate(RDFResource predicateResource)
 {
     if (predicateResource != null)
     {
         foreach (RDFTriple triple in this.SelectTriplesByPredicate(predicateResource))
         {
             //Remove triple
             this.Triples.Remove(triple.TripleID);
             //Remove index
             this.GraphIndex.RemoveIndex(triple);
         }
     }
     return(this);
 }
コード例 #27
0
        /// <summary>
        /// Given an attribute representing a RDF collection, iterates on its constituent elements
        /// to build its standard reification triples.
        /// </summary>
        internal static void ParseCollectionElements(Uri xmlBase, XmlNode predNode, RDFResource subj,
                                                     RDFResource pred, RDFGraph result)
        {
            //Attach the collection as the blank object of the current pred
            RDFResource obj = new RDFResource();

            result.AddTriple(new RDFTriple(subj, pred, obj));

            //Iterate on the collection items to reify it
            if (predNode.HasChildNodes)
            {
                IEnumerator elems = predNode.ChildNodes.GetEnumerator();
                while (elems != null && elems.MoveNext())
                {
                    XmlNode elem = (XmlNode)elems.Current;

                    //Try to get items as "rdf:about" attributes, or as "rdf:resource"
                    XmlAttribute elemUri =
                        (GetRdfAboutAttribute(elem) ??
                         GetRdfResourceAttribute(elem));
                    if (elemUri != null)
                    {
                        //Sanitize eventual blank node or relative value, depending on attribute found
                        elemUri.Value = ResolveRelativeNode(elemUri, xmlBase);

                        // obj -> rdf:type -> rdf:list
                        result.AddTriple(new RDFTriple(obj, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.LIST));

                        // obj -> rdf:first -> res
                        result.AddTriple(new RDFTriple(obj, RDFVocabulary.RDF.FIRST, new RDFResource(elemUri.Value)));

                        //Last element of a collection must give a triple to a "rdf:nil" object
                        RDFResource newObj;
                        if (elem != predNode.ChildNodes.Item(predNode.ChildNodes.Count - 1))
                        {
                            // obj -> rdf:rest -> newObj
                            newObj = new RDFResource();
                        }
                        else
                        {
                            // obj -> rdf:rest -> rdf:nil
                            newObj = RDFVocabulary.RDF.NIL;
                        }
                        result.AddTriple(new RDFTriple(obj, RDFVocabulary.RDF.REST, newObj));
                        obj = newObj;
                    }
                }
            }
        }
コード例 #28
0
ファイル: RDFGraph.cs プロジェクト: MMTim/RDFSharp
 /// <summary>
 /// Removes the triples with the given predicate and literal
 /// </summary>
 public RDFGraph RemoveTriplesByPredicateLiteral(RDFResource predicateResource, RDFLiteral objectLiteral)
 {
     if (predicateResource != null && objectLiteral != null)
     {
         foreach (RDFTriple triple in this.SelectTriplesByPredicate(predicateResource)
                  .SelectTriplesByLiteral(objectLiteral))
         {
             //Remove triple
             this.Triples.Remove(triple.TripleID);
             //Remove index
             this.GraphIndex.RemoveIndex(triple);
         }
     }
     return(this);
 }
コード例 #29
0
 /// <summary>
 /// Default-ctor to build a validation result with the given properties
 /// </summary>
 internal RDFValidationResult(RDFResource sourceShape,
                              RDFResource sourceConstraintComponent,
                              RDFPatternMember focusNode,
                              RDFResource resultPath,
                              RDFPatternMember resultValue,
                              List <RDFLiteral> resultMessages,
                              RDFValidationEnums.RDFShapeSeverity severity = RDFValidationEnums.RDFShapeSeverity.Violation) : base()
 {
     this.SourceShape = sourceShape;
     this.SourceConstraintComponent = sourceConstraintComponent;
     this.FocusNode      = focusNode;
     this.ResultPath     = resultPath;
     this.ResultValue    = resultValue;
     this.ResultMessages = resultMessages ?? new List <RDFLiteral>();
     this.Severity       = severity;
 }
コード例 #30
0
        /// <summary>
        /// Default-ctor to build an ontology restriction with the given name on the given ontology property
        /// </summary>
        internal RDFOntologyRestriction (RDFResource restrictionName, RDFOntologyProperty onProperty): base(restrictionName) {
            if (onProperty != null) {

                //AnnotationProperty cannot be restricted
                if (!onProperty.IsAnnotationProperty()) {
                     this.OnProperty = onProperty;
                }
                else {
                    throw new RDFSemanticsException("Cannot create RDFOntologyRestriction because given \"onProperty\" parameter (" + onProperty + ") is an annotation property.");
                }

            }
            else {
                throw new RDFSemanticsException("Cannot create RDFOntologyRestriction because given \"onProperty\" parameter is null.");
            }
        }
コード例 #31
0
 /// <summary>
 /// Removes the triples with the given resource as object
 /// </summary>
 public RDFGraph RemoveTriplesByObject(RDFResource objectResource)
 {
     if (objectResource != null)
     {
         foreach (var triple in this.SelectTriplesByObject(objectResource))
         {
             //Remove triple
             this.Triples.Remove(triple.TripleID);
             //Remove index
             this.GraphIndex.RemoveIndex(triple);
             //Raise event
             RDFModelEvents.RaiseOnTripleRemoved(String.Format("Triple '{0}' has been removed from the Graph '{1}'.", triple, this));
         }
     }
     return(this);
 }
コード例 #32
0
        /// <summary>
        /// Gives the subj node extracted from the attribute list of the current element
        /// </summary>
        internal static RDFResource GetSubjectNode(XmlNode subjNode, Uri xmlBase, RDFGraph result)
        {
            RDFResource subj = null;

            //If there are attributes, search them for the one representing the subj
            if (subjNode.Attributes != null && subjNode.Attributes.Count > 0)
            {
                //We are interested in finding the "rdf:about" node for the subj
                XmlAttribute rdfAbout = GetRdfAboutAttribute(subjNode);
                if (rdfAbout != null)
                {
                    //Attribute found, but we must check if it is "rdf:ID", "rdf:nodeID" or a relative Uri:
                    //in this case it must be resolved against the xmlBase namespace, or else it remains the same
                    String rdfAboutValue = ResolveRelativeNode(rdfAbout, xmlBase);
                    subj = new RDFResource(rdfAboutValue);
                }

                //If "rdf:about" attribute has been found for the subj, we must
                //check if the node is not a standard "rdf:Description": this is
                //the case we can directly build a triple with "rdf:type" pred
                if (subj != null && !CheckIfRdfDescriptionNode(subjNode))
                {
                    RDFResource obj = null;
                    if (subjNode.NamespaceURI == String.Empty)
                    {
                        obj = new RDFResource(xmlBase + subjNode.LocalName);
                    }
                    else
                    {
                        obj = new RDFResource(subjNode.NamespaceURI + subjNode.LocalName);
                    }
                    result.AddTriple(new RDFTriple(subj, RDFVocabulary.RDF.TYPE, obj));
                }
            }

            //There are no attributes, so there's only one way we can handle this element:
            //if it is a standard rdf:Description, it is a blank Subject
            else
            {
                if (CheckIfRdfDescriptionNode(subjNode))
                {
                    subj = new RDFResource();
                }
            }

            return(subj);
        }
コード例 #33
0
ファイル: RDFGraph.cs プロジェクト: Mozes96/IBH
 /// <summary>
 /// Removes the triples with the given resource as object
 /// </summary>
 public RDFGraph RemoveTriplesByObject(RDFResource objectResource)
 {
     if (objectResource != null)
     {
         var tripleFound = false;
         foreach (var triple in this.SelectTriplesByObject(objectResource))
         {
             this.Triples.Remove(triple.TripleID);
             tripleFound = true;
         }
         if (tripleFound)
         {
             RDFModelUtilities.RebuildGraph(this);
         }
     }
     return(this);
 }
コード例 #34
0
ファイル: RDFGraph.cs プロジェクト: Mozes96/IBH
 /// <summary>
 /// Removes the triples with the given (non-blank) predicate
 /// </summary>
 public RDFGraph RemoveTriplesByPredicate(RDFResource predicateResource)
 {
     if (predicateResource != null && !predicateResource.IsBlank)
     {
         var tripleFound = false;
         foreach (var triple in this.SelectTriplesByPredicate(predicateResource))
         {
             this.Triples.Remove(triple.TripleID);
             tripleFound = true;
         }
         if (tripleFound)
         {
             RDFModelUtilities.RebuildGraph(this);
         }
     }
     return(this);
 }
コード例 #35
0
 /// <summary>
 /// Adds the given item to the collection
 /// </summary>
 public RDFCollection AddItem(RDFResource item)
 {
     if (item != null && this.ItemType == RDFModelEnums.RDFItemTypes.Resource)
     {
         if (this.AcceptDuplicates || this.Items.Find(x => x.Equals(item)) == null)
         {
             //Add item to collection
             this.Items.Add(item);
             //Update ReificationSubject (if collection has left "rdf:Nil" configuration)
             if (this.ItemsCount == 1)
             {
                 this.ReificationSubject = this.InternalReificationSubject;
             }
         }
     }
     return(this);
 }
コード例 #36
0
 /// <summary>
 /// Removes the triples with the given predicate and literal
 /// </summary>
 public RDFGraph RemoveTriplesByPredicateLiteral(RDFResource predicateResource, RDFLiteral objectLiteral)
 {
     if (predicateResource != null && objectLiteral != null)
     {
         foreach (var triple in this.SelectTriplesByPredicate(predicateResource)
                  .SelectTriplesByLiteral(objectLiteral))
         {
             //Remove triple
             this.Triples.Remove(triple.TripleID);
             //Remove index
             this.GraphIndex.RemoveIndex(triple);
             //Raise event
             RDFModelEvents.RaiseOnTripleRemoved(String.Format("Triple '{0}' has been removed from the Graph '{1}'.", triple, this));
         }
     }
     return(this);
 }
コード例 #37
0
        /// <summary>
        /// Builds the reification graph of the collection
        /// </summary>
        public RDFGraph ReifyCollection()
        {
            RDFGraph    reifColl  = new RDFGraph();
            RDFResource reifSubj  = this.ReificationSubject;
            int         itemCount = 0;

            //Collection can be reified only if it has at least one item
            if (this.ItemsCount > 0)
            {
                foreach (object listEnum in this)
                {
                    //Count the items to keep track of the last one, which will be connected to rdf:nil
                    itemCount++;

                    //  Subject -> rdf:type  -> rdf:List
                    reifColl.AddTriple(new RDFTriple(reifSubj, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.LIST));

                    //  Subject -> rdf:first -> RDFCollection.ITEM[i]
                    if (this.ItemType == RDFModelEnums.RDFItemTypes.Resource)
                    {
                        reifColl.AddTriple(new RDFTriple(reifSubj, RDFVocabulary.RDF.FIRST, (RDFResource)listEnum));
                    }
                    else
                    {
                        reifColl.AddTriple(new RDFTriple(reifSubj, RDFVocabulary.RDF.FIRST, (RDFLiteral)listEnum));
                    }

                    //Not the last one: Subject -> rdf:rest  -> NEWBLANK
                    if (itemCount < this.ItemsCount)
                    {
                        RDFResource newSub = new RDFResource();
                        reifColl.AddTriple(new RDFTriple(reifSubj, RDFVocabulary.RDF.REST, newSub));
                        reifSubj = newSub;
                    }
                    //The last one:     Subject -> rdf:rest  -> rdf:nil
                    else
                    {
                        reifColl.AddTriple(new RDFTriple(reifSubj, RDFVocabulary.RDF.REST, RDFVocabulary.RDF.NIL));
                    }
                }
            }

            return(reifColl);
        }
コード例 #38
0
        /// <summary>
        /// Parses the current quadruple of the data reader 
        /// </summary>
        public static RDFQuadruple ParseQuadruple(IDataReader fetchedQuadruples) {

            if (fetchedQuadruples != null) { 
                RDFContext qContext       = new RDFContext(fetchedQuadruples["Context"].ToString());
                RDFResource qSubject      = new RDFResource(fetchedQuadruples["Subject"].ToString());
                RDFResource qPredicate    = new RDFResource(fetchedQuadruples["Predicate"].ToString());

                //SPO-flavour quadruple
                if (fetchedQuadruples["TripleFlavor"].ToString() == "1") {
                    RDFResource qObject   = new RDFResource(fetchedQuadruples["Object"].ToString());
                    return new RDFQuadruple(qContext, qSubject, qPredicate, qObject);
                }

                //SPL-flavour quadruple
                String literal            = fetchedQuadruples["Object"].ToString();

                //PlainLiteral
                if (!literal.Contains("^^") || literal.EndsWith("^^") || RDFModelUtilities.GetUriFromString(literal.Substring(literal.LastIndexOf("^^", StringComparison.Ordinal) + 2)) == null) {
                    RDFPlainLiteral pLit  = null;
                    if (literal.Contains("@")) {
                        if (!literal.EndsWith("@")) {
                            Int32 lastAmp = literal.LastIndexOf('@');
                            pLit          = new RDFPlainLiteral(literal.Substring(0, lastAmp), literal.Substring(lastAmp + 1));
                        }
                        else {
                            pLit          = new RDFPlainLiteral(literal);
                        }
                    }
                    else {
                        pLit              = new RDFPlainLiteral(literal);
                    }
                    return new RDFQuadruple(qContext, qSubject, qPredicate, pLit);
                }

                //TypedLiteral
                String tLitValue          = literal.Substring(0, literal.LastIndexOf("^^", StringComparison.Ordinal));
                String tLitDatatype       = literal.Substring(literal.LastIndexOf("^^", StringComparison.Ordinal) + 2);
                RDFDatatype dt            = RDFModelUtilities.GetDatatypeFromString(tLitDatatype);
                RDFTypedLiteral tLit      = new RDFTypedLiteral(tLitValue, dt);
                return new RDFQuadruple(qContext, qSubject, qPredicate, tLit);
            }
            throw new RDFStoreException("Cannot parse quadruple because given \"fetchedQuadruples\" parameter is null.");

        }
コード例 #39
0
        /// <summary>
        /// Builds the reification graph of the container:
        /// Subject -> rdf:type -> [rdf:Bag|rdf:Seq|rdf:Alt]
        /// Subject -> rdf:_N   -> RDFContainer.ITEM(N)
        /// </summary>
        public RDFGraph ReifyContainer()
        {
            RDFGraph reifCont = new RDFGraph();

            //  Subject -> rdf:type -> [rdf:Bag|rdf:Seq|rdf:Alt]
            switch (this.ContainerType)
            {
            case RDFModelEnums.RDFContainerTypes.Bag:
                reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.BAG));
                break;

            case RDFModelEnums.RDFContainerTypes.Seq:
                reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.SEQ));
                break;

            case RDFModelEnums.RDFContainerTypes.Alt:
                reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.ALT));
                break;

            default:
                throw new NotImplementedException();
                break;
            }

            //  Subject -> rdf:_N -> RDFContainer.ITEM(N)
            Int32 index = 0;

            foreach (Object item in this)
            {
                RDFResource ordPred = new RDFResource(RDFVocabulary.RDF.BASE_URI + "_" + (++index));
                if (this.ItemType == RDFModelEnums.RDFItemTypes.Resource)
                {
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, ordPred, (RDFResource)item));
                }
                else
                {
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, ordPred, (RDFLiteral)item));
                }
            }

            return(reifCont);
        }
コード例 #40
0
        /// <summary>
        /// Default-ctor to build a qualified value shape constraint with the given property shape identifier and min/max counters
        /// </summary>
        public RDFQualifiedValueShapeConstraint(RDFResource qualifiedValueShapeUri, int?qualifiedValueMinCount, int?qualifiedValueMaxCount) : base()
        {
            if (qualifiedValueShapeUri != null)
            {
                this.QualifiedValueShapeUri = qualifiedValueShapeUri;

                if (qualifiedValueMinCount.HasValue)
                {
                    this.QualifiedValueMinCount = qualifiedValueMinCount < 0 ? 0 : qualifiedValueMinCount;
                }

                if (qualifiedValueMaxCount.HasValue)
                {
                    this.QualifiedValueMaxCount = qualifiedValueMaxCount < 0 ? 0 : qualifiedValueMaxCount;
                }
            }
            else
            {
                throw new RDFModelException("Cannot create RDFQualifiedValueShapeConstraint because given \"qualifiedValueShapeUri\" parameter is null.");
            }
        }
コード例 #41
0
        /// <summary>
        /// Builds the reification graph of the container:
        /// Subject -> rdf:type -> [rdf:Bag|rdf:Seq|rdf:Alt]
        /// Subject -> rdf:_N   -> RDFContainer.ITEM(N)
        /// </summary>
        public RDFGraph ReifyContainer()
        {
            RDFGraph reifCont = new RDFGraph();

            //  Subject -> rdf:type -> [rdf:Bag|rdf:Seq|rdf:Alt]
            switch (this.ContainerType)
            {
            case RDFModelEnums.RDFContainerTypes.Bag:
                reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.BAG));
                break;

            case RDFModelEnums.RDFContainerTypes.Seq:
                reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.SEQ));
                break;

            case RDFModelEnums.RDFContainerTypes.Alt:
                reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.ALT));
                break;
            }

            //  Subject -> rdf:_N -> RDFContainer.ITEM(N)
            int index = 0;

            foreach (object item in this)
            {
                RDFResource ordPred = new RDFResource(string.Concat(RDFVocabulary.RDF.BASE_URI, "_", (++index).ToString()));
                if (this.ItemType == RDFModelEnums.RDFItemTypes.Resource)
                {
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, ordPred, (RDFResource)item));
                }
                else
                {
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, ordPred, (RDFLiteral)item));
                }
            }

            return(reifCont);
        }
コード例 #42
0
        /// <summary>
        /// Default-ctor to build an ontology cardinality restriction with the given name on the given property
        /// </summary>
        public RDFOntologyCardinalityRestriction(RDFResource restrictionName, RDFOntologyProperty onProperty, Int32 minCardinality, Int32 maxCardinality): base(restrictionName, onProperty) {
            
            //MinCardinality
            if (minCardinality > 0) {
                if (maxCardinality > 0) {
                    if (minCardinality <= maxCardinality) {
                        this.MinCardinality = minCardinality;
                    }
                    else {
                        throw new RDFSemanticsException("Cannot create RDFOntologyCardinalityRestriction because given \"minCardinality\" parameter (" + minCardinality + ") must be less or equal than given \"maxCardinality\" parameter (" + maxCardinality + ")");
                    }
                }
                else {
                    this.MinCardinality     = minCardinality;
                }
            }

            //MaxCardinality
            if (maxCardinality > 0) {
                if (minCardinality > 0) {
                    if (maxCardinality >= minCardinality) {
                        this.MaxCardinality = maxCardinality;
                    }
                    else {
                        throw new RDFSemanticsException("Cannot create RDFOntologyCardinalityRestriction because given \"maxCardinality\" parameter (" + maxCardinality + ") must be greater or equal than given \"minCardinality\" parameter (" + minCardinality + ")");
                    }
                }
                else {
                    this.MaxCardinality     = maxCardinality;
                }
            }

            if (this.MinCardinality == 0   && this.MaxCardinality == 0) {
                throw new RDFSemanticsException("Cannot create RDFOntologyCardinalityRestriction because at least one of the given \"minCardinality\" and \"maxCardinality\" parameters must be greater than 0.");
            }
        }
コード例 #43
0
ファイル: RDFStoreIndex.cs プロジェクト: mdesalvo/RDFSharp
 /// <summary>
 /// Selects the quadruples indexed by the given predicate
 /// </summary>
 internal HashSet<Int64> SelectIndexByPredicate(RDFResource predicateResource)
 {
     if (predicateResource != null) {
         if (this.Predicates.ContainsKey(predicateResource.PatternMemberID)) {
             return this.Predicates[predicateResource.PatternMemberID];
         }
     }
     return new HashSet<Int64>();
 }
コード例 #44
0
 /// <summary>
 /// Default-ctor to build an empty ontology intersection class with the given className
 /// </summary>
 public RDFOntologyIntersectionClass(RDFResource className): base(className) { }
コード例 #45
0
 /// <summary>
 /// Default-ctor to build an empty ontology union class with the given name
 /// </summary>
 public RDFOntologyUnionClass(RDFResource className): base(className) { }
コード例 #46
0
 /// <summary>
 /// Selects the triples indexed by the given object
 /// </summary>
 internal Dictionary<Int64, Object> SelectIndexByObject(RDFResource objectResource) {
     var result          = new Dictionary<Int64, Object>();
     if (objectResource != null) {
         if (this.Objects.ContainsKey(objectResource.PatternMemberID)) {
             result      = this.Objects[objectResource.PatternMemberID];
         }
     }
     return result;
 }
コード例 #47
0
 /// <summary>
 /// Selects the triples indexed by the given predicate
 /// </summary>
 internal Dictionary<Int64, Object> SelectIndexByPredicate(RDFResource predicateResource) {
     var result             = new Dictionary<Int64, Object>();
     if (predicateResource != null) {
         if (this.Predicates.ContainsKey(predicateResource.PatternMemberID)) {
             result         = this.Predicates[predicateResource.PatternMemberID];
         }
     }
     return result;
 }
コード例 #48
0
 /// <summary>
 /// Default-ctor to build an ontology datatype property from the given non-blank resource
 /// </summary>
 public RDFOntologyDatatypeProperty(RDFResource propertyName): base(propertyName) { }
コード例 #49
0
        /// <summary>
        /// Gets a memory store containing quadruples satisfying the given pattern
        /// </summary>
        internal override RDFMemoryStore SelectQuadruples(RDFContext  ctx,
                                                          RDFResource subj,
                                                          RDFResource pred,
                                                          RDFResource obj,
                                                          RDFLiteral  lit) {
            RDFMemoryStore result    = new RDFMemoryStore();
            MySqlCommand command     = null;

            //Intersect the filters
            if (ctx                 != null) {
                if (subj            != null) {
                    if (pred        != null) {
                        if (obj     != null) {
                            //C->S->P->O
                            command  = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND SubjectID = @SUBJID AND PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                            command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                            command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                            command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            command.Parameters["OBJID"].Value  = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //C->S->P->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND SubjectID = @SUBJID AND PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                                command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                                command.Parameters["OBJID"].Value  = lit.PatternMemberID;
                            }
                            else {
                                //C->S->P->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND SubjectID = @SUBJID AND PredicateID = @PREDID", this.Connection);
                                command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            }
                        }
                    }
                    else {
                        if (obj     != null) {
                            //C->S->->O
                            command  = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND SubjectID = @SUBJID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                            command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                            command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                            command.Parameters["OBJID"].Value  = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //C->S->->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND SubjectID = @SUBJID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                                command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                                command.Parameters["OBJID"].Value  = lit.PatternMemberID;
                            }
                            else {
                                //C->S->->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND SubjectID = @SUBJID", this.Connection);
                                command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                            }
                        }
                    }
                }
                else {
                    if (pred        != null) {
                        if (obj     != null) {
                            //C->->P->O
                            command  = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                            command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                            command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            command.Parameters["OBJID"].Value  = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //C->->P->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                                command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                                command.Parameters["OBJID"].Value  = lit.PatternMemberID;
                            }
                            else {
                                //C->->P->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND PredicateID = @PREDID", this.Connection);
                                command.Parameters.Add(new MySqlParameter("CTXID",  MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters["CTXID"].Value  = ctx.PatternMemberID;
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            }
                        }
                    }
                    else {
                        if (obj     != null) {
                            //C->->->O
                            command  = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",   MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("CTXID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("OBJID", MySqlDbType.Int64));
                            command.Parameters["TFV"].Value   = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["CTXID"].Value = ctx.PatternMemberID;
                            command.Parameters["OBJID"].Value = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //C->->->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",   MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("CTXID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("OBJID", MySqlDbType.Int64));
                                command.Parameters["TFV"].Value   = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["CTXID"].Value = ctx.PatternMemberID;
                                command.Parameters["OBJID"].Value = lit.PatternMemberID;
                            }
                            else {
                                //C->->->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ContextID = @CTXID", this.Connection);
                                command.Parameters.Add(new MySqlParameter("CTXID", MySqlDbType.Int64));
                                command.Parameters["CTXID"].Value = ctx.PatternMemberID;
                            }
                        }
                    }
                }
            }
            else {
                if (subj            != null) {
                    if (pred        != null) {
                        if (obj     != null) {
                            //->S->P->O
                            command  = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE SubjectID = @SUBJID AND PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                            command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                            command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            command.Parameters["OBJID"].Value  = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //->S->P->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE SubjectID = @SUBJID AND PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                                command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                                command.Parameters["OBJID"].Value  = lit.PatternMemberID;
                            }
                            else {
                                //->S->P->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE SubjectID = @SUBJID AND PredicateID = @PREDID", this.Connection);
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            }
                        }
                    }
                    else {
                        if (obj     != null) {
                            //->S->->O
                            command  = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE SubjectID = @SUBJID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                            command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                            command.Parameters["OBJID"].Value  = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //->S->->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE SubjectID = @SUBJID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                                command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                                command.Parameters["OBJID"].Value  = lit.PatternMemberID;
                            }
                            else {
                                //->S->->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE SubjectID = @SUBJID", this.Connection);
                                command.Parameters.Add(new MySqlParameter("SUBJID", MySqlDbType.Int64));
                                command.Parameters["SUBJID"].Value = subj.PatternMemberID;
                            }
                        }
                    }
                }
                else {
                    if (pred        != null) {
                        if (obj     != null) {
                            //->->P->O
                            command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                            command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                            command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            command.Parameters["OBJID"].Value  = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //->->P->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE PredicateID = @PREDID AND ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",    MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters.Add(new MySqlParameter("OBJID",  MySqlDbType.Int64));
                                command.Parameters["TFV"].Value    = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                                command.Parameters["OBJID"].Value  = lit.PatternMemberID;
                            }
                            else {
                                //->->P->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE PredicateID = @PREDID", this.Connection);
                                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));
                                command.Parameters["PREDID"].Value = pred.PatternMemberID;
                            }
                        }
                    }
                    else {
                        if (obj     != null) {
                            //->->->O
                            command  = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                            command.Parameters.Add(new MySqlParameter("TFV",   MySqlDbType.Int32));
                            command.Parameters.Add(new MySqlParameter("OBJID", MySqlDbType.Int64));
                            command.Parameters["TFV"].Value   = RDFModelEnums.RDFTripleFlavors.SPO;
                            command.Parameters["OBJID"].Value = obj.PatternMemberID;
                        }
                        else {
                            if (lit != null) {
                                //->->->L
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples WHERE ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                                command.Parameters.Add(new MySqlParameter("TFV",   MySqlDbType.Int32));
                                command.Parameters.Add(new MySqlParameter("OBJID", MySqlDbType.Int64));
                                command.Parameters["TFV"].Value   = RDFModelEnums.RDFTripleFlavors.SPL;
                                command.Parameters["OBJID"].Value = lit.PatternMemberID;
                            }
                            else {
                                //->->->
                                command = new MySqlCommand("SELECT TripleFlavor, Context, Subject, Predicate, Object FROM Quadruples", this.Connection);
                            }
                        }
                    }
                }
            }

            //Prepare and execute command
            try {

                //Open connection
                this.Connection.Open();

                //Prepare command
                command.Prepare();
                command.CommandTimeout = 120;

                //Execute command
                using (var quadruples  = command.ExecuteReader()) {
                    if(quadruples.HasRows) {
                        while (quadruples.Read()) {
                            result.AddQuadruple(RDFStoreUtilities.ParseQuadruple(quadruples));
                        }
                    }
                }

                //Close connection
                this.Connection.Close();

            }
            catch (Exception ex) {

                //Close connection
                this.Connection.Close();

                //Propagate exception
                throw new RDFStoreException("Cannot read data from MySQL store because: " + ex.Message, ex);

            }

            return result;
        }
コード例 #50
0
 /// <summary>
 /// Removes the quadruples with the given resource as object
 /// </summary>
 public override RDFStore RemoveQuadruplesByObject(RDFResource objectResource) {
     if (objectResource    != null) {
         try {
             //Modify command
             this.Commands["DELETE"].CommandText                 = "DELETE FROM main.Quadruples WHERE TripleFlavor = 1 AND ObjectID = @OBJID";
             this.Commands["DELETE"].Parameters.Clear();
             //Open connection
             this.Connection.Open();
             //Open transaction
             this.Commands["DELETE"].Transaction                 = this.Commands["DELETE"].Connection.BeginTransaction();
             //Prepare command
             this.Commands["DELETE"].Prepare();
             //Valorize parameters
             this.Commands["DELETE"].Parameters.Add(new SQLiteParameter("OBJID",  DbType.Int64));
             this.Commands["DELETE"].Parameters["OBJID"].Value   = objectResource.PatternMemberID;
             //Execute command
             this.Commands["DELETE"].ExecuteNonQuery();
             //Close transaction
             this.Commands["DELETE"].Transaction.Commit();
             //Close connection
             this.Connection.Close();
             //Restore command
             this.Commands["DELETE"].CommandText                 = "DELETE FROM main.Quadruples WHERE QuadrupleID = @QID";
             this.Commands["DELETE"].Parameters.Clear();
             this.Commands["DELETE"].Parameters.Add(new SQLiteParameter("QID",    DbType.Int64));
         }
         catch (Exception ex) {
             //Close transaction
             this.Commands["DELETE"].Transaction.Rollback();
             //Close connection
             this.Connection.Close();
             //Restore command
             this.Commands["DELETE"].CommandText                 = "DELETE FROM main.Quadruples WHERE QuadrupleID = @QID";
             this.Commands["DELETE"].Parameters.Clear();
             this.Commands["DELETE"].Parameters.Add(new SQLiteParameter("QID",    DbType.Int64));
             //Propagate exception
             throw new RDFStoreException("Cannot delete data from SQLite store because: " + ex.Message);
         }
     }
     return this;
 }
コード例 #51
0
        /// <summary>
        /// Selects the quadruples corresponding to the given pattern from the given store
        /// </summary>
        internal static List<RDFQuadruple> SelectQuadruples(RDFMemoryStore store,
                                                            RDFContext  ctx,
                                                            RDFResource subj,
                                                            RDFResource pred,
                                                            RDFResource obj,
                                                            RDFLiteral  lit) {
            var matchCtx         = new List<RDFQuadruple>();
            var matchSubj        = new List<RDFQuadruple>();
            var matchPred        = new List<RDFQuadruple>();
            var matchObj         = new List<RDFQuadruple>();
            var matchLit         = new List<RDFQuadruple>();
            var matchResult      = new List<RDFQuadruple>();
            if (store           != null) {

                //Filter by Context
                if (ctx         != null) {
                    foreach (var q in store.StoreIndex.SelectIndexByContext(ctx).Keys) {
                        matchCtx.Add(store.Quadruples[q]);
                    }
                }

                //Filter by Subject
                if (subj        != null) {
                    foreach (var q in store.StoreIndex.SelectIndexBySubject(subj).Keys) {
                        matchSubj.Add(store.Quadruples[q]);
                    }
                }

                //Filter by Predicate
                if (pred        != null) {
                    foreach (var q in store.StoreIndex.SelectIndexByPredicate(pred).Keys) {
                        matchPred.Add(store.Quadruples[q]);
                    }
                }

                //Filter by Object
                if (obj         != null) {
                    foreach (var q in store.StoreIndex.SelectIndexByObject(obj).Keys) {
                        matchObj.Add(store.Quadruples[q]);
                    }
                }

                //Filter by Literal
                if (lit         != null) {
                    foreach (var q in store.StoreIndex.SelectIndexByLiteral(lit).Keys) {
                        matchLit.Add(store.Quadruples[q]);
                    }
                }

                //Intersect the filters
                if (ctx                        != null) {
                    if (subj                   != null) {
                        if (pred               != null) {
                            if (obj            != null) {
                                //C->S->P->O
                                matchResult     = matchCtx.Intersect(matchSubj)
                                                          .Intersect(matchPred)
                                                          .Intersect(matchObj)
                                                          .ToList<RDFQuadruple>();
                            }
                            else {
                                if (lit        != null) {
                                    //C->S->P->L
                                    matchResult = matchCtx.Intersect(matchSubj)
                                                          .Intersect(matchPred)
                                                          .Intersect(matchLit)
                                                          .ToList<RDFQuadruple>();
                                }
                                else {
                                    //C->S->P->
                                    matchResult = matchCtx.Intersect(matchSubj)
                                                          .Intersect(matchPred)
                                                          .ToList<RDFQuadruple>();
                                }
                            }
                        }
                        else {
                            if (obj            != null) {
                                //C->S->->O
                                matchResult     = matchCtx.Intersect(matchSubj)
                                                          .Intersect(matchObj)
                                                          .ToList<RDFQuadruple>();
                            }
                            else {
                                if (lit        != null) {
                                    //C->S->->L
                                    matchResult = matchCtx.Intersect(matchSubj)
                                                          .Intersect(matchLit)
                                                          .ToList<RDFQuadruple>();
                                }
                                else {
                                    //C->S->->
                                    matchResult = matchCtx.Intersect(matchSubj)
                                                          .ToList<RDFQuadruple>();
                                }
                            }
                        }
                    }
                    else {
                        if (pred               != null) {
                            if (obj            != null) {
                                //C->->P->O
                                matchResult     = matchCtx.Intersect(matchPred)
                                                          .Intersect(matchObj)
                                                          .ToList<RDFQuadruple>();
                            }
                            else {
                                if (lit        != null) {
                                    //C->->P->L
                                    matchResult = matchCtx.Intersect(matchPred)
                                                          .Intersect(matchLit)
                                                          .ToList<RDFQuadruple>();
                                }
                                else {
                                    //C->->P->
                                    matchResult = matchCtx.Intersect(matchPred)
                                                          .ToList<RDFQuadruple>();
                                }
                            }
                        }
                        else {
                            if (obj            != null) {
                                //C->->->O
                                matchResult     = matchCtx.Intersect(matchObj)
                                                          .ToList<RDFQuadruple>();
                            }
                            else {
                                if (lit        != null) {
                                    //C->->->L
                                    matchResult = matchCtx.Intersect(matchLit)
                                                          .ToList<RDFQuadruple>();
                                }
                                else {
                                    //C->->->
                                    matchResult = matchCtx;
                                }
                            }
                        }
                    }
                }
                else {
                    if (subj                   != null) {
                        if (pred               != null) {
                            if (obj            != null) {
                                //->S->P->O
                                matchResult     = matchSubj.Intersect(matchPred)
                                                           .Intersect(matchObj)
                                                           .ToList<RDFQuadruple>();
                            }
                            else {
                                if (lit        != null) {
                                    //->S->P->L
                                    matchResult = matchSubj.Intersect(matchPred)
                                                           .Intersect(matchLit)
                                                           .ToList<RDFQuadruple>();
                                }
                                else {
                                    //->S->P->
                                    matchResult = matchSubj.Intersect(matchPred)
                                                           .ToList<RDFQuadruple>();
                                }
                            }
                        }
                        else {
                            if (obj            != null) {
                                //->S->->O
                                matchResult     = matchSubj.Intersect(matchObj)
                                                           .ToList<RDFQuadruple>();
                            }
                            else {
                                if (lit        != null) {
                                    //->S->->L
                                    matchResult = matchSubj.Intersect(matchLit)
                                                           .ToList<RDFQuadruple>();
                                }
                                else {
                                    //->S->->
                                    matchResult = matchSubj;
                                }
                            }
                        }
                    }
                    else {
                        if (pred               != null) {
                            if (obj            != null) {
                                //->->P->O
                                matchResult     = matchPred.Intersect(matchObj)
                                                           .ToList<RDFQuadruple>();
                            }
                            else {
                                if (lit        != null) {
                                    //->->P->L
                                    matchResult = matchPred.Intersect(matchLit)
                                                           .ToList<RDFQuadruple>();
                                }
                                else {
                                    //->->P->
                                    matchResult = matchPred;
                                }
                            }
                        }
                        else {
                            if (obj            != null) {
                                //->->->O
                                matchResult     = matchObj;
                            }
                            else {
                                if (lit        != null) {
                                    //->->->L
                                    matchResult = matchLit;
                                }
                                else {
                                    //->->->
                                    matchResult = store.Quadruples.Values.ToList<RDFQuadruple>();
                                }
                            }
                        }
                    }
                }

            }
            return matchResult;
        }
コード例 #52
0
ファイル: RDFStoreIndex.cs プロジェクト: mdesalvo/RDFSharp
 /// <summary>
 /// Selects the quadruples indexed by the given subject
 /// </summary>
 internal HashSet<Int64> SelectIndexBySubject(RDFResource subjectResource)
 {
     if (subjectResource != null) {
         if (this.Subjects.ContainsKey(subjectResource.PatternMemberID)) {
             return this.Subjects[subjectResource.PatternMemberID];
         }
     }
     return new HashSet<Int64>();
 }
コード例 #53
0
 /// <summary>
 /// Removes the quadruples with the given (non-blank) predicate
 /// </summary>
 public override RDFStore RemoveQuadruplesByPredicate(RDFResource predicateResource) {
     if (predicateResource != null && !predicateResource.IsBlank) {
         try {
             //Modify command
             this.Commands["DELETE"].CommandText                 = "DELETE FROM Quadruples WHERE PredicateID = @PREDID";
             this.Commands["DELETE"].CommandTimeout              = 300;
             this.Commands["DELETE"].Parameters.Clear();
             //Open connection
             this.Connection.Open();
             //Open transaction
             this.Commands["DELETE"].Transaction                 = this.Commands["DELETE"].Connection.BeginTransaction();
             //Prepare command
             this.Commands["DELETE"].Prepare();
             //Valorize parameters
             this.Commands["DELETE"].Parameters.Add(new MySqlParameter("PREDID",  MySqlDbType.Int64));
             this.Commands["DELETE"].Parameters["PREDID"].Value  = predicateResource.PatternMemberID;
             //Execute command
             this.Commands["DELETE"].ExecuteNonQuery();
             //Close transaction
             this.Commands["DELETE"].Transaction.Commit();
             //Close connection
             this.Connection.Close();
             //Restore command
             this.Commands["DELETE"].CommandText                 = "DELETE FROM Quadruples WHERE QuadrupleID = @QID";
             this.Commands["DELETE"].CommandTimeout              = 30;
             this.Commands["DELETE"].Parameters.Clear();
             this.Commands["DELETE"].Parameters.Add(new MySqlParameter("QID",  MySqlDbType.Int64));
         }
         catch (Exception ex) {
             //Close transaction
             this.Commands["DELETE"].Transaction.Rollback();
             //Close connection
             this.Connection.Close();
             //Restore command
             this.Commands["DELETE"].CommandText                 = "DELETE FROM Quadruples WHERE QuadrupleID = @QID";
             this.Commands["DELETE"].CommandTimeout              = 30;
             this.Commands["DELETE"].Parameters.Clear();
             this.Commands["DELETE"].Parameters.Add(new MySqlParameter("QID",  MySqlDbType.Int64));
             //Propagate exception
             throw new RDFStoreException("Cannot delete data from MySQL store because: " + ex.Message);
         }
     }
     return this;
 }
コード例 #54
0
        /// <summary>
        /// Removes the quadruples with the given predicate
        /// </summary>
        public override RDFStore RemoveQuadruplesByPredicate(RDFResource predicateResource) {
            if (predicateResource != null) {

                //Create command
                var command        = new MySqlCommand("DELETE FROM Quadruples WHERE PredicateID = @PREDID", this.Connection);
                command.Parameters.Add(new MySqlParameter("PREDID", MySqlDbType.Int64));

                //Valorize parameters
                command.Parameters["PREDID"].Value = predicateResource.PatternMemberID;

                try {

                    //Open connection
                    this.Connection.Open();

                    //Prepare command
                    command.Prepare();

                    //Open transaction
                    command.Transaction = this.Connection.BeginTransaction();

                    //Execute command
                    command.ExecuteNonQuery();

                    //Close transaction
                    command.Transaction.Commit();

                    //Close connection
                    this.Connection.Close();

                }
                catch (Exception ex) {

                    //Rollback transaction
                    command.Transaction.Rollback();

                    //Close connection
                    this.Connection.Close();

                    //Propagate exception
                    throw new RDFStoreException("Cannot delete data from MySQL store because: " + ex.Message, ex);

                }
            }
            return this;
        }
コード例 #55
0
ファイル: RDFContainer.cs プロジェクト: Acidburn0zzz/RDFSharp
        /// <summary>
        /// Builds the reification graph of the container:
        /// Subject -> rdf:type -> [rdf:Bag|rdf:Seq|rdf:Alt] 
        /// Subject -> rdf:_N   -> RDFContainer.ITEM(N)
        /// </summary>
        public RDFGraph ReifyContainer() {
		    RDFGraph reifCont = new RDFGraph();

            //  Subject -> rdf:type -> [rdf:Bag|rdf:Seq|rdf:Alt] 
            switch (this.ContainerType) {
                case RDFModelEnums.RDFContainerTypes.Bag:
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.BAG));
                    break;
                case RDFModelEnums.RDFContainerTypes.Seq:
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.SEQ));
                    break;
                default:
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.ALT));
                    break;
            }

            //  Subject -> rdf:_N -> RDFContainer.ITEM(N)
            Int32 index = 0;
            foreach (Object item in this) {
                RDFResource ordPred = new RDFResource(RDFVocabulary.RDF.BASE_URI + "_" + (++index));
                if (this.ItemType  == RDFModelEnums.RDFItemTypes.Resource) {
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, ordPred, (RDFResource)item));
                }
                else {
                    reifCont.AddTriple(new RDFTriple(this.ReificationSubject, ordPred, (RDFLiteral)item));
                }
            }

            return reifCont;
        }
コード例 #56
0
        /// <summary>
        /// Removes the quadruples with the given resource as object
        /// </summary>
        public override RDFStore RemoveQuadruplesByObject(RDFResource objectResource) {
            if (objectResource != null) {

                //Create command
                var command     = new MySqlCommand("DELETE FROM Quadruples WHERE ObjectID = @OBJID AND TripleFlavor = @TFV", this.Connection);
                command.Parameters.Add(new MySqlParameter("OBJID", MySqlDbType.Int64));
                command.Parameters.Add(new MySqlParameter("TFV",   MySqlDbType.Int32));

                //Valorize parameters
                command.Parameters["OBJID"].Value = objectResource.PatternMemberID;
                command.Parameters["TFV"].Value   = RDFModelEnums.RDFTripleFlavors.SPO;

                try {

                    //Open connection
                    this.Connection.Open();

                    //Prepare command
                    command.Prepare();

                    //Open transaction
                    command.Transaction = this.Connection.BeginTransaction();

                    //Execute command
                    command.ExecuteNonQuery();

                    //Close transaction
                    command.Transaction.Commit();

                    //Close connection
                    this.Connection.Close();

                }
                catch (Exception ex) {

                    //Rollback transaction
                    command.Transaction.Rollback();

                    //Close connection
                    this.Connection.Close();

                    //Propagate exception
                    throw new RDFStoreException("Cannot delete data from MySQL store because: " + ex.Message, ex);

                }
            }
            return this;
        }
コード例 #57
0
 /// <summary>
 /// Default-ctor to build an ontology object property from the given non-blank resource
 /// </summary>
 public RDFOntologyObjectProperty(RDFResource propertyName): base(propertyName) { }
コード例 #58
0
 /// <summary>
 /// Gets a memory store containing quadruples with the specified predicate
 /// </summary>
 public override RDFMemoryStore SelectQuadruplesByPredicate(RDFResource predicateResource) {
     return this.SelectQuadruples(null, null, predicateResource, null, null);
 }
コード例 #59
0
 /// <summary>
 /// Gets a memory store containing quadruples with the specified object
 /// </summary>
 public override RDFStore SelectQuadruplesByObject(RDFResource objectResource) {
     RDFMemoryStore result = new RDFMemoryStore();
     if (objectResource   != null) {
         try {
             //Open connection
             this.Connection.Open();
             //Modify command
             this.Commands["SELECT"].CommandText              += " WHERE TripleFlavor = 1 AND ObjectID = @OBJID";
             //Add parameters
             this.Commands["SELECT"].Parameters.Add(new SQLiteParameter("OBJID", DbType.Int64));
             //Prepare command
             this.Commands["SELECT"].Prepare();
             //Valorize parameters
             this.Commands["SELECT"].Parameters["OBJID"].Value = objectResource.PatternMemberID;
             //Execute command
             using (SQLiteDataReader fetchedQuadruples         = this.Commands["SELECT"].ExecuteReader()) {
                 if (fetchedQuadruples.HasRows) {
                     //Iterate fetched quadruples
                     while (fetchedQuadruples.Read()) {
                         //Add the fetched quadruple to the result
                         result.AddQuadruple(RDFStoreUtilities.ParseQuadruple(fetchedQuadruples));
                     }
                 }
             }
             //Close connection
             this.Connection.Close();
             //Restore command
             this.Commands["SELECT"].CommandText               = "SELECT TripleFlavor, Context, Subject, Predicate, Object FROM main.Quadruples";
             //Restore parameters
             this.Commands["SELECT"].Parameters.Clear();
         }
         catch (Exception ex) {
             //Close connection
             this.Connection.Close();
             //Restore command
             this.Commands["SELECT"].CommandText               = "SELECT TripleFlavor, Context, Subject, Predicate, Object FROM main.Quadruples";
             //Restore parameters
             this.Commands["SELECT"].Parameters.Clear();
             //Propagate exception
             throw new RDFStoreException("Cannot read data from SQLite store because: " + ex.Message);
         }
     }
     return result;
 }
コード例 #60
0
 /// <summary>
 /// Gets a memory store containing quadruples with the specified object
 /// </summary>
 public override RDFMemoryStore SelectQuadruplesByObject(RDFResource objectResource) {
     return this.SelectQuadruples(null, null, null, objectResource, null);
 }