Esempio n. 1
0
        public void writeCallsWriterWriteUriRefOnce()
        {
            RdfWriterCounter writer   = new RdfWriterCounter();
            UriRef           instance = new UriRef("http://example.com/subject");

            instance.Write(writer);

            Assert.AreEqual(1, writer.WriteUriRefCalled);
        }
Esempio n. 2
0
        public void writeCallsWriterWriteUriRefWithCorrectArgument()
        {
            RdfWriterStore writer   = new RdfWriterStore();
            UriRef         instance = new UriRef("http://example.com/subject");

            instance.Write(writer);

            Assert.IsTrue(writer.WasWriteUriRefCalledWith("http://example.com/subject"));
        }
Esempio n. 3
0
        public void GetObject()
        {
            NodeStub theSubject   = new NodeStub("theSubject");
            UriRef   thePredicate = new UriRef("thePredicate");
            NodeStub theObject    = new NodeStub("theObject");

            Statement statement = new Statement(theSubject, thePredicate, theObject);

            Assert.AreSame(theObject, statement.GetObject());
        }
        public void SetUp()
        {
            UriRef uri = new UriRef("http://localhost:8899/models/ResourceQueryTest");

            Store = StoreFactory.CreateStore("provider=dotnetrdf");
            Model = Store.GetModel(new Uri("http://example.org/TestModel"));

            if (!Model.IsEmpty)
            {
                Model.Clear();
            }

            if (Model.IsEmpty)
            {
                IResource q           = null;
                string    uriTemplate = "http://example.com/counter/{0}";
                for (int i = 1; i < 51; i++)
                {
                    IResource r = Model.CreateResource <Resource>(new Uri(string.Format(uriTemplate, i)));
                    r.AddProperty(nco.fullname, (char)(i % 26));
                    r.AddProperty(nco.gender, (i % 2 == 1) ? nco.female : nco.male);

                    if (i % 5 != 0)
                    {
                        r.AddProperty(rdf.type, nco.PersonContact);
                    }
                    else
                    {
                        r.AddProperty(rdf.type, nco.OrganizationContact);
                    }

                    if (i <= 30)
                    {
                        r.AddProperty(nco.birthDate, new DateTime(1989, 12, i));
                    }
                    else
                    {
                        r.AddProperty(nco.birthDate, new DateTime(1990, 1, i - 30));
                    }

                    if (q != null)
                    {
                        r.AddProperty(nie.relatedTo, q);
                    }
                    else
                    {
                        _resource = r;
                    }

                    r.Commit();
                    q = r;
                }
            }
        }
Esempio n. 5
0
        private void CreateRows(ISparqlQueryResult result)
        {
            _items.Clear();

            foreach (BindingSet binding in result.GetBindings())
            {
                ActivityLogItem item = new ActivityLogItem();

                item.Activity = new UriRef(binding["activity"].ToString());
                item.Agent    = new UriRef(binding["agent"].ToString());

                if (_agents.ContainsKey(item.Agent))
                {
                    item.AgentColour = _agents[item.Agent].ColourCode;
                }

                item.Date = (DateTime)binding["influenceTime"];

                if (!(binding["influenceType"] is DBNull))
                {
                    item.InfluenceType = ToDisplayString(binding["influenceType"].ToString());
                }

                if (!(binding["description"] is DBNull))
                {
                    item.Description = binding["description"].ToString();
                }

                UriRef entityType = new UriRef(binding["entityType"].ToString());

                if (entityType == nfo.FileDataObject.Uri)
                {
                    string value = binding["value"].ToString();

                    item.Data = value;
                }
                else
                {
                    UriRef entityUri = new UriRef(binding["entity"].ToString());

                    item.Data = entityUri.Host;
                }

                if (!(binding["bounds"] is DBNull))
                {
                    item.InfluencedRegion = binding["bounds"].ToString();
                }

                _items.Add(item);
            }

            DataStore = _items;
        }
