Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christian Willms
hfc
Commits
b07d7615
Commit
b07d7615
authored
Jun 12, 2018
by
Bernd Kiefer
Browse files
Merge branch 'developer' of mlt-gitlab.sb.dfki.de:kiefer/hfc into developer
parents
50307677
6b274671
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/dfki/lt/hfc/TupleStore.java
View file @
b07d7615
...
...
@@ -1788,10 +1788,10 @@ public final class TupleStore {
// distinguish between URIs vs. XSD atoms or blank nodes
literal
=
getObject
(
tuple
[
i
]);
if
(
TupleStore
.
isAtom
(
literal
)
||
TupleStore
.
isBlankNode
(
literal
))
sb
.
append
(
literal
.
replace
(
"xsd:"
,
this
.
namespace
.
getLongForm
(
"xsd"
))
+
" "
);
sb
.
append
(
toUnicode
(
literal
.
replace
(
"xsd:"
,
this
.
namespace
.
getLongForm
(
"xsd"
))
+
" "
)
)
;
else
// a URI
sb
.
append
(
this
.
namespace
.
expandUri
(
literal
)
+
" "
);
sb
.
append
(
toUnicode
(
this
.
namespace
.
expandUri
(
literal
)
+
" "
)
)
;
}
sb
.
append
(
"."
);
return
sb
.
toString
();
...
...
src/test/data/ReadTest/testAtoms.nt
View file @
b07d7615
...
...
@@ -7,4 +7,6 @@
<test:a7> <test:value> "f<oo>"^^<xsd:string> .
<test:a8> <test:value> "f<"o"o"^^<xsd:string> .
<test:a9> <test:value> "fo<o"^^<xsd:string> .
<test:a10> <test:value> "f<"">o"o"^^<xsd:string> .
\ No newline at end of file
<test:a10> <test:value> "f<"">o"o"^^<xsd:string> .
<test:a11> <test:value> "f<"">o^o"^^<xsd:string> .
<test:a12> <test:value> "f<"">o^^"o"^^<xsd:string> .
src/test/java/de/dfki/lt/hfc/TupleStoreTest.java
View file @
b07d7615
...
...
@@ -194,7 +194,7 @@ public class TupleStoreTest {
objectToTest
.
readTuples
(
getTestResource
(
"ReadTest"
,
"testAtoms.nt"
));
assertEquals
(
"Expected 10 tuples but was "
+
objectToTest
.
getAllTuples
().
size
(),
1
0
,
objectToTest
.
getAllTuples
().
size
());
1
2
,
objectToTest
.
getAllTuples
().
size
());
String
[][]
expected
=
{
{
"\"foo\"^^<xsd:string>"
},
{
"\"fo\\o\"^^<xsd:string>"
},
...
...
@@ -205,7 +205,9 @@ public class TupleStoreTest {
{
"\"f<oo>\"^^<xsd:string>"
},
{
"\"f<\"o\"o\"^^<xsd:string>"
},
{
"\"fo<o\"^^<xsd:string>"
},
{
"\"f<\"\">o\"o\"^^<xsd:string>"
}
{
"\"f<\"\">o\"o\"^^<xsd:string>"
},
{
"\"f<\"\">o^o\"^^<xsd:string>"
},
{
"\"f<\"\">o^^\"o\"^^<xsd:string>"
}
};
Query
q
=
new
Query
(
objectToTest
);
BindingTable
bt
=
q
.
query
(
"SELECT ?o WHERE ?s <test:value> ?o"
);
...
...
@@ -233,6 +235,17 @@ public class TupleStoreTest {
for
(
int
[]
tuple
:
objectToTest
.
getAllTuples
())
{
expectedOutput
.
remove
(
objectToTest
.
toString
(
tuple
));
}
bt
=
q
.
query
(
"SELECT ?o WHERE ?s <test:value> ?o"
);
checkResult
(
expected
,
bt
,
"?o"
);
expectedOutput
=
new
HashSet
<
String
>()
{{
add
(
"<test:a1> <test:value> \"Hello foo!\"^^<http://www.w3.org/2001/XMLSchema#string> ."
);
add
(
"<test:a1> <test:value> \"Hello foo\"^^<http://www.w3.org/2001/XMLSchema#string> ."
);
add
(
"<test:a2> <test:value> \"\\u00fc foo\"^^<http://www.w3.org/2001/XMLSchema#string> ."
);
}};
for
(
int
[]
tuple
:
objectToTest
.
getAllTuples
())
{
//System.out.println(objectToTest.toExpandedString(tuple));
expectedOutput
.
remove
(
objectToTest
.
toExpandedString
(
tuple
));
}
assertEquals
(
0
,
expectedOutput
.
size
());
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment