@@ -4081,7 +4081,7 @@ public void ShouldDescribeUnexistingVariableTerms()
40814081 }
40824082
40834083 [ TestMethod ]
4084- public void ShouldDescribeLiteralBoundVariableTerms ( )
4084+ public void ShouldDescribeLiteralBoundVariableTermsOnGraph ( )
40854085 {
40864086 RDFGraph graph = new RDFGraph (
40874087 [
@@ -4125,53 +4125,9 @@ public void ShouldDescribeLiteralBoundVariableTerms()
41254125 }
41264126
41274127 [ TestMethod ]
4128- public void ShouldDescribeLiteralBoundVariableTermsOnAsyncGraph ( )
4128+ public void ShouldDescribeLiteralBoundVariableTermsOnStore ( )
41294129 {
4130- RDFGraph agraph = new RDFGraph (
4131- [
4132- new RDFTriple ( new RDFResource ( "ex:pluto" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:topolino" ) ) ,
4133- new RDFTriple ( new RDFResource ( "ex:topolino" ) , new RDFResource ( "ex:hasName" ) , new RDFPlainLiteral ( "Mickey Mouse" , "en-US" ) ) ,
4134- new RDFTriple ( new RDFResource ( "ex:fido" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:paperino" ) ) ,
4135- new RDFTriple ( new RDFResource ( "ex:paperino" ) , new RDFResource ( "ex:hasName" ) , new RDFPlainLiteral ( "Donald Duck" , "en-US" ) ) ,
4136- new RDFTriple ( new RDFResource ( "ex:balto" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:whoever" ) ) ,
4137- new RDFTriple ( new RDFResource ( "ex:balto" ) , new RDFResource ( "ex:hasColor" ) , new RDFPlainLiteral ( "green" , "en" ) )
4138- ] ) ;
4139-
4140- RDFDescribeQuery query = new RDFDescribeQuery ( )
4141- . AddDescribeTerm ( new RDFVariable ( "?C" ) )
4142- . AddPatternGroup ( new RDFPatternGroup ( )
4143- . AddPattern ( new RDFPattern ( new RDFVariable ( "?Y" ) , new RDFResource ( "ex:dogOf2" ) , new RDFVariable ( "?X" ) ) )
4144- . AddPattern ( new RDFPattern ( new RDFVariable ( "?X" ) , new RDFResource ( "ex:hasName" ) , new RDFVariable ( "?N" ) ) . Optional ( ) )
4145- . UnionWithNext ( ) )
4146- . AddSubQuery ( new RDFSelectQuery ( )
4147- . AddPatternGroup ( new RDFPatternGroup ( )
4148- . AddPattern ( new RDFPattern ( new RDFResource ( "ex:balto" ) , new RDFResource ( "ex:hasColor" ) , new RDFVariable ( "?C" ) ) ) ) ) ;
4149-
4150- DataTable table = new DataTable ( ) ;
4151- table . Columns . Add ( "?Y" , typeof ( string ) ) ;
4152- table . Columns . Add ( "?X" , typeof ( string ) ) ;
4153- table . Columns . Add ( "?N" , typeof ( string ) ) ;
4154- table . Columns . Add ( "?C" , typeof ( string ) ) ;
4155- table . AcceptChanges ( ) ;
4156- DataRow row0 = table . NewRow ( ) ;
4157- row0 [ "?Y" ] = null ;
4158- row0 [ "?X" ] = null ;
4159- row0 [ "?N" ] = null ;
4160- row0 [ "?C" ] = "green@EN" ;
4161- table . Rows . Add ( row0 ) ;
4162-
4163- RDFQueryEngine queryEngine = new RDFQueryEngine ( ) ;
4164- DataTable result = queryEngine . DescribeTerms ( query , agraph , table ) ;
4165-
4166- Assert . IsNotNull ( result ) ;
4167- Assert . AreEqual ( 3 , result . Columns . Count ) ;
4168- Assert . AreEqual ( 1 , result . Rows . Count ) ;
4169- }
4170-
4171- [ TestMethod ]
4172- public void ShouldDescribeLiteralBoundVariableTermsOnAsyncStore ( )
4173- {
4174- RDFMemoryStore astore = new RDFMemoryStore (
4130+ RDFMemoryStore store = new RDFMemoryStore (
41754131 [
41764132 new RDFQuadruple ( new RDFContext ( "ex:org" ) , new RDFResource ( "ex:pluto" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:topolino" ) ) ,
41774133 new RDFQuadruple ( new RDFContext ( "ex:org" ) , new RDFResource ( "ex:topolino" ) , new RDFResource ( "ex:hasName" ) , new RDFPlainLiteral ( "Mickey Mouse" , "en-US" ) ) ,
@@ -4205,7 +4161,7 @@ public void ShouldDescribeLiteralBoundVariableTermsOnAsyncStore()
42054161 table . Rows . Add ( row0 ) ;
42064162
42074163 RDFQueryEngine queryEngine = new RDFQueryEngine ( ) ;
4208- DataTable result = queryEngine . DescribeTerms ( query , astore , table ) ;
4164+ DataTable result = queryEngine . DescribeTerms ( query , store , table ) ;
42094165
42104166 Assert . IsNotNull ( result ) ;
42114167 Assert . AreEqual ( 4 , result . Columns . Count ) ;
@@ -4238,32 +4194,6 @@ public void ShouldApplyPatternToDataSourceGraph()
42384194 Assert . IsTrue ( string . Equals ( result . Rows [ 2 ] [ "?X" ] . ToString ( ) , "ex:whoever" , StringComparison . Ordinal ) ) ;
42394195 }
42404196
4241- [ TestMethod ]
4242- public void ShouldApplyPatternToDataSourceAsyncGraph ( )
4243- {
4244- RDFGraph graph = new RDFGraph (
4245- [
4246- new RDFTriple ( new RDFResource ( "ex:pluto" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:topolino" ) ) ,
4247- new RDFTriple ( new RDFResource ( "ex:topolino" ) , new RDFResource ( "ex:hasName" ) , new RDFPlainLiteral ( "Mickey Mouse" , "en-US" ) ) ,
4248- new RDFTriple ( new RDFResource ( "ex:fido" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:paperino" ) ) ,
4249- new RDFTriple ( new RDFResource ( "ex:paperino" ) , new RDFResource ( "ex:hasName" ) , new RDFPlainLiteral ( "Donald Duck" , "en-US" ) ) ,
4250- new RDFTriple ( new RDFResource ( "ex:balto" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:whoever" ) )
4251- ] ) ;
4252- RDFPattern pattern = new RDFPattern ( new RDFVariable ( "?Y" ) , new RDFResource ( "ex:dogOf" ) , new RDFVariable ( "?X" ) ) ;
4253- RDFQueryEngine queryEngine = new RDFQueryEngine ( ) ;
4254- DataTable result = queryEngine . ApplyPattern ( pattern , graph ) ;
4255-
4256- Assert . IsNotNull ( result ) ;
4257- Assert . AreEqual ( 2 , result . Columns . Count ) ;
4258- Assert . AreEqual ( 3 , result . Rows . Count ) ;
4259- Assert . IsTrue ( string . Equals ( result . Rows [ 0 ] [ "?Y" ] . ToString ( ) , "ex:pluto" , StringComparison . Ordinal ) ) ;
4260- Assert . IsTrue ( string . Equals ( result . Rows [ 0 ] [ "?X" ] . ToString ( ) , "ex:topolino" , StringComparison . Ordinal ) ) ;
4261- Assert . IsTrue ( string . Equals ( result . Rows [ 1 ] [ "?Y" ] . ToString ( ) , "ex:fido" , StringComparison . Ordinal ) ) ;
4262- Assert . IsTrue ( string . Equals ( result . Rows [ 1 ] [ "?X" ] . ToString ( ) , "ex:paperino" , StringComparison . Ordinal ) ) ;
4263- Assert . IsTrue ( string . Equals ( result . Rows [ 2 ] [ "?Y" ] . ToString ( ) , "ex:balto" , StringComparison . Ordinal ) ) ;
4264- Assert . IsTrue ( string . Equals ( result . Rows [ 2 ] [ "?X" ] . ToString ( ) , "ex:whoever" , StringComparison . Ordinal ) ) ;
4265- }
4266-
42674197 [ TestMethod ]
42684198 public void ShouldApplyPatternToDataSourceStore ( )
42694199 {
@@ -4290,30 +4220,6 @@ public void ShouldApplyPatternToDataSourceStore()
42904220 Assert . IsTrue ( string . Equals ( result . Rows [ 2 ] [ "?X" ] . ToString ( ) , "ex:whoever" , StringComparison . Ordinal ) ) ;
42914221 }
42924222
4293- [ TestMethod ]
4294- public async Task ShouldApplyPatternToDataSourceAsyncStore ( )
4295- {
4296- RDFMemoryStore store = new RDFMemoryStore ( ) ;
4297- store . AddQuadruple ( new RDFQuadruple ( new RDFContext ( ) , new RDFResource ( "ex:pluto" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:topolino" ) ) ) ;
4298- store . AddQuadruple ( new RDFQuadruple ( new RDFContext ( ) , new RDFResource ( "ex:topolino" ) , new RDFResource ( "ex:hasName" ) , new RDFPlainLiteral ( "Mickey Mouse" , "en-US" ) ) ) ;
4299- store . AddQuadruple ( new RDFQuadruple ( new RDFContext ( ) , new RDFResource ( "ex:fido" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:paperino" ) ) ) ;
4300- store . AddQuadruple ( new RDFQuadruple ( new RDFContext ( ) , new RDFResource ( "ex:paperino" ) , new RDFResource ( "ex:hasName" ) , new RDFPlainLiteral ( "Donald Duck" , "en-US" ) ) ) ;
4301- store . AddQuadruple ( new RDFQuadruple ( new RDFContext ( ) , new RDFResource ( "ex:balto" ) , new RDFResource ( "ex:dogOf" ) , new RDFResource ( "ex:whoever" ) ) ) ;
4302- RDFPattern pattern = new RDFPattern ( new RDFVariable ( "?Y" ) , new RDFResource ( "ex:dogOf" ) , new RDFVariable ( "?X" ) ) ;
4303- RDFQueryEngine queryEngine = new RDFQueryEngine ( ) ;
4304- DataTable result = queryEngine . ApplyPattern ( pattern , store ) ;
4305-
4306- Assert . IsNotNull ( result ) ;
4307- Assert . AreEqual ( 2 , result . Columns . Count ) ;
4308- Assert . AreEqual ( 3 , result . Rows . Count ) ;
4309- Assert . IsTrue ( string . Equals ( result . Rows [ 0 ] [ "?Y" ] . ToString ( ) , "ex:pluto" , StringComparison . Ordinal ) ) ;
4310- Assert . IsTrue ( string . Equals ( result . Rows [ 0 ] [ "?X" ] . ToString ( ) , "ex:topolino" , StringComparison . Ordinal ) ) ;
4311- Assert . IsTrue ( string . Equals ( result . Rows [ 1 ] [ "?Y" ] . ToString ( ) , "ex:fido" , StringComparison . Ordinal ) ) ;
4312- Assert . IsTrue ( string . Equals ( result . Rows [ 1 ] [ "?X" ] . ToString ( ) , "ex:paperino" , StringComparison . Ordinal ) ) ;
4313- Assert . IsTrue ( string . Equals ( result . Rows [ 2 ] [ "?Y" ] . ToString ( ) , "ex:balto" , StringComparison . Ordinal ) ) ;
4314- Assert . IsTrue ( string . Equals ( result . Rows [ 2 ] [ "?X" ] . ToString ( ) , "ex:whoever" , StringComparison . Ordinal ) ) ;
4315- }
4316-
43174223 [ TestMethod ]
43184224 public void ShouldApplyPatternToDataSourceFederation ( )
43194225 {
0 commit comments