Esempio n. 6
0
        public int Run()
        {
            if (_settings == null)
            {
                throw new Exception("Trinity config file (app.config or web.config) not initialized.");
            }

            _sourceDir = new FileInfo(_configPath).Directory;

            if (!string.IsNullOrEmpty(_generatePath))
            {
                FileInfo fileInfo = new FileInfo(_generatePath);

                using (OntologyGenerator generator = new OntologyGenerator(_settings.Namespace))
                {
                    generator.Logger = Logger;

                    if (_settings.Ontologies != null)
                    {
                        foreach (var ontology in _settings.Ontologies)
                        {
                            UriRef t = GetPathFromSource(ontology.FileSource);

                            if (!generator.ImportOntology(ontology.Uri, t))
                            {
                                FileInfo ontologyFile = new FileInfo(t.LocalPath);

                                ElementInformation info = ontology.ElementInformation;

                                Logger.LogWarning(string.Format("Could not read ontology <{0}> from path {1}.", ontology.Uri, ontologyFile.FullName), info);
                            }

                            if (!generator.AddOntology(ontology.Uri, ontology.MetadataUri, ontology.Prefix))
                            {
                                Logger.LogMessage("Ontology with uri <{0}> or uri <{1}> could not be found in store.", ontology.Uri, ontology.MetadataUri);
                            }
                        }

                        generator.GenerateFile(fileInfo);
                    }
                    else
                    {
                        Logger.LogMessage("No ontologies configured in TrinitySettings section in app.config or web.config.");
                    }
                }

                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 7
0
        public int Run()
        {
            LoadLegacyConfigFile();
            if (_configuration == null)
            {
                LoadConfigFile();
            }

            if (_configuration == null)
            {
                throw new Exception("Trinity config file not fount. The project does neither have a new style (ontologies.config) or legacy (app.config or web.config) configuration file available.");
            }

            _sourceDir = new FileInfo(_configPath).Directory;

            if (!string.IsNullOrEmpty(_generatePath))
            {
                FileInfo fileInfo = new FileInfo(_generatePath);

                using (OntologyGenerator generator = new OntologyGenerator(_configuration.Namespace))
                {
                    generator.Logger = Logger;


                    foreach (var ontology in _configuration.ListOntologies())
                    {
                        UriRef t = GetPathFromLocation(ontology.Location);

                        if (!generator.ImportOntology(ontology.Uri, t))
                        {
                            FileInfo ontologyFile = new FileInfo(t.LocalPath);


                            Logger.LogWarning(string.Format("Could not read ontology <{0}> from path {1}.", ontology.Uri, ontologyFile.FullName));
                        }

                        if (!generator.AddOntology(ontology.Uri, null, ontology.Prefix))
                        {
                            Logger.LogMessage("Ontology with uri <{0}> or uri <{1}> could not be found in store.", ontology.Uri, null);
                        }
                    }

                    generator.GenerateFile(fileInfo);
                }

                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 8
0
        public static void InstallAgent(IModel model, string uri, string name, string executableName, string colour, bool captureEnabled = false)
        {
            Console.WriteLine("Installing agent {0}..", name);

            UriRef agentUri = new UriRef(uri);

            if (!model.ContainsResource(agentUri))
            {
                SoftwareAgent agent = model.CreateResource <SoftwareAgent>(agentUri);
                agent.Name             = name;
                agent.ExecutableName   = executableName;
                agent.IsCaptureEnabled = captureEnabled;
                agent.ColourCode       = colour;
                agent.Commit();
            }
            else
            {
                bool modified = false;

                SoftwareAgent agent = model.GetResource <SoftwareAgent>(agentUri);

                if (!agent.HasProperty(rdf.type, prov.SoftwareAgent))
                {
                    agent.AddProperty(rdf.type, prov.SoftwareAgent);

                    modified = true;
                }

                if (agent.Name != name)
                {
                    agent.Name = name;

                    modified = true;
                }

                if (string.IsNullOrEmpty(agent.ColourCode))
                {
                    agent.ColourCode = colour;

                    modified = true;
                }

                if (modified)
                {
                    agent.Commit();
                }
            }
        }
Esempio n. 9
0
        public void AddTripleStoreWithCommonNodes()
        {
            UriRef node1 = new  UriRef("any:node1");
            UriRef node2 = new  UriRef("any:node2");
            UriRef node3 = new  UriRef("any:node3");
            UriRef node4 = new  UriRef("any:node4");
            UriRef node5 = new  UriRef("any:node5");
            UriRef node6 = new  UriRef("any:node6");

            UriRef predicate1 = new UriRef("any:predicate1");
            UriRef predicate2 = new UriRef("any:predicate2");
            UriRef predicate3 = new UriRef("any:predicate3");

            Statement statement1 = new Statement(node1, predicate1, node2);
            Statement statement2 = new Statement(node3, predicate2, node4);
            Statement statement3 = new Statement(node5, predicate3, node6);
            Statement statement4 = new Statement(node1, predicate2, node6);

            TripleStore firstStore = MakeNewTripleStore();

            firstStore.Add(statement1);

            TripleStore secondStore = MakeNewTripleStore();

            secondStore.Add(statement2);
            secondStore.Add(statement3);
            secondStore.Add(statement4);


            firstStore.Add(secondStore);
            TripleStoreVerifier verifierFirst = new TripleStoreVerifier();

            verifierFirst.expect("<any:node1> <any:predicate1> <any:node2> .");
            verifierFirst.expect("<any:node3> <any:predicate2> <any:node4> .");
            verifierFirst.expect("<any:node5> <any:predicate3> <any:node6> .");
            verifierFirst.expect("<any:node1> <any:predicate2> <any:node6> .");
            Assert.IsTrue(verifierFirst.verify(firstStore), "first knowledge base includes triples from second");

            TripleStoreVerifier verifierSecond = new TripleStoreVerifier();

            verifierSecond.expect("<any:node3> <any:predicate2> <any:node4> .");
            verifierSecond.expect("<any:node5> <any:predicate3> <any:node6> .");
            verifierSecond.expect("<any:node1> <any:predicate2> <any:node6> .");

            Assert.IsTrue(verifierSecond.verify(secondStore), "second knowledge base is unchanged");
            firstStore.Clear();
            secondStore.Clear();
        }
Esempio n. 10
0
        private void LoadBindings(IEnumerable <BindingSet> bindings)
        {
            Dictionary <string, JournalViewListItem> items = new Dictionary <string, JournalViewListItem>();

            foreach (BindingSet binding in bindings)
            {
                string url = binding["fileUrl"].ToString();

                // Skip any malformed URIs.
                if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
                {
                    continue;
                }

                // Do not list files which do not exist.
                string path = new Uri(url).LocalPath;

                if (!File.Exists(path))
                {
                    continue;
                }

                UriRef   agent       = new UriRef(binding["agent"].ToString());
                DateTime startTime   = (DateTime)binding["startTime"];
                DateTime endTime     = (DateTime)binding["endTime"];
                TimeSpan editingTime = endTime - startTime;

                JournalViewListItem item = new JournalViewListItem()
                {
                    Agent            = agent,
                    FileUrl          = url,
                    FilePath         = path,
                    LastEditingDate  = startTime,
                    TotalEditingTime = editingTime
                };

                if (items.ContainsKey(path))
                {
                    items[path].TotalEditingTime += item.TotalEditingTime;
                }
                else
                {
                    items[path] = item;
                }
            }

            _grid.DataStore = items.Values;
        }
Esempio n. 11
0
        public void hasResourceDenotedBy()
        {
            DatabaseTripleStore store = (DatabaseTripleStore)MakeNewTripleStore();
            Node      subject         = new UriRef("abc");
            Arc       predicate       = new UriRef("def");
            Node      obj             = new UriRef("ghi");
            Node      dummy           = new UriRef("xxxxxxx");
            Statement s = new Statement(subject, predicate, obj);

            store.Add(s);
            Assert.IsTrue(store.HasResourceDenotedBy(subject), "store has subject");
            Assert.IsTrue(store.HasResourceDenotedBy(predicate), "store has predicate");
            Assert.IsTrue(store.HasResourceDenotedBy(obj), "store has object");
            Assert.IsFalse(store.HasResourceDenotedBy(dummy), "store has dummy");
            store.Clear();
        }
Esempio n. 12
0
        public static Uri GetFileUri(string fileUrl)
        {
            Uri url = new Uri(fileUrl);

            if (_monitoredFileUris.ContainsKey(url))
            {
                return(_monitoredFileUris[url]);
            }
            else
            {
                Uri uri = UriRef.GetGuid("http://semiodesk.com/id/{0}");

                _monitoredFileUris[url] = uri;

                return(uri);
            }
        }
Esempio n. 13
0
        private IList GetNodesDenoting(Resource theResource, bool onlyTheBest)
        {
            ArrayList    theNodes = new ArrayList();
            MySqlCommand cmd      = new MySqlCommand(
                "SELECT rn.nodeHash, rn.nodeType, u.uri, pl.value, l.value, tl.value, t.value " +
                "FROM resourcenodes rn " +
                "LEFT OUTER JOIN UriRefs u ON rn.nodeHash=u.hash AND rn.nodeType='u' " +
                "LEFT OUTER JOIN Plainliterals pl ON rn.nodeHash = pl.hash AND rn.nodeType='p' " +
                "LEFT OUTER JOIN Languages l ON pl.languageHash = l.hash " +
                "LEFT OUTER JOIN TypedLiterals tl ON rn.nodehash = tl.hash AND rn.nodeType = 't' " +
                "LEFT OUTER JOIN DataTypes t ON tl.datatypeHash = t.hash " +
                "WHERE rn.graphId = " + itsHashCode + " AND rn.resourceHash = " + theResource.GetHashCode() + (onlyTheBest == true ? " LIMIT 1" : ""), itsConn);
            MySqlDataReader dataReader = cmd.ExecuteReader();
            int             nodeHash;
            char            nodeType;

            while (dataReader.Read())
            {
                nodeHash = dataReader.GetInt32(0);
                nodeType = dataReader.GetChar(1);
                GraphMember node = null;
                switch (nodeType)
                {
                case 'u':
                    node = new UriRef(dataReader.GetString(2));
                    break;

                case 'b':
                    node = new BlankNode(nodeHash);
                    break;

                case 'p':
                    node = new PlainLiteral(dataReader.GetString(3), dataReader.GetString(4));
                    break;

                case 't':
                    node = new TypedLiteral(dataReader.GetString(5), dataReader.GetString(6));
                    break;
                }
                theNodes.Add(node);
            }
            dataReader.Close();
            return(theNodes);
        }
Esempio n. 14
0
        public void AddDistinguishesDifferentBlankNodeInstances()
        {
            Node theSubject      = new NodeStub("http://example.com/subj");
            Arc  thePredicate    = new UriRef("http://example.com/pred");
            Node theFirstObject  = new UriRef("http://example.com/obj1");
            Node theSecondObject = new UriRef("http://example.com/obj2");

            TripleStore store = MakeNewTripleStore();

            store.Add(new Statement(new BlankNode(), new UriRef("http://example.com/pred"), new UriRef("http://example.com/obj1")));
            store.Add(new Statement(new BlankNode(), new UriRef("http://example.com/pred"), new UriRef("http://example.com/obj2")));

            TripleStoreVerifier verifier = new TripleStoreVerifier();

            verifier.expect("_:node1 <http://example.com/pred> <http://example.com/obj1> .");
            verifier.expect("_:node2 <http://example.com/pred> <http://example.com/obj2> .");

            Assert.IsTrue(verifier.verify(store));
            store.Clear();
        }
Esempio n. 15
0
        protected UriRef GetPathFromLocation(string location)
        {
            UriRef result = null;

            if (!string.IsNullOrEmpty(location))
            {
                string sourcePath = location;

                if (Path.IsPathRooted(sourcePath))
                {
                    result = new UriRef(sourcePath);
                }
                else
                {
                    string fullPath = Path.Combine(_sourceDir.FullName, sourcePath);
                    result = new UriRef(fullPath);
                }
            }
            return(result);
        }
Esempio n. 16
0
        public void GetResourceDenotedReturnsSameResourceEvenAfterAllStatementsReferringToResourceHaveBeenRemoved()
        {
            TripleStore store = MakeNewTripleStore();

            BlankNode theSubjectNode   = new BlankNode();
            UriRef    thePredicateNode = new UriRef("http://example.com/pred");
            BlankNode theObjectNode    = new BlankNode();

            store.Add(new Statement(theSubjectNode, thePredicateNode, theObjectNode));

            Resource theSubjectResourceBefore   = store.GetResourceDenotedBy(theSubjectNode);
            Resource thePredicateResourceBefore = store.GetResourceDenotedBy(thePredicateNode);
            Resource theObjectResourceBefore    = store.GetResourceDenotedBy(theObjectNode);

            store.Remove(new ResourceStatement(theSubjectResourceBefore, thePredicateResourceBefore, theObjectResourceBefore));

            Assert.AreEqual(theSubjectResourceBefore, store.GetResourceDenotedBy(theSubjectNode), "Subject resource should be the same");
            Assert.AreEqual(thePredicateResourceBefore, store.GetResourceDenotedBy(thePredicateNode), "Predicate resource should be the same");
            Assert.AreEqual(theObjectResourceBefore, store.GetResourceDenotedBy(theObjectNode), "Object resource should be the same");
            store.Clear();
        }
Esempio n. 17
0
        protected UriRef GetPathFromSource(FileSource source)
        {
            UriRef result = null;

            if (source != null)
            {
                string sourcePath = (source as FileSource).Location;

                if (Path.IsPathRooted(sourcePath))
                {
                    result = new UriRef(sourcePath);
                }
                else
                {
                    string fullPath = Path.Combine(_sourceDir.FullName, sourcePath);
                    result = new UriRef(fullPath);
                }
            }

            return(result);
        }
Esempio n. 18
0
        public void TestEquals()
        {
            UriRef u0 = new UriRef("http://semiodesk.com/ontologies/ppo");
            UriRef u1 = new UriRef("http://semiodesk.com/ontologies/ppo#UriScehma");

            Assert.AreNotEqual(u0, u1);
            Assert.IsFalse(u0 == u1);
            Assert.AreEqual(u0, u0);


            UriRef u2 = new UriRef("file://D:/Documents/x.doc");
            UriRef u3 = new UriRef("file://D:/Documents/2012/../x.doc");

            Assert.AreEqual(u2, u3);
            Assert.IsTrue(u2 == u3);

            UriRef u4 = new UriRef("file://D:/Documents/x.doc#Metadata");
            UriRef u5 = new UriRef("file://D:/Documents/2012/../x.doc#Metadata");

            Assert.AreEqual(u4, u5);
        }
Esempio n. 19
0
        private data.Canvas TryGetCanvas(string filePath)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                return(null);
            }

            IModel model = data.Models.GetActivities();

            string queryString = @"
                PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
                PREFIX nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#>
                PREFIX prov: <http://www.w3.org/ns/prov#>
                PREFIX art: <http://semiodesk.com/artivity/1.0/>

                SELECT DISTINCT ?canvas WHERE
                {
                       ?activity prov:used ?file .
                       ?activity prov:startedAtTime ?startTime .

                       ?file rdf:type nfo:FileDataObject .
                       ?file nfo:fileUrl ""file://" + Uri.EscapeUriString(filePath) + @""" .
                       ?file art:canvas ?canvas .
                }
                ORDER BY DESC(?startTime) LIMIT 1";

            SparqlQuery        query  = new SparqlQuery(queryString);
            ISparqlQueryResult result = model.ExecuteQuery(query);

            BindingSet bindings = result.GetBindings().FirstOrDefault();

            if (bindings == null || !bindings.ContainsKey("canvas"))
            {
                return(null);
            }

            UriRef canvasUri = new UriRef(bindings["canvas"].ToString());

            return(model.GetResource <data.Canvas>(canvasUri));
        }
Esempio n. 20
0
        public void RemoveExistingTriple()
        {
            TripleStore store = MakeNewTripleStore();

            BlankNode theSubjectNode   = new BlankNode();
            UriRef    thePredicateNode = new UriRef("http://example.com/pred");
            BlankNode theObjectNode    = new BlankNode();

            store.Add(new Statement(theSubjectNode, thePredicateNode, theObjectNode));

            Resource theSubjectResource   = store.GetResourceDenotedBy(theSubjectNode);
            Resource thePredicateResource = store.GetResourceDenotedBy(thePredicateNode);
            Resource theObjectResource    = store.GetResourceDenotedBy(theObjectNode);

            //store.verbose = true;
            store.Remove(new ResourceStatement(theSubjectResource, thePredicateResource, theObjectResource));

            TripleStoreVerifier verifier = new TripleStoreVerifier();

            Assert.IsTrue(verifier.verify(store));
            store.Clear();
        }
Esempio n. 21
0
        private void OnActivityLogSelectedItemsChanged(object sender, EventArgs e)
        {
            ActivityLogItem selectedItem = _log.SelectedItem as ActivityLogItem;

            if (selectedItem == null || string.IsNullOrEmpty(selectedItem.InfluencedRegion))
            {
                return;
            }

            UriRef regionUri = new UriRef(selectedItem.InfluencedRegion);

            data.Rectangle region = Model.GetResource <data.Rectangle>(regionUri);

            _header.Thumbnail.HighlightColour   = Color.Parse(selectedItem.AgentColour);
            _header.Thumbnail.HighlightedRegion = region;

            data.Activity activity = Model.GetResource <data.Activity>(selectedItem.Activity);

            _chart.Zoom(activity.StartTime, activity.EndTime);

            _chart.SetTitle(selectedItem.Date);
            _chart.SetPositionMarker(selectedItem.Date);
        }
Esempio n. 22
0
        public void AddTripleStoreWithIdenticalNodesDenotingDifferentResources()
        {
            UriRef node1 = new  UriRef("any:node1");
            UriRef node2 = new  UriRef("any:node2");
            UriRef node3 = new  UriRef("any:node3");

            UriRef predicate1 = new UriRef("any:predicate1");
            UriRef predicate2 = new UriRef("any:predicate2");

            Statement statement1 = new Statement(node1, predicate1, node2);
            Statement statement2 = new Statement(node1, predicate2, node3);

            TripleStore firstStore = MakeNewTripleStore();

            firstStore.Add(statement1);

            Resource node1ResourceBefore = firstStore.GetResourceDenotedBy(node1);

            TripleStore secondStore = MakeNewTripleStore();

            firstStore.Add(statement2);

            firstStore.Add(secondStore);

            Resource node1ResourceAfter = firstStore.GetResourceDenotedBy(node1);

            Assert.AreEqual(node1ResourceBefore, node1ResourceAfter);

            TripleStoreVerifier verifierFirst = new TripleStoreVerifier();

            verifierFirst.expect("<any:node1> <any:predicate1> <any:node2> .");
            verifierFirst.expect("<any:node1> <any:predicate2> <any:node3> .");
            Assert.IsTrue(verifierFirst.verify(firstStore), "first knowledge base includes triples from second");

            firstStore.Clear();
            secondStore.Clear();
        }
Esempio n. 23
0
        private Rule MakeAxioms()
        {
            Rule axioms = new Rule();

            axioms.AddConsequent(new Pattern(Schema.rdfs.comment, Schema.rdfs.domain, Schema.rdfs.Resource));
            axioms.AddConsequent(new Pattern(Schema.rdfs.comment, Schema.rdfs.range, Schema.rdfs.Literal));

            axioms.AddConsequent(new Pattern(Schema.rdfs.domain, Schema.rdfs.domain, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdfs.domain, Schema.rdfs.range, Schema.rdfs.Class));

            axioms.AddConsequent(new Pattern(Schema.rdf.first, Schema.rdf.type, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdf.first, Schema.rdfs.domain, Schema.rdf.List));
            axioms.AddConsequent(new Pattern(Schema.rdf.first, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdfs.isDefinedBy, Schema.rdfs.domain, Schema.rdfs.Resource));
            axioms.AddConsequent(new Pattern(Schema.rdfs.isDefinedBy, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdfs.label, Schema.rdfs.domain, Schema.rdfs.Resource));
            axioms.AddConsequent(new Pattern(Schema.rdfs.label, Schema.rdfs.range, Schema.rdfs.Literal));

            axioms.AddConsequent(new Pattern(Schema.rdfs.member, Schema.rdfs.domain, Schema.rdfs.Resource));
            axioms.AddConsequent(new Pattern(Schema.rdfs.member, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdf.nil, Schema.rdf.type, Schema.rdf.Property));

            axioms.AddConsequent(new Pattern(Schema.rdf.object_, Schema.rdf.type, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdf.object_, Schema.rdfs.domain, Schema.rdf.Statement));
            axioms.AddConsequent(new Pattern(Schema.rdf.object_, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdf.predicate, Schema.rdf.type, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdf.predicate, Schema.rdfs.domain, Schema.rdf.Statement));
            axioms.AddConsequent(new Pattern(Schema.rdf.predicate, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdfs.range, Schema.rdfs.domain, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdfs.range, Schema.rdfs.range, Schema.rdfs.Class));

            axioms.AddConsequent(new Pattern(Schema.rdf.rest, Schema.rdf.type, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdf.rest, Schema.rdfs.domain, Schema.rdf.List));
            axioms.AddConsequent(new Pattern(Schema.rdf.rest, Schema.rdfs.range, Schema.rdf.List));

            axioms.AddConsequent(new Pattern(Schema.rdfs.seeAlso, Schema.rdfs.domain, Schema.rdfs.Resource));
            axioms.AddConsequent(new Pattern(Schema.rdfs.seeAlso, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdf.subject, Schema.rdf.type, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdf.subject, Schema.rdfs.domain, Schema.rdf.Statement));
            axioms.AddConsequent(new Pattern(Schema.rdf.subject, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdfs.subClassOf, Schema.rdfs.domain, Schema.rdfs.Class));
            axioms.AddConsequent(new Pattern(Schema.rdfs.subClassOf, Schema.rdfs.range, Schema.rdfs.Class));

            axioms.AddConsequent(new Pattern(Schema.rdfs.subPropertyOf, Schema.rdfs.domain, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdfs.subPropertyOf, Schema.rdfs.range, Schema.rdf.Property));

            axioms.AddConsequent(new Pattern(Schema.rdf.type, Schema.rdf.type, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdf.type, Schema.rdfs.domain, Schema.rdfs.Resource));
            axioms.AddConsequent(new Pattern(Schema.rdf.type, Schema.rdfs.range, Schema.rdfs.Class));

            axioms.AddConsequent(new Pattern(Schema.rdf.value, Schema.rdf.type, Schema.rdf.Property));
            axioms.AddConsequent(new Pattern(Schema.rdf.value, Schema.rdfs.domain, Schema.rdfs.Resource));
            axioms.AddConsequent(new Pattern(Schema.rdf.value, Schema.rdfs.range, Schema.rdfs.Resource));

            axioms.AddConsequent(new Pattern(Schema.rdf.Alt, Schema.rdfs.subClassOf, Schema.rdfs.Container));
            axioms.AddConsequent(new Pattern(Schema.rdf.Bag, Schema.rdfs.subClassOf, Schema.rdfs.Container));
            axioms.AddConsequent(new Pattern(Schema.rdf.Seq, Schema.rdfs.subClassOf, Schema.rdfs.Container));
            axioms.AddConsequent(new Pattern(Schema.rdfs.ContainerMembershipProperty, Schema.rdfs.subClassOf, Schema.rdf.Property));

            axioms.AddConsequent(new Pattern(Schema.rdfs.isDefinedBy, Schema.rdfs.subPropertyOf, Schema.rdfs.seeAlso));

            axioms.AddConsequent(new Pattern(Schema.rdf.XMLLiteral, Schema.rdf.type, Schema.rdfs.Datatype));
            axioms.AddConsequent(new Pattern(Schema.rdf.XMLLiteral, Schema.rdfs.subClassOf, Schema.rdfs.Literal));
            axioms.AddConsequent(new Pattern(Schema.rdfs.Datatype, Schema.rdfs.subClassOf, Schema.rdfs.Class));

            for (int listIndex = 1; listIndex < 16; ++listIndex)
            {
                UriRef listIndexProperty = new UriRef(Schema.rdf._nsprefix + "_" + listIndex);
                axioms.AddConsequent(new Pattern(listIndexProperty, Schema.rdf.type, Schema.rdf.Property));
                axioms.AddConsequent(new Pattern(listIndexProperty, Schema.rdf.type, Schema.rdfs.ContainerMembershipProperty));
                axioms.AddConsequent(new Pattern(listIndexProperty, Schema.rdfs.domain, Schema.rdfs.Resource));
                axioms.AddConsequent(new Pattern(listIndexProperty, Schema.rdfs.range, Schema.rdfs.Resource));
            }

            return(axioms);
        }
 public AnotherBaseClas(UriRef uri) : base(uri)
 {
 }
Esempio n. 25
0
 public override Statement MakeStatement(BlankNode subject, UriRef predicate, TypedLiteral value)
 {
     return(new StatementStub());
 }
 public SubSubClass(UriRef uri) : base(uri)
 {
 }
 public BaseClass(UriRef uri) : base(uri)
 {
 }
Esempio n. 28
0
        public void labelIsUriRefStringValue()
        {
            UriRef obj = new UriRef("http://example.com/subject");

            Assert.AreEqual("http://example.com/subject", obj.GetLabel());
        }
Esempio n. 29
0
        public void alwaysEqualsSelf()
        {
            UriRef instance = new UriRef("http://example.com/subject");

            Assert.IsTrue(instance.Equals(instance));
        }
Esempio n. 30
0
        public void neverEqualsNull()
        {
            UriRef instance = new UriRef("http://example.com/subject");

            Assert.IsFalse(instance.Equals(null));
        }