1 |
diff -Naur soprano/backends/redland/redlandqueryresult.cpp soprano-2.6.51/backends/redland/redlandqueryresult.cpp |
diff -Naur soprano-2.6.51/backends/redland/redlandqueryresult.cpp soprano/backends/redland/redlandqueryresult.cpp |
2 |
--- soprano/backends/redland/redlandqueryresult.cpp 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/backends/redland/redlandqueryresult.cpp 2011-06-05 10:38:25.000000000 +0200 |
3 |
+++ soprano-2.6.51/backends/redland/redlandqueryresult.cpp 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/backends/redland/redlandqueryresult.cpp 2011-07-19 18:49:58.000000000 +0200 |
4 |
@@ -77,10 +77,9 @@ |
@@ -77,9 +77,10 @@ |
5 |
d->model = model; |
d->model = model; |
6 |
|
|
7 |
const char** names = 0; |
const char** names = 0; |
8 |
- int number = librdf_query_results_get_bindings_count(d->result); |
+ int number = librdf_query_results_get_bindings_count(d->result); |
9 |
if ( !librdf_query_results_get_bindings( d->result, &names, 0 ) ) { |
if ( !librdf_query_results_get_bindings( d->result, &names, 0 ) ) { |
10 |
- for ( int i = 0; i < number; i++ ) { |
- for ( ; *names; names++ ) { |
11 |
- d->names.append( QString::fromUtf8( names[i] ) ); |
- d->names.append( QString::fromUtf8( *names ) ); |
12 |
+ for ( ; *names; names++ ) { |
+ for ( int i = 0; i < number; i++ ) { |
13 |
+ d->names.append( QString::fromUtf8( *names ) ); |
+ d->names.append( QString::fromUtf8( names[i] ) ); |
14 |
} |
} |
15 |
} |
} |
16 |
} |
} |
17 |
diff -Naur soprano/ChangeLog soprano-2.6.51/ChangeLog |
diff -Naur soprano-2.6.51/ChangeLog soprano/ChangeLog |
18 |
--- soprano/ChangeLog 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/ChangeLog 2011-06-05 10:38:25.000000000 +0200 |
19 |
+++ soprano-2.6.51/ChangeLog 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/ChangeLog 2011-07-19 18:49:58.000000000 +0200 |
20 |
@@ -2,8 +2,6 @@ |
@@ -2,6 +2,8 @@ |
21 |
* Use the new Virtuoso parameter XAnyNormalization to use normalized accents for full-text searching by default. |
* Use the new Virtuoso parameter XAnyNormalization to use normalized accents for full-text searching by default. |
22 |
* Updated NAO Vocabulary namespace to include changes from SDO 0.7. |
* Updated NAO Vocabulary namespace to include changes from SDO 0.7. |
23 |
* Added method LiteralValue::fromVariant which provides some useful type conversions. |
* Added method LiteralValue::fromVariant which provides some useful type conversions. |
24 |
- * Fixed incorrect binding names counting in redland queries |
+ * Fixed incorrect binding names counting in redland queries |
25 |
- * Ported Raptor serializer and parser plugins to Raptor2. |
+ * Ported Raptor serializer and parser plugins to Raptor2. |
26 |
|
|
27 |
2.6.1 |
2.6.1 |
28 |
* Let onto2vocabularyclass convert dots in entity names to underscores to create valid C++ names. |
* Let onto2vocabularyclass convert dots in entity names to underscores to create valid C++ names. |
29 |
diff -Naur soprano/cmake/modules/FindRaptor.cmake soprano-2.6.51/cmake/modules/FindRaptor.cmake |
diff -Naur soprano-2.6.51/cmake/modules/FindRaptor.cmake soprano/cmake/modules/FindRaptor.cmake |
30 |
--- soprano/cmake/modules/FindRaptor.cmake 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/cmake/modules/FindRaptor.cmake 2011-06-05 10:38:25.000000000 +0200 |
31 |
+++ soprano-2.6.51/cmake/modules/FindRaptor.cmake 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/cmake/modules/FindRaptor.cmake 2011-07-19 18:49:58.000000000 +0200 |
32 |
@@ -5,13 +5,9 @@ |
@@ -5,9 +5,13 @@ |
33 |
# RAPTOR_LIBRARIES - Link these to use Raptor |
# RAPTOR_LIBRARIES - Link these to use Raptor |
34 |
# RAPTOR_INCLUDE_DIR - Include directory for using Raptor |
# RAPTOR_INCLUDE_DIR - Include directory for using Raptor |
35 |
# RAPTOR_DEFINITIONS - Compiler switches required for using Raptor |
# RAPTOR_DEFINITIONS - Compiler switches required for using Raptor |
36 |
-# |
-# RAPTOR_VERSION - The Raptor version string |
37 |
-# Capabilities |
+# |
38 |
-# RAPTOR_HAVE_TRIG - Set if raptor has TRIG |
+# Capabilities |
39 |
+# RAPTOR_VERSION - The Raptor version string |
+# RAPTOR_HAVE_TRIG - Set if raptor has TRIG |
40 |
|
|
41 |
-# (c) 2007-2011 Sebastian Trueg <trueg@kde.org> |
-# (c) 2007-2009 Sebastian Trueg <trueg@kde.org> |
42 |
-# (c) 2011 Artem Serebriyskiy <v.for.vandal@gmail.com> |
+# (c) 2007-2011 Sebastian Trueg <trueg@kde.org> |
43 |
-# (c) 2011 Michael Jansen <kde@michael-jansen.biz> |
+# (c) 2011 Artem Serebriyskiy <v.for.vandal@gmail.com> |
44 |
+# (c) 2007-2009 Sebastian Trueg <trueg@kde.org> |
+# (c) 2011 Michael Jansen <kde@michael-jansen.biz> |
45 |
# |
# |
46 |
# Based on FindFontconfig Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org> |
# Based on FindFontconfig Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org> |
47 |
# |
# |
48 |
@@ -19,83 +15,89 @@ |
@@ -15,89 +19,83 @@ |
49 |
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
50 |
|
|
51 |
|
|
52 |
-MACRO ( FIND_RAPTOR libname libhints includehints ) |
-INCLUDE(MacroEnsureVersion) |
53 |
- find_library_with_debug( |
- |
54 |
- RAPTOR_LIBRARIES |
+MACRO ( FIND_RAPTOR libname libhints includehints ) |
55 |
- WIN32_DEBUG_POSTFIX d |
+ find_library_with_debug( |
56 |
- NAMES ${libname} |
+ RAPTOR_LIBRARIES |
57 |
- HINTS ${libhints}) |
+ WIN32_DEBUG_POSTFIX d |
58 |
- find_path( |
+ NAMES ${libname} |
59 |
- RAPTOR_INCLUDE_DIR raptor.h |
+ HINTS ${libhints}) |
60 |
- HINTS ${includehints} |
+ find_path( |
61 |
- PATH_SUFFIXES ${libname}) |
+ RAPTOR_INCLUDE_DIR raptor.h |
62 |
-ENDMACRO () |
+ HINTS ${includehints} |
63 |
- |
+ PATH_SUFFIXES ${libname}) |
64 |
- |
+ENDMACRO () |
65 |
- |
+ |
66 |
-# Check if we have cached results in case the last round was successful. |
+ |
67 |
-if ( NOT( RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES ) OR NOT RAPTOR_FOUND ) |
+ |
68 |
- |
+# Check if we have cached results in case the last round was successful. |
69 |
- include(FindLibraryWithDebug) |
+if ( NOT( RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES ) OR NOT RAPTOR_FOUND ) |
70 |
- include(MacroEnsureVersion) |
+ |
71 |
- find_package(PkgConfig) |
+ include(FindLibraryWithDebug) |
72 |
- |
+ include(MacroEnsureVersion) |
73 |
- # Vy default look for version 2.0 |
+ find_package(PkgConfig) |
74 |
- if (NOT Raptor_FIND_VERSION ) |
+ |
75 |
- set( Raptor_FIND_VERSION "2.0") |
+ # Vy default look for version 2.0 |
76 |
- set( Raptor_FIND_VERSION_MAJOR "2" ) |
+ if (NOT Raptor_FIND_VERSION ) |
77 |
- set( Raptor_FIND_VERSION_MINOR "0" ) |
+ set( Raptor_FIND_VERSION "2.0") |
78 |
- endif () |
+ set( Raptor_FIND_VERSION_MAJOR "2" ) |
79 |
- |
+ set( Raptor_FIND_VERSION_MINOR "0" ) |
80 |
- if ( Raptor_FIND_VERSION_MAJOR EQUAL "2" ) |
+ endif () |
81 |
- |
+ |
82 |
- if ( NOT WIN32 ) |
+ if ( Raptor_FIND_VERSION_MAJOR EQUAL "2" ) |
83 |
- pkg_check_modules(PC_RAPTOR2 QUIET raptor2) |
+ |
84 |
- if ( PC_RAPTOR2_FOUND ) |
+ if ( NOT WIN32 ) |
85 |
- set(RAPTOR_DEFINITIONS ${PC_RAPTOR2_CFLAGS_OTHER}) |
+ pkg_check_modules(PC_RAPTOR2 QUIET raptor2) |
86 |
- set(RAPTOR_VERSION ${PC_RAPTOR2_VERSION} CACHE STRING "Raptor Version found" ) |
+ if ( PC_RAPTOR2_FOUND ) |
87 |
- endif () |
+ set(RAPTOR_DEFINITIONS ${PC_RAPTOR2_CFLAGS_OTHER}) |
88 |
- endif () |
+ set(RAPTOR_VERSION ${PC_RAPTOR2_VERSION} CACHE STRING "Raptor Version found" ) |
89 |
- find_raptor( raptor2 "${PC_RAPTOR2_LIBDIR};${PC_RAPTOR2_LIBRARY_DIRS}" "${PC_RAPTOR2_INCLUDEDIR};${PC_RAPTOR2_INCLUDE_DIRS}") |
+ endif () |
90 |
- |
+ endif () |
91 |
- elseif ( Raptor_FIND_VERSION_MAJOR EQUAL "1" ) |
+ find_raptor( raptor2 "${PC_RAPTOR2_LIBDIR};${PC_RAPTOR2_LIBRARY_DIRS}" "${PC_RAPTOR2_INCLUDEDIR};${PC_RAPTOR2_INCLUDE_DIRS}") |
92 |
- |
+ |
93 |
- if ( NOT WIN32 ) |
+ elseif ( Raptor_FIND_VERSION_MAJOR EQUAL "1" ) |
94 |
- pkg_check_modules(PC_RAPTOR QUIET raptor) |
+ |
95 |
- if ( PC_RAPTOR_FOUND ) |
+ if ( NOT WIN32 ) |
96 |
- set(RAPTOR_DEFINITIONS ${PC_RAPTOR_CFLAGS_OTHER}) |
+ pkg_check_modules(PC_RAPTOR QUIET raptor) |
97 |
- set(RAPTOR_VERSION ${PC_RAPTOR_VERSION} CACHE STRING "Raptor Version found" ) |
+ if ( PC_RAPTOR_FOUND ) |
98 |
- endif () |
+ set(RAPTOR_DEFINITIONS ${PC_RAPTOR_CFLAGS_OTHER}) |
99 |
- endif () |
+ set(RAPTOR_VERSION ${PC_RAPTOR_VERSION} CACHE STRING "Raptor Version found" ) |
100 |
- find_raptor( raptor "${PC_RAPTOR_LIBDIR};${PC_RAPTOR_LIBRARY_DIRS}" "${PC_RAPTOR_INCLUDEDIR};${PC_RAPTOR_INCLUDE_DIRS}") |
+ endif () |
101 |
- |
+ endif () |
102 |
- else () |
+ find_raptor( raptor "${PC_RAPTOR_LIBDIR};${PC_RAPTOR_LIBRARY_DIRS}" "${PC_RAPTOR_INCLUDEDIR};${PC_RAPTOR_INCLUDE_DIRS}") |
103 |
- |
+ |
104 |
- message( FATAL_ERROR "No idea how to check for version : ${Raptor_FIND_VERSION}") |
+ else () |
105 |
- |
+ |
106 |
- endif() |
+ message( FATAL_ERROR "No idea how to check for version : ${Raptor_FIND_VERSION}") |
107 |
- |
+ |
108 |
- if (RAPTOR_VERSION) |
+ endif() |
109 |
- MACRO_ENSURE_VERSION("1.4.16" ${RAPTOR_VERSION} RAPTOR_HAVE_TRIG) |
+ |
110 |
- endif (RAPTOR_VERSION) |
+ if (RAPTOR_VERSION) |
111 |
- |
+ MACRO_ENSURE_VERSION("1.4.16" ${RAPTOR_VERSION} RAPTOR_HAVE_TRIG) |
112 |
- mark_as_advanced(RAPTOR_INCLUDE_DIR RAPTOR_LIBRARIES) |
+ endif (RAPTOR_VERSION) |
113 |
- |
+ |
114 |
-endif () # Check for cached values |
+ mark_as_advanced(RAPTOR_INCLUDE_DIR RAPTOR_LIBRARIES) |
115 |
- |
+ |
116 |
-include(FindPackageHandleStandardArgs) |
+endif () # Check for cached values |
117 |
- |
+ |
118 |
-find_package_handle_standard_args( |
+include(FindPackageHandleStandardArgs) |
119 |
- Raptor |
+ |
120 |
- VERSION_VAR RAPTOR_VERSION |
+find_package_handle_standard_args( |
121 |
- REQUIRED_VARS RAPTOR_LIBRARIES RAPTOR_INCLUDE_DIR) |
+ Raptor |
122 |
- |
+ VERSION_VAR RAPTOR_VERSION |
123 |
-mark_as_advanced(RAPTOR_VERSION) |
+ REQUIRED_VARS RAPTOR_LIBRARIES RAPTOR_INCLUDE_DIR) |
124 |
- |
+ |
125 |
-if (NOT RAPTOR_FOUND AND Raptor_FIND_VERSION_MAJOR EQUAL "2" AND NOT Raptor_FIND_QUIET ) |
+mark_as_advanced(RAPTOR_VERSION) |
126 |
- pkg_check_modules(PC_RAPTOR QUIET raptor) |
+ |
127 |
- if (PC_RAPTOR_FOUND) |
+if (NOT RAPTOR_FOUND AND Raptor_FIND_VERSION_MAJOR EQUAL "2" AND NOT Raptor_FIND_QUIET ) |
128 |
- message( STATUS "You have raptor1 version ${PC_RAPTOR_VERSION} installed. Please update." ) |
+ pkg_check_modules(PC_RAPTOR QUIET raptor) |
129 |
- endif () |
+ if (PC_RAPTOR_FOUND) |
130 |
-endif () |
+ message( STATUS "You have raptor1 version ${PC_RAPTOR_VERSION} installed. Please update." ) |
131 |
+INCLUDE(MacroEnsureVersion) |
+ endif () |
132 |
+ |
+endif () |
133 |
|
|
134 |
+if(WINCE) |
-if(WINCE) |
135 |
+FIND_PROGRAM( |
-FIND_PROGRAM( |
136 |
+ RAPTOR_CONFIG |
- RAPTOR_CONFIG |
137 |
+ NAMES raptor-config |
- NAMES raptor-config |
138 |
+ PATHS ${HOST_BINDIR} NO_DEFAULT_PATH |
- PATHS ${HOST_BINDIR} NO_DEFAULT_PATH |
139 |
+ ) |
- ) |
140 |
+else(WINCE) |
-else(WINCE) |
141 |
+FIND_PROGRAM( |
-FIND_PROGRAM( |
142 |
+ RAPTOR_CONFIG |
- RAPTOR_CONFIG |
143 |
+ NAMES raptor-config |
- NAMES raptor-config |
144 |
+ ) |
- ) |
145 |
+endif(WINCE) |
-endif(WINCE) |
146 |
+ |
- |
147 |
+if(RAPTOR_CONFIG) |
-if(RAPTOR_CONFIG) |
148 |
+ EXECUTE_PROCESS( |
- EXECUTE_PROCESS( |
149 |
+ COMMAND ${RAPTOR_CONFIG} --version |
- COMMAND ${RAPTOR_CONFIG} --version |
150 |
+ OUTPUT_VARIABLE RAPTOR_VERSION |
- OUTPUT_VARIABLE RAPTOR_VERSION |
151 |
+ ) |
- ) |
152 |
+ if(RAPTOR_VERSION) |
- if(RAPTOR_VERSION) |
153 |
+ STRING(REPLACE "\n" "" RAPTOR_VERSION ${RAPTOR_VERSION}) |
- STRING(REPLACE "\n" "" RAPTOR_VERSION ${RAPTOR_VERSION}) |
154 |
+ |
- |
155 |
+ MACRO_ENSURE_VERSION("1.4.16" ${RAPTOR_VERSION} RAPTOR_HAVE_TRIG) |
- MACRO_ENSURE_VERSION("1.4.16" ${RAPTOR_VERSION} RAPTOR_HAVE_TRIG) |
156 |
+ |
- |
157 |
+ # extract include paths from raptor-config |
- # extract include paths from raptor-config |
158 |
+ EXECUTE_PROCESS( |
- EXECUTE_PROCESS( |
159 |
+ COMMAND ${RAPTOR_CONFIG} --cflags |
- COMMAND ${RAPTOR_CONFIG} --cflags |
160 |
+ OUTPUT_VARIABLE raptor_CFLAGS_ARGS) |
- OUTPUT_VARIABLE raptor_CFLAGS_ARGS) |
161 |
+ STRING( REPLACE " " ";" raptor_CFLAGS_ARGS ${raptor_CFLAGS_ARGS} ) |
- STRING( REPLACE " " ";" raptor_CFLAGS_ARGS ${raptor_CFLAGS_ARGS} ) |
162 |
+ FOREACH( _ARG ${raptor_CFLAGS_ARGS} ) |
- FOREACH( _ARG ${raptor_CFLAGS_ARGS} ) |
163 |
+ IF(${_ARG} MATCHES "^-I") |
- IF(${_ARG} MATCHES "^-I") |
164 |
+ STRING(REGEX REPLACE "^-I" "" _ARG ${_ARG}) |
- STRING(REGEX REPLACE "^-I" "" _ARG ${_ARG}) |
165 |
+ STRING( REPLACE "\n" "" _ARG ${_ARG} ) |
- STRING( REPLACE "\n" "" _ARG ${_ARG} ) |
166 |
+ LIST(APPEND raptor_INCLUDE_DIRS ${_ARG}) |
- LIST(APPEND raptor_INCLUDE_DIRS ${_ARG}) |
167 |
+ ENDIF(${_ARG} MATCHES "^-I") |
- ENDIF(${_ARG} MATCHES "^-I") |
168 |
+ ENDFOREACH(_ARG) |
- ENDFOREACH(_ARG) |
169 |
+ |
- |
170 |
+ # extract lib paths from raptor-config |
- # extract lib paths from raptor-config |
171 |
+ EXECUTE_PROCESS( |
- EXECUTE_PROCESS( |
172 |
+ COMMAND ${RAPTOR_CONFIG} --libs |
- COMMAND ${RAPTOR_CONFIG} --libs |
173 |
+ OUTPUT_VARIABLE raptor_CFLAGS_ARGS) |
- OUTPUT_VARIABLE raptor_CFLAGS_ARGS) |
174 |
+ STRING( REPLACE " " ";" raptor_CFLAGS_ARGS ${raptor_CFLAGS_ARGS} ) |
- STRING( REPLACE " " ";" raptor_CFLAGS_ARGS ${raptor_CFLAGS_ARGS} ) |
175 |
+ FOREACH( _ARG ${raptor_CFLAGS_ARGS} ) |
- FOREACH( _ARG ${raptor_CFLAGS_ARGS} ) |
176 |
+ IF(${_ARG} MATCHES "^-L") |
- IF(${_ARG} MATCHES "^-L") |
177 |
+ STRING(REGEX REPLACE "^-L" "" _ARG ${_ARG}) |
- STRING(REGEX REPLACE "^-L" "" _ARG ${_ARG}) |
178 |
+ LIST(APPEND raptor_LIBRARY_DIRS ${_ARG}) |
- LIST(APPEND raptor_LIBRARY_DIRS ${_ARG}) |
179 |
+ ENDIF(${_ARG} MATCHES "^-L") |
- ENDIF(${_ARG} MATCHES "^-L") |
180 |
+ ENDFOREACH(_ARG) |
- ENDFOREACH(_ARG) |
181 |
+ endif(RAPTOR_VERSION) |
- endif(RAPTOR_VERSION) |
182 |
+else(RAPTOR_CONFIG) |
-else(RAPTOR_CONFIG) |
183 |
+ SET(RAPTOR_VERSION "1.0.0") |
- SET(RAPTOR_VERSION "1.0.0") |
184 |
+endif(RAPTOR_CONFIG) |
-endif(RAPTOR_CONFIG) |
185 |
+ |
- |
186 |
+find_path(RAPTOR_INCLUDE_DIR raptor.h |
-find_path(RAPTOR_INCLUDE_DIR raptor.h |
187 |
+ PATHS |
- PATHS |
188 |
+ ${redland_INCLUDE_DIRS} |
- ${redland_INCLUDE_DIRS} |
189 |
+ ${raptor_INCLUDE_DIRS} |
- ${raptor_INCLUDE_DIRS} |
190 |
+ /usr/X11/include |
- /usr/X11/include |
191 |
+ PATH_SUFFIXES redland |
- PATH_SUFFIXES redland |
192 |
+ ) |
- ) |
193 |
+ |
- |
194 |
+find_library(RAPTOR_LIBRARIES NAMES raptor libraptor |
-find_library(RAPTOR_LIBRARIES NAMES raptor libraptor |
195 |
+ PATHS |
- PATHS |
196 |
+ ${raptor_LIBRARY_DIRS} |
- ${raptor_LIBRARY_DIRS} |
197 |
+ ) |
- ) |
198 |
+ |
- |
199 |
+if (RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES) |
-if (RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES) |
200 |
+ set(RAPTOR_FOUND TRUE) |
- set(RAPTOR_FOUND TRUE) |
201 |
+endif (RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES) |
-endif (RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES) |
202 |
+ |
- |
203 |
+if (RAPTOR_FOUND) |
-if (RAPTOR_FOUND) |
204 |
+ set(RAPTOR_DEFINITIONS ${raptor_CFLAGS}) |
- set(RAPTOR_DEFINITIONS ${raptor_CFLAGS}) |
205 |
+ if (NOT Raptor_FIND_QUIETLY) |
- if (NOT Raptor_FIND_QUIETLY) |
206 |
+ message(STATUS "Found Raptor ${RAPTOR_VERSION}: libs - ${RAPTOR_LIBRARIES}; includes - ${RAPTOR_INCLUDE_DIR}") |
- message(STATUS "Found Raptor ${RAPTOR_VERSION}: libs - ${RAPTOR_LIBRARIES}; includes - ${RAPTOR_INCLUDE_DIR}") |
207 |
+ endif (NOT Raptor_FIND_QUIETLY) |
- endif (NOT Raptor_FIND_QUIETLY) |
208 |
+else (RAPTOR_FOUND) |
-else (RAPTOR_FOUND) |
209 |
+ if (Raptor_FIND_REQUIRED) |
- if (Raptor_FIND_REQUIRED) |
210 |
+ message(FATAL_ERROR "Could NOT find Raptor") |
- message(FATAL_ERROR "Could NOT find Raptor") |
211 |
+ endif (Raptor_FIND_REQUIRED) |
- endif (Raptor_FIND_REQUIRED) |
212 |
+endif (RAPTOR_FOUND) |
-endif (RAPTOR_FOUND) |
213 |
+ |
- |
214 |
+mark_as_advanced(RAPTOR_INCLUDE_DIR_TMP |
-mark_as_advanced(RAPTOR_INCLUDE_DIR_TMP |
215 |
+ RAPTOR_INCLUDE_DIR |
- RAPTOR_INCLUDE_DIR |
216 |
+ RAPTOR_LIBRARIES) |
- RAPTOR_LIBRARIES) |
217 |
diff -Naur soprano/CMakeLists.txt soprano-2.6.51/CMakeLists.txt |
diff -Naur soprano-2.6.51/CMakeLists.txt soprano/CMakeLists.txt |
218 |
--- soprano/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
219 |
+++ soprano-2.6.51/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
220 |
@@ -7,7 +7,7 @@ |
@@ -7,7 +7,7 @@ |
221 |
################## Soprano version ################################ |
################## Soprano version ################################ |
222 |
set(CMAKE_SOPRANO_VERSION_MAJOR 2) |
set(CMAKE_SOPRANO_VERSION_MAJOR 2) |
223 |
set(CMAKE_SOPRANO_VERSION_MINOR 6) |
set(CMAKE_SOPRANO_VERSION_MINOR 6) |
224 |
-set(CMAKE_SOPRANO_VERSION_RELEASE 52) |
-set(CMAKE_SOPRANO_VERSION_RELEASE 51) |
225 |
+set(CMAKE_SOPRANO_VERSION_RELEASE 51) |
+set(CMAKE_SOPRANO_VERSION_RELEASE 52) |
226 |
set(CMAKE_SOPRANO_VERSION_STRING "${CMAKE_SOPRANO_VERSION_MAJOR}.${CMAKE_SOPRANO_VERSION_MINOR}.${CMAKE_SOPRANO_VERSION_RELEASE}") |
set(CMAKE_SOPRANO_VERSION_STRING "${CMAKE_SOPRANO_VERSION_MAJOR}.${CMAKE_SOPRANO_VERSION_MINOR}.${CMAKE_SOPRANO_VERSION_RELEASE}") |
227 |
|
|
228 |
|
|
229 |
diff -Naur soprano/parsers/raptor/CMakeLists.txt soprano-2.6.51/parsers/raptor/CMakeLists.txt |
diff -Naur soprano-2.6.51/parsers/raptor/CMakeLists.txt soprano/parsers/raptor/CMakeLists.txt |
230 |
--- soprano/parsers/raptor/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/parsers/raptor/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
231 |
+++ soprano-2.6.51/parsers/raptor/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/parsers/raptor/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
232 |
@@ -13,11 +13,13 @@ |
@@ -13,13 +13,11 @@ |
233 |
raptorparser.cpp |
raptorparser.cpp |
234 |
) |
) |
235 |
|
|
236 |
+configure_file(raptor-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/raptor-config.h) |
-configure_file(raptor-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/raptor-config.h) |
237 |
+ |
- |
238 |
qt4_automoc(${raptor_parser_SRC}) |
qt4_automoc(${raptor_parser_SRC}) |
239 |
|
|
240 |
-add_library(soprano_raptorparser MODULE ${raptor_parser_SRC}) |
-add_library(soprano_raptorparser MODULE ${raptor_parser_SRC}) |
241 |
+add_library(soprano_raptorparser MODULE ${raptor_parser_SRC}) |
+add_library(soprano_raptorparser MODULE ${raptor_parser_SRC}) |
242 |
|
|
243 |
-TARGET_LINK_LIBRARIES(soprano_raptorparser soprano raptor2 ${RAPTOR_LIBRARIES}) |
-TARGET_LINK_LIBRARIES(soprano_raptorparser soprano ${RAPTOR_LIBRARIES}) |
244 |
+TARGET_LINK_LIBRARIES(soprano_raptorparser soprano ${RAPTOR_LIBRARIES}) |
+TARGET_LINK_LIBRARIES(soprano_raptorparser soprano raptor2 ${RAPTOR_LIBRARIES}) |
245 |
|
|
246 |
set_target_properties(soprano_raptorparser PROPERTIES |
set_target_properties(soprano_raptorparser PROPERTIES |
247 |
DEFINE_SYMBOL MAKE_RAPTORPARSER_LIB |
DEFINE_SYMBOL MAKE_RAPTORPARSER_LIB |
248 |
diff -Naur soprano/parsers/raptor/raptor-config.h.cmake soprano-2.6.51/parsers/raptor/raptor-config.h.cmake |
diff -Naur soprano-2.6.51/parsers/raptor/raptor-config.h.cmake soprano/parsers/raptor/raptor-config.h.cmake |
249 |
--- soprano/parsers/raptor/raptor-config.h.cmake 1970-01-01 01:00:00.000000000 +0100 |
--- soprano-2.6.51/parsers/raptor/raptor-config.h.cmake 2011-06-05 10:38:25.000000000 +0200 |
250 |
+++ soprano-2.6.51/parsers/raptor/raptor-config.h.cmake 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/parsers/raptor/raptor-config.h.cmake 1970-01-01 01:00:00.000000000 +0100 |
251 |
@@ -0,0 +1 @@ |
@@ -1 +0,0 @@ |
252 |
+#cmakedefine RAPTOR_HAVE_TRIG |
-#cmakedefine RAPTOR_HAVE_TRIG |
253 |
diff -Naur soprano/parsers/raptor/raptorparser.cpp soprano-2.6.51/parsers/raptor/raptorparser.cpp |
diff -Naur soprano-2.6.51/parsers/raptor/raptorparser.cpp soprano/parsers/raptor/raptorparser.cpp |
254 |
--- soprano/parsers/raptor/raptorparser.cpp 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/parsers/raptor/raptorparser.cpp 2011-06-05 10:38:25.000000000 +0200 |
255 |
+++ soprano-2.6.51/parsers/raptor/raptorparser.cpp 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/parsers/raptor/raptorparser.cpp 2011-07-19 18:49:58.000000000 +0200 |
256 |
@@ -3,7 +3,7 @@ |
@@ -3,7 +3,7 @@ |
257 |
* This file is part of Soprano Project |
* This file is part of Soprano Project |
258 |
* |
* |
259 |
* Copyright (C) 2006 Duncan Mac-Vicar <duncan@kde.org> |
* Copyright (C) 2006 Duncan Mac-Vicar <duncan@kde.org> |
260 |
- * Copyright (C) 2007,2011 Sebastian Trueg <trueg@kde.org> |
- * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org> |
261 |
+ * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org> |
+ * Copyright (C) 2007,2011 Sebastian Trueg <trueg@kde.org> |
262 |
* |
* |
263 |
* This library is free software; you can redistribute it and/or |
* This library is free software; you can redistribute it and/or |
264 |
* modify it under the terms of the GNU Library General Public |
* modify it under the terms of the GNU Library General Public |
265 |
@@ -22,13 +22,14 @@ |
@@ -22,14 +22,13 @@ |
266 |
*/ |
*/ |
267 |
|
|
268 |
#include "raptorparser.h" |
#include "raptorparser.h" |
269 |
+#include "raptor-config.h" |
-#include "raptor-config.h" |
270 |
|
|
271 |
#include "util/simplestatementiterator.h" |
#include "util/simplestatementiterator.h" |
272 |
#include "statement.h" |
#include "statement.h" |
273 |
#include "locator.h" |
#include "locator.h" |
274 |
#include "error.h" |
#include "error.h" |
275 |
|
|
276 |
-#include <raptor2/raptor.h> |
-#include <raptor.h> |
277 |
+#include <raptor.h> |
+#include <raptor2/raptor.h> |
278 |
|
|
279 |
#include <QtCore/QUrl> |
#include <QtCore/QUrl> |
280 |
#include <QtCore/QFile> |
#include <QtCore/QFile> |
281 |
@@ -39,71 +40,88 @@ |
@@ -40,88 +39,71 @@ |
282 |
#include <QtCore/QMutexLocker> |
#include <QtCore/QMutexLocker> |
283 |
|
|
284 |
|
|
285 |
+namespace { |
-namespace { |
286 |
+ class RaptorInitHelper |
- class RaptorInitHelper |
287 |
+ { |
- { |
288 |
+ public: |
- public: |
289 |
+ RaptorInitHelper() { |
- RaptorInitHelper() { |
290 |
+ raptor_init(); |
- raptor_init(); |
291 |
+ } |
- } |
292 |
+ ~RaptorInitHelper() { |
- ~RaptorInitHelper() { |
293 |
+ raptor_finish(); |
- raptor_finish(); |
294 |
+ } |
- } |
295 |
+ }; |
- }; |
296 |
+} |
-} |
297 |
+ |
- |
298 |
Q_EXPORT_PLUGIN2(soprano_raptorparser, Soprano::Raptor::Parser) |
Q_EXPORT_PLUGIN2(soprano_raptorparser, Soprano::Raptor::Parser) |
299 |
|
|
300 |
namespace { |
namespace { |
301 |
- void raptorLogHandler(void *userData,raptor_log_message *message) |
- // for some strange reason raptor <= 1.4.15 can only handle application/turtle when parsing |
302 |
+ // for some strange reason raptor <= 1.4.15 can only handle application/turtle when parsing |
- // and application/x-turtle when serializing, but not the other way around |
303 |
+ // and application/x-turtle when serializing, but not the other way around |
- QString mimeTypeString( Soprano::RdfSerialization s, const QString& userSerialization ) |
304 |
+ QString mimeTypeString( Soprano::RdfSerialization s, const QString& userSerialization ) |
- { |
305 |
+ { |
-#ifndef RAPTOR_HAVE_TRIG |
306 |
+#ifndef RAPTOR_HAVE_TRIG |
- if ( s == Soprano::SerializationTurtle ) { |
307 |
+ if ( s == Soprano::SerializationTurtle ) { |
- return "application/turtle"; // x-turtle does not work.... |
308 |
+ return "application/turtle"; // x-turtle does not work.... |
- } |
309 |
+ } |
- else |
310 |
+ else |
-#endif |
311 |
+#endif |
- { |
312 |
+ { |
- return serializationMimeType( s, userSerialization ); |
313 |
+ return serializationMimeType( s, userSerialization ); |
- } |
314 |
+ } |
- } |
315 |
+ } |
- |
316 |
+ |
- |
317 |
+ |
- void raptorMessageHandler( void* userData, raptor_locator* locator, const char* message ) |
318 |
+ void raptorMessageHandler( void* userData, raptor_locator* locator, const char* message ) |
+ void raptorLogHandler(void *userData,raptor_log_message *message) |
319 |
{ |
{ |
320 |
Soprano::Raptor::Parser* p = static_cast<Soprano::Raptor::Parser*>( userData ); |
Soprano::Raptor::Parser* p = static_cast<Soprano::Raptor::Parser*>( userData ); |
321 |
- if ( message->locator ) { |
- if ( locator ) { |
322 |
- p->setError( Soprano::Error::ParserError( Soprano::Error::Locator( message->locator->line, message->locator->column, message->locator->byte ), |
- p->setError( Soprano::Error::ParserError( Soprano::Error::Locator( locator->line, locator->column, locator->byte ), |
323 |
- QString::fromUtf8( message->text ), |
- QString::fromUtf8( message ), |
324 |
+ if ( locator ) { |
+ if ( message->locator ) { |
325 |
+ p->setError( Soprano::Error::ParserError( Soprano::Error::Locator( locator->line, locator->column, locator->byte ), |
+ p->setError( Soprano::Error::ParserError( Soprano::Error::Locator( message->locator->line, message->locator->column, message->locator->byte ), |
326 |
+ QString::fromUtf8( message ), |
+ QString::fromUtf8( message->text ), |
327 |
Soprano::Error::ErrorParsingFailed ) ); |
Soprano::Error::ErrorParsingFailed ) ); |
328 |
} |
} |
329 |
else { |
else { |
330 |
- p->setError( Soprano::Error::Error( QString::fromUtf8( message->text ), Soprano::Error::ErrorUnknown ) ); |
- p->setError( Soprano::Error::Error( QString::fromUtf8( message ), Soprano::Error::ErrorUnknown ) ); |
331 |
+ p->setError( Soprano::Error::Error( QString::fromUtf8( message ), Soprano::Error::ErrorUnknown ) ); |
+ p->setError( Soprano::Error::Error( QString::fromUtf8( message->text ), Soprano::Error::ErrorUnknown ) ); |
332 |
} |
} |
333 |
} |
} |
334 |
|
|
|
- Soprano::Node convertNode( raptor_term * term ) |
|
|
- { |
|
|
- if(!term) { |
|
|
- return Soprano::Node(); |
|
|
- } |
|
|
|
|
|
- switch( term->type ) { |
|
|
- case RAPTOR_TERM_TYPE_URI: { |
|
|
- return Soprano::Node::createResourceNode( |
|
|
- QString::fromUtf8( ( char* )raptor_uri_as_string( term->value.uri ) ) ); |
|
|
- } |
|
335 |
- |
- |
336 |
- case RAPTOR_TERM_TYPE_BLANK: { |
- Soprano::Node convertNode( const void* data, raptor_identifier_type type, |
337 |
- return Soprano::Node::createBlankNode( |
- raptor_uri* objectLiteralDatatype = 0, const unsigned char* objectLiteralLanguage = 0 ) |
338 |
- QString::fromUtf8( ( const char* )(term->value.blank.string) ) ); |
+ Soprano::Node convertNode( raptor_term * term ) |
339 |
- } |
{ |
340 |
- |
- switch( type ) { |
341 |
- case RAPTOR_TERM_TYPE_LITERAL: { |
- case RAPTOR_IDENTIFIER_TYPE_RESOURCE: |
342 |
- if ( term->value.literal.datatype ) { |
- case RAPTOR_IDENTIFIER_TYPE_PREDICATE: |
343 |
- return Soprano::Node::createLiteralNode( |
- case RAPTOR_IDENTIFIER_TYPE_ORDINAL: |
344 |
- Soprano::LiteralValue::fromString( |
- return Soprano::Node::createResourceNode( QString::fromUtf8( ( char* )raptor_uri_as_string( ( raptor_uri* )data ) ) ); |
345 |
- QString::fromUtf8( ( const char* )term->value.literal.string ), |
- |
346 |
- QString::fromUtf8( |
- case RAPTOR_IDENTIFIER_TYPE_ANONYMOUS: |
347 |
- ( char* )raptor_uri_as_string(term->value.literal.datatype ) ) |
- return Soprano::Node::createBlankNode( QString::fromUtf8( ( const char* )data ) ); |
348 |
- ) |
- |
349 |
- ); |
- case RAPTOR_IDENTIFIER_TYPE_LITERAL: |
350 |
+ Soprano::Node convertNode( const void* data, raptor_identifier_type type, |
- case RAPTOR_IDENTIFIER_TYPE_XML_LITERAL: |
351 |
+ raptor_uri* objectLiteralDatatype = 0, const unsigned char* objectLiteralLanguage = 0 ) |
- if ( objectLiteralDatatype ) { |
352 |
+ { |
- return Soprano::Node::createLiteralNode( Soprano::LiteralValue::fromString( QString::fromUtf8( ( const char* )data ), |
353 |
+ switch( type ) { |
- QString::fromUtf8( ( char* )raptor_uri_as_string( objectLiteralDatatype ) ) ) ); |
354 |
+ case RAPTOR_IDENTIFIER_TYPE_RESOURCE: |
+ if(!term) { |
355 |
+ case RAPTOR_IDENTIFIER_TYPE_PREDICATE: |
+ return Soprano::Node(); |
356 |
+ case RAPTOR_IDENTIFIER_TYPE_ORDINAL: |
+ } |
357 |
+ return Soprano::Node::createResourceNode( QString::fromUtf8( ( char* )raptor_uri_as_string( ( raptor_uri* )data ) ) ); |
+ |
358 |
+ |
+ switch( term->type ) { |
359 |
+ case RAPTOR_IDENTIFIER_TYPE_ANONYMOUS: |
+ case RAPTOR_TERM_TYPE_URI: { |
360 |
+ return Soprano::Node::createBlankNode( QString::fromUtf8( ( const char* )data ) ); |
+ return Soprano::Node::createResourceNode( |
361 |
+ |
+ QString::fromUtf8( ( char* )raptor_uri_as_string( term->value.uri ) ) ); |
362 |
+ case RAPTOR_IDENTIFIER_TYPE_LITERAL: |
+ } |
363 |
+ case RAPTOR_IDENTIFIER_TYPE_XML_LITERAL: |
+ |
364 |
+ if ( objectLiteralDatatype ) { |
+ case RAPTOR_TERM_TYPE_BLANK: { |
365 |
+ return Soprano::Node::createLiteralNode( Soprano::LiteralValue::fromString( QString::fromUtf8( ( const char* )data ), |
+ return Soprano::Node::createBlankNode( |
366 |
+ QString::fromUtf8( ( char* )raptor_uri_as_string( objectLiteralDatatype ) ) ) ); |
+ QString::fromUtf8( ( const char* )(term->value.blank.string) ) ); |
367 |
|
+ } |
368 |
|
+ |
369 |
|
+ case RAPTOR_TERM_TYPE_LITERAL: { |
370 |
|
+ if ( term->value.literal.datatype ) { |
371 |
|
+ return Soprano::Node::createLiteralNode( |
372 |
|
+ Soprano::LiteralValue::fromString( |
373 |
|
+ QString::fromUtf8( ( const char* )term->value.literal.string ), |
374 |
|
+ QString::fromUtf8( |
375 |
|
+ ( char* )raptor_uri_as_string(term->value.literal.datatype ) ) |
376 |
|
+ ) |
377 |
|
+ ); |
378 |
} |
} |
379 |
else { |
else { |
380 |
- return Soprano::Node::createLiteralNode( |
- return Soprano::Node::createLiteralNode( Soprano::LiteralValue::createPlainLiteral( QString::fromUtf8( ( const char* )data ), |
381 |
- Soprano::LiteralValue::createPlainLiteral( |
- QString::fromUtf8( ( const char* )objectLiteralLanguage ) ) ); |
382 |
- QString::fromUtf8( ( const char* )term->value.literal.string ), |
+ return Soprano::Node::createLiteralNode( |
383 |
- QString::fromUtf8( ( const char* )term->value.literal.language ) ) ); |
+ Soprano::LiteralValue::createPlainLiteral( |
384 |
+ return Soprano::Node::createLiteralNode( Soprano::LiteralValue::createPlainLiteral( QString::fromUtf8( ( const char* )data ), |
+ QString::fromUtf8( ( const char* )term->value.literal.string ), |
385 |
+ QString::fromUtf8( ( const char* )objectLiteralLanguage ) ) ); |
+ QString::fromUtf8( ( const char* )term->value.literal.language ) ) ); |
386 |
} |
} |
387 |
- } |
+ } |
388 |
|
|
389 |
default: |
default: |
390 |
return Soprano::Node(); |
return Soprano::Node(); |
391 |
} |
} |
392 |
- |
- } |
393 |
- // make gcc shut up |
|
394 |
- return Soprano::Node(); |
+ // make gcc shut up |
395 |
} |
+ return Soprano::Node(); |
396 |
|
+ } |
397 |
|
|
|
+ |
|
398 |
Soprano::Statement convertTriple( const raptor_statement* triple ) |
Soprano::Statement convertTriple( const raptor_statement* triple ) |
399 |
{ |
{ |
400 |
- return Soprano::Statement( convertNode( triple->subject ), |
- return Soprano::Statement( convertNode( triple->subject, triple->subject_type ), |
401 |
- convertNode( triple->predicate ), |
- convertNode( triple->predicate, triple->predicate_type ), |
402 |
- convertNode( triple->object ), |
- convertNode( triple->object, triple->object_type, |
403 |
- convertNode( triple->graph ) ); |
- triple->object_literal_datatype, |
404 |
+ return Soprano::Statement( convertNode( triple->subject, triple->subject_type ), |
- triple->object_literal_language ) ); |
405 |
+ convertNode( triple->predicate, triple->predicate_type ), |
+ return Soprano::Statement( convertNode( triple->subject ), |
406 |
+ convertNode( triple->object, triple->object_type, |
+ convertNode( triple->predicate ), |
407 |
+ triple->object_literal_datatype, |
+ convertNode( triple->object ), |
408 |
+ triple->object_literal_language ) ); |
+ convertNode( triple->graph ) ); |
409 |
} |
} |
410 |
|
|
411 |
|
|
412 |
@@ -114,48 +132,47 @@ |
@@ -132,47 +114,48 @@ |
413 |
}; |
}; |
414 |
|
|
415 |
|
|
416 |
- void raptorTriplesHandler( void* userData, raptor_statement* triple ) |
- void raptorTriplesHandler( void* userData, const raptor_statement* triple ) |
417 |
+ void raptorTriplesHandler( void* userData, const raptor_statement* triple ) |
+ void raptorTriplesHandler( void* userData, raptor_statement* triple ) |
418 |
{ |
{ |
419 |
- Q_ASSERT(userData); |
+ Q_ASSERT(userData); |
420 |
ParserData* pd = static_cast<ParserData*>( userData ); |
ParserData* pd = static_cast<ParserData*>( userData ); |
421 |
- pd->statements.append( convertTriple( triple ) ); |
- Soprano::Statement s = convertTriple( triple ); |
422 |
+ Soprano::Statement s = convertTriple( triple ); |
-// qDebug() << "got triple: " << s; |
423 |
+// qDebug() << "got triple: " << s; |
- s.setContext( pd->currentContext ); |
424 |
+ s.setContext( pd->currentContext ); |
- pd->statements.append( s ); |
425 |
+ pd->statements.append( s ); |
+ pd->statements.append( convertTriple( triple ) ); |
426 |
} |
} |
427 |
-} |
+} |
428 |
|
|
429 |
|
|
430 |
-class Soprano::Raptor::Parser::Private |
- void raptorGraphHandler( void* userData, raptor_uri* graph ) |
431 |
-{ |
- { |
432 |
-public: |
- Soprano::Node context = Soprano::Node::createResourceNode( QString::fromUtf8( ( char* )raptor_uri_as_string( graph ) ) ); |
433 |
- raptor_world * world; |
- ParserData* pd = static_cast<ParserData*>( userData ); |
434 |
- mutable QMutex mutex; |
- pd->currentContext = context; |
435 |
-}; |
-// qDebug() << "got graph: " << context; |
436 |
+ void raptorGraphHandler( void* userData, raptor_uri* graph ) |
- } |
437 |
+ { |
-} |
438 |
+ Soprano::Node context = Soprano::Node::createResourceNode( QString::fromUtf8( ( char* )raptor_uri_as_string( graph ) ) ); |
+class Soprano::Raptor::Parser::Private |
439 |
+ ParserData* pd = static_cast<ParserData*>( userData ); |
+{ |
440 |
+ pd->currentContext = context; |
+public: |
441 |
+// qDebug() << "got graph: " << context; |
+ raptor_world * world; |
442 |
+ } |
+ mutable QMutex mutex; |
443 |
+} |
+}; |
444 |
|
|
445 |
|
|
446 |
Soprano::Raptor::Parser::Parser() |
Soprano::Raptor::Parser::Parser() |
447 |
: QObject(), |
: QObject(), |
448 |
- Soprano::Parser( "raptor" ), |
- Soprano::Parser( "raptor" ) |
449 |
- d(new Private()) |
+ Soprano::Parser( "raptor" ), |
450 |
+ Soprano::Parser( "raptor" ) |
+ d(new Private()) |
451 |
{ |
{ |
452 |
- d->world = raptor_new_world(); |
+ d->world = raptor_new_world(); |
453 |
- raptor_world_open(d->world); |
+ raptor_world_open(d->world); |
454 |
- Q_ASSERT(d->world); |
+ Q_ASSERT(d->world); |
455 |
} |
} |
456 |
|
|
457 |
|
|
458 |
Soprano::Raptor::Parser::~Parser() |
Soprano::Raptor::Parser::~Parser() |
459 |
{ |
{ |
460 |
- raptor_free_world(d->world); |
+ raptor_free_world(d->world); |
461 |
- delete d; |
+ delete d; |
462 |
} |
} |
463 |
|
|
464 |
|
|
465 |
Soprano::RdfSerializations Soprano::Raptor::Parser::supportedSerializations() const |
Soprano::RdfSerializations Soprano::Raptor::Parser::supportedSerializations() const |
466 |
{ |
{ |
467 |
- return( SerializationRdfXml |
- return( SerializationRdfXml |
468 |
- |SerializationNTriples |
- |SerializationNTriples |
469 |
- |SerializationTurtle |
- |SerializationTurtle |
470 |
- |SerializationTrig |
-#ifdef RAPTOR_HAVE_TRIG |
471 |
- ); |
- |SerializationTrig |
472 |
+ return( SerializationRdfXml |
-#endif |
473 |
+ |SerializationNTriples |
- ); |
474 |
+ |SerializationTurtle |
+ return( SerializationRdfXml |
475 |
+#ifdef RAPTOR_HAVE_TRIG |
+ |SerializationNTriples |
476 |
+ |SerializationTrig |
+ |SerializationTurtle |
477 |
+#endif |
+ |SerializationTrig |
478 |
+ ); |
+ ); |
479 |
} |
} |
480 |
|
|
481 |
|
|
482 |
@@ -163,14 +180,13 @@ |
@@ -180,13 +163,14 @@ |
483 |
const QString& userSerialization ) const |
const QString& userSerialization ) const |
484 |
{ |
{ |
485 |
// create the parser |
// create the parser |
486 |
- const QString mimeType = Soprano::serializationMimeType( serialization, userSerialization ); |
- QString mimeType = mimeTypeString( serialization, userSerialization ); |
487 |
+ QString mimeType = mimeTypeString( serialization, userSerialization ); |
+ const QString mimeType = Soprano::serializationMimeType( serialization, userSerialization ); |
488 |
raptor_parser* parser = 0; |
raptor_parser* parser = 0; |
489 |
if ( serialization == Soprano::SerializationNTriples ) { |
if ( serialization == Soprano::SerializationNTriples ) { |
490 |
- parser = raptor_new_parser(d->world,"ntriples"); // mimetype for ntriple is text/plain which is useless for the method below |
- parser = raptor_new_parser( "ntriples" ); // mimetype for ntriple is text/plain which is useless for the method below |
491 |
+ parser = raptor_new_parser( "ntriples" ); // mimetype for ntriple is text/plain which is useless for the method below |
+ parser = raptor_new_parser(d->world,"ntriples"); // mimetype for ntriple is text/plain which is useless for the method below |
492 |
} |
} |
493 |
else { |
else { |
494 |
- parser = raptor_new_parser_for_content( d->world, |
- parser = raptor_new_parser_for_content( 0, |
495 |
- 0, |
+ parser = raptor_new_parser_for_content( d->world, |
496 |
+ parser = raptor_new_parser_for_content( 0, |
+ 0, |
497 |
mimeType.toLatin1().data(), |
mimeType.toLatin1().data(), |
498 |
0, |
0, |
499 |
0, |
0, |
500 |
@@ -178,14 +194,16 @@ |
@@ -194,16 +178,14 @@ |
501 |
} |
} |
502 |
|
|
503 |
if ( !parser ) { |
if ( !parser ) { |
504 |
- qDebug() << "(Soprano::Raptor::Parser) no parser for serialization " << Soprano::serializationMimeType( serialization, userSerialization ); |
- qDebug() << "(Soprano::Raptor::Parser) no parser for serialization " << mimeTypeString( serialization, userSerialization ); |
505 |
- setError( QString( "Failed to create parser for serialization %1" ).arg( Soprano::serializationMimeType( serialization, userSerialization ) ) ); |
- setError( QString( "Failed to create parser for serialization %1" ).arg( mimeTypeString( serialization, userSerialization ) ) ); |
506 |
+ qDebug() << "(Soprano::Raptor::Parser) no parser for serialization " << mimeTypeString( serialization, userSerialization ); |
+ qDebug() << "(Soprano::Raptor::Parser) no parser for serialization " << Soprano::serializationMimeType( serialization, userSerialization ); |
507 |
+ setError( QString( "Failed to create parser for serialization %1" ).arg( mimeTypeString( serialization, userSerialization ) ) ); |
+ setError( QString( "Failed to create parser for serialization %1" ).arg( Soprano::serializationMimeType( serialization, userSerialization ) ) ); |
508 |
return 0; |
return 0; |
509 |
} |
} |
510 |
|
|
511 |
- // set the error handling method |
- // set the erro handling method |
512 |
+ // set the erro handling method |
+ // set the error handling method |
513 |
Parser* that = const_cast<Parser*>( this ); |
Parser* that = const_cast<Parser*>( this ); |
514 |
- raptor_world_set_log_handler(d->world, that, raptorLogHandler); |
- raptor_set_fatal_error_handler( parser, that, raptorMessageHandler ); |
515 |
+ raptor_set_fatal_error_handler( parser, that, raptorMessageHandler ); |
- raptor_set_error_handler( parser, that, raptorMessageHandler ); |
516 |
+ raptor_set_error_handler( parser, that, raptorMessageHandler ); |
- raptor_set_warning_handler( parser, that, raptorMessageHandler ); |
517 |
+ raptor_set_warning_handler( parser, that, raptorMessageHandler ); |
+ raptor_world_set_log_handler(d->world, that, raptorLogHandler); |
518 |
|
|
519 |
return parser; |
return parser; |
520 |
} |
} |
521 |
@@ -205,6 +223,48 @@ |
@@ -223,48 +205,6 @@ |
522 |
setError( QString( "Could not open file %1 for reading." ).arg( filename ) ); |
setError( QString( "Could not open file %1 for reading." ).arg( filename ) ); |
523 |
return StatementIterator(); |
return StatementIterator(); |
524 |
} |
} |
525 |
+ |
- |
526 |
+// clearError(); |
-// clearError(); |
527 |
+ |
- |
528 |
+// raptor_parser* parser = createParser( serialization, userSerialization ); |
-// raptor_parser* parser = createParser( serialization, userSerialization ); |
529 |
+// if ( !parser ) { |
-// if ( !parser ) { |
530 |
+// return StatementIterator(); |
-// return StatementIterator(); |
531 |
+// } |
-// } |
532 |
+ |
- |
533 |
+// // prepare the container for the parsed data |
-// // prepare the container for the parsed data |
534 |
+// QList<Statement> statements; |
-// QList<Statement> statements; |
535 |
+// raptor_set_statement_handler( parser, &statements, raptorTriplesHandler ); |
-// raptor_set_statement_handler( parser, &statements, raptorTriplesHandler ); |
536 |
+ |
- |
537 |
+// // start the atual parsing |
-// // start the atual parsing |
538 |
+// QUrl uri( QUrl::fromLocalFile( filename ) ); |
-// QUrl uri( QUrl::fromLocalFile( filename ) ); |
539 |
+// if ( uri.scheme().isEmpty() ) { |
-// if ( uri.scheme().isEmpty() ) { |
540 |
+// // we need to help the stupid librdf file url handling |
-// // we need to help the stupid librdf file url handling |
541 |
+// uri.setScheme("file"); |
-// uri.setScheme("file"); |
542 |
+// } |
-// } |
543 |
+// raptor_uri* raptorBaseUri = 0; |
-// raptor_uri* raptorBaseUri = 0; |
544 |
+// if ( !baseUri.toString().isEmpty() ) { |
-// if ( !baseUri.toString().isEmpty() ) { |
545 |
+// raptorBaseUri = raptor_new_uri( (unsigned char *) baseUri.toString().toUtf8().data() ); |
-// raptorBaseUri = raptor_new_uri( (unsigned char *) baseUri.toString().toUtf8().data() ); |
546 |
+// } |
-// } |
547 |
+// raptor_uri* raptorUri = raptor_new_uri( (unsigned char *) uri.toString().toUtf8().data() ); |
-// raptor_uri* raptorUri = raptor_new_uri( (unsigned char *) uri.toString().toUtf8().data() ); |
548 |
+// if ( !raptorUri ) { |
-// if ( !raptorUri ) { |
549 |
+// setError( QLatin1String( "Internal: Failed to create raptor_uri instance for '%1'" ).arg( uri ) ); |
-// setError( QLatin1String( "Internal: Failed to create raptor_uri instance for '%1'" ).arg( uri ) ); |
550 |
+// return StatementIterator(); |
-// return StatementIterator(); |
551 |
+// } |
-// } |
552 |
+ |
- |
553 |
+// int r = raptor_parse_uri( parser, raptorUri, raptorBaseUri ); |
-// int r = raptor_parse_uri( parser, raptorUri, raptorBaseUri ); |
554 |
+ |
- |
555 |
+// raptor_free_parser( parser ); |
-// raptor_free_parser( parser ); |
556 |
+// raptor_free_uri( raptorUri ); |
-// raptor_free_uri( raptorUri ); |
557 |
+// if ( raptorBaseUri ) { |
-// if ( raptorBaseUri ) { |
558 |
+// raptor_free_uri( raptorBaseUri ); |
-// raptor_free_uri( raptorBaseUri ); |
559 |
+// } |
-// } |
560 |
+ |
- |
561 |
+// if ( r == 0 ) { |
-// if ( r == 0 ) { |
562 |
+// return SimpleStatementIterator( statements ); |
-// return SimpleStatementIterator( statements ); |
563 |
+// } |
-// } |
564 |
+// else { |
-// else { |
565 |
+// return StatementIterator(); |
-// return StatementIterator(); |
566 |
+// } |
-// } |
567 |
} |
} |
568 |
|
|
569 |
|
|
570 |
@@ -219,12 +279,14 @@ |
@@ -279,14 +219,12 @@ |
571 |
} |
} |
572 |
|
|
573 |
|
|
574 |
-Soprano::StatementIterator Soprano::Raptor::Parser::parseStream( QTextStream& stream, |
-Soprano::StatementIterator |
575 |
- const QUrl& baseUri, |
-Soprano::Raptor::Parser::parseStream( QTextStream& stream, |
576 |
- RdfSerialization serialization, |
- const QUrl& baseUri, |
577 |
- const QString& userSerialization ) const |
- RdfSerialization serialization, |
578 |
+Soprano::StatementIterator |
- const QString& userSerialization ) const |
579 |
+Soprano::Raptor::Parser::parseStream( QTextStream& stream, |
+Soprano::StatementIterator Soprano::Raptor::Parser::parseStream( QTextStream& stream, |
580 |
+ const QUrl& baseUri, |
+ const QUrl& baseUri, |
581 |
+ RdfSerialization serialization, |
+ RdfSerialization serialization, |
582 |
+ const QString& userSerialization ) const |
+ const QString& userSerialization ) const |
583 |
{ |
{ |
584 |
- QMutexLocker lock( &d->mutex ); |
- QMutexLocker lock( &m_mutex ); |
585 |
+ QMutexLocker lock( &m_mutex ); |
- RaptorInitHelper raptorInitHelper; |
586 |
+ RaptorInitHelper raptorInitHelper; |
+ QMutexLocker lock( &d->mutex ); |
587 |
|
|
588 |
clearError(); |
clearError(); |
589 |
|
|
590 |
@@ -235,19 +297,22 @@ |
@@ -297,22 +235,19 @@ |
591 |
|
|
592 |
// prepare the container for the parsed data |
// prepare the container for the parsed data |
593 |
ParserData data; |
ParserData data; |
594 |
- raptor_parser_set_statement_handler( parser, &data, raptorTriplesHandler ); |
- raptor_set_statement_handler( parser, &data, raptorTriplesHandler ); |
595 |
+ raptor_set_statement_handler( parser, &data, raptorTriplesHandler ); |
-#ifdef RAPTOR_HAVE_TRIG |
596 |
+#ifdef RAPTOR_HAVE_TRIG |
- raptor_set_graph_handler( parser, &data, raptorGraphHandler ); |
597 |
+ raptor_set_graph_handler( parser, &data, raptorGraphHandler ); |
-#endif |
598 |
+#endif |
+ raptor_parser_set_statement_handler( parser, &data, raptorTriplesHandler ); |
599 |
|
|
600 |
// start the atual parsing |
// start the atual parsing |
601 |
raptor_uri* raptorBaseUri = 0; |
raptor_uri* raptorBaseUri = 0; |
602 |
if ( baseUri.isValid() ) { |
if ( baseUri.isValid() ) { |
603 |
- raptorBaseUri = raptor_new_uri( d->world,(unsigned char *) baseUri.toString().toUtf8().data() ); |
- raptorBaseUri = raptor_new_uri( (unsigned char *) baseUri.toString().toUtf8().data() ); |
604 |
+ raptorBaseUri = raptor_new_uri( (unsigned char *) baseUri.toString().toUtf8().data() ); |
+ raptorBaseUri = raptor_new_uri( d->world,(unsigned char *) baseUri.toString().toUtf8().data() ); |
605 |
} |
} |
606 |
else { |
else { |
607 |
- raptorBaseUri = raptor_new_uri( d->world, (unsigned char *) "http://soprano.sourceforge.net/dummyBaseUri" ); |
- raptorBaseUri = raptor_new_uri( (unsigned char *) "http://soprano.sourceforge.net/dummyBaseUri" ); |
608 |
+ raptorBaseUri = raptor_new_uri( (unsigned char *) "http://soprano.sourceforge.net/dummyBaseUri" ); |
+ raptorBaseUri = raptor_new_uri( d->world, (unsigned char *) "http://soprano.sourceforge.net/dummyBaseUri" ); |
609 |
} |
} |
610 |
|
|
611 |
clearError(); |
clearError(); |
612 |
- if ( raptor_parser_parse_start( parser, raptorBaseUri ) != 0 ) { |
- if ( raptor_start_parse( parser, raptorBaseUri ) ) { |
613 |
+ if ( raptor_start_parse( parser, raptorBaseUri ) ) { |
+ if ( raptor_parser_parse_start( parser, raptorBaseUri ) != 0 ) { |
614 |
if ( !lastError() ) { |
if ( !lastError() ) { |
615 |
ErrorCache::setError( QLatin1String( "Failed to start parsing." ) ); |
ErrorCache::setError( QLatin1String( "Failed to start parsing." ) ); |
616 |
} |
} |
617 |
@@ -266,10 +331,7 @@ |
@@ -331,7 +266,10 @@ |
618 |
while ( !dev->atEnd() ) { |
while ( !dev->atEnd() ) { |
619 |
qint64 r = dev->read( buf.data(), buf.size() ); |
qint64 r = dev->read( buf.data(), buf.size() ); |
620 |
if ( r <= 0 || |
if ( r <= 0 || |
621 |
- raptor_parser_parse_chunk( parser, ( const unsigned char* )buf.data(), r, 0 ) ) { |
- raptor_parse_chunk( parser, ( const unsigned char* )buf.data(), r, 0 ) ) { |
622 |
- // parse_chunck return failure code. |
+ raptor_parser_parse_chunk( parser, ( const unsigned char* )buf.data(), r, 0 ) ) { |
623 |
- // Call it with END=true and then free |
+ // parse_chunck return failure code. |
624 |
- raptor_parser_parse_chunk(parser,0,0,/*END=*/1); |
+ // Call it with END=true and then free |
625 |
+ raptor_parse_chunk( parser, ( const unsigned char* )buf.data(), r, 0 ) ) { |
+ raptor_parser_parse_chunk(parser,0,0,/*END=*/1); |
626 |
raptor_free_parser( parser ); |
raptor_free_parser( parser ); |
627 |
if ( raptorBaseUri ) { |
if ( raptorBaseUri ) { |
628 |
raptor_free_uri( raptorBaseUri ); |
raptor_free_uri( raptorBaseUri ); |
629 |
@@ -282,10 +344,7 @@ |
@@ -344,7 +282,10 @@ |
630 |
while ( !stream.atEnd() ) { |
while ( !stream.atEnd() ) { |
631 |
QString buf = stream.read( bufSize ); |
QString buf = stream.read( bufSize ); |
632 |
QByteArray utf8Data = buf.toUtf8(); |
QByteArray utf8Data = buf.toUtf8(); |
633 |
- if ( raptor_parser_parse_chunk( parser, ( const unsigned char* )utf8Data.data(), utf8Data.length(), 0 ) ) { |
- if ( raptor_parse_chunk( parser, ( const unsigned char* )utf8Data.data(), utf8Data.length(), 0 ) ) { |
634 |
- // parse_chunck return failure code. |
+ if ( raptor_parser_parse_chunk( parser, ( const unsigned char* )utf8Data.data(), utf8Data.length(), 0 ) ) { |
635 |
- // Call it with END=true and then free |
+ // parse_chunck return failure code. |
636 |
- raptor_parser_parse_chunk(parser,0,0,/*END=*/1); |
+ // Call it with END=true and then free |
637 |
+ if ( raptor_parse_chunk( parser, ( const unsigned char* )utf8Data.data(), utf8Data.length(), 0 ) ) { |
+ raptor_parser_parse_chunk(parser,0,0,/*END=*/1); |
638 |
raptor_free_parser( parser ); |
raptor_free_parser( parser ); |
639 |
if ( raptorBaseUri ) { |
if ( raptorBaseUri ) { |
640 |
raptor_free_uri( raptorBaseUri ); |
raptor_free_uri( raptorBaseUri ); |
641 |
@@ -294,8 +353,7 @@ |
@@ -353,7 +294,8 @@ |
642 |
} |
} |
643 |
} |
} |
644 |
} |
} |
645 |
- // Call parse_chunk with END=true |
- raptor_parse_chunk( parser, 0, 0, 1 ); |
646 |
- raptor_parser_parse_chunk( parser, 0, 0, 1 ); |
+ // Call parse_chunk with END=true |
647 |
+ raptor_parse_chunk( parser, 0, 0, 1 ); |
+ raptor_parser_parse_chunk( parser, 0, 0, 1 ); |
648 |
|
|
649 |
raptor_free_parser( parser ); |
raptor_free_parser( parser ); |
650 |
if ( raptorBaseUri ) { |
if ( raptorBaseUri ) { |
651 |
diff -Naur soprano/parsers/raptor/raptorparser.h soprano-2.6.51/parsers/raptor/raptorparser.h |
diff -Naur soprano-2.6.51/parsers/raptor/raptorparser.h soprano/parsers/raptor/raptorparser.h |
652 |
--- soprano/parsers/raptor/raptorparser.h 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/parsers/raptor/raptorparser.h 2011-06-05 10:38:25.000000000 +0200 |
653 |
+++ soprano-2.6.51/parsers/raptor/raptorparser.h 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/parsers/raptor/raptorparser.h 2011-07-19 18:49:58.000000000 +0200 |
654 |
@@ -29,11 +29,13 @@ |
@@ -29,13 +29,11 @@ |
655 |
|
|
656 |
#include "parser.h" |
#include "parser.h" |
657 |
|
|
658 |
-#include<raptor2/raptor.h> |
-#include <raptor.h> |
659 |
+#include <raptor.h> |
- |
660 |
+ |
+#include<raptor2/raptor.h> |
661 |
|
|
662 |
namespace Soprano { |
namespace Soprano { |
663 |
namespace Raptor { |
namespace Raptor { |
664 |
- class Parser : public QObject, public Soprano::Parser { |
- class Parser : public QObject, public Soprano::Parser |
665 |
+ class Parser : public QObject, public Soprano::Parser |
- { |
666 |
+ { |
+ class Parser : public QObject, public Soprano::Parser { |
667 |
Q_OBJECT |
Q_OBJECT |
668 |
Q_INTERFACES(Soprano::Parser) |
Q_INTERFACES(Soprano::Parser) |
669 |
|
|
670 |
@@ -41,7 +43,7 @@ |
@@ -43,7 +41,7 @@ |
671 |
Parser(); |
Parser(); |
672 |
~Parser(); |
~Parser(); |
673 |
|
|
674 |
- RdfSerializations supportedSerializations() const; |
- RdfSerializations supportedSerializations() const; |
675 |
+ RdfSerializations supportedSerializations() const; |
+ RdfSerializations supportedSerializations() const; |
676 |
|
|
677 |
StatementIterator parseFile( const QString& filename, |
StatementIterator parseFile( const QString& filename, |
678 |
const QUrl& baseUri, |
const QUrl& baseUri, |
679 |
@@ -62,10 +64,7 @@ |
@@ -64,7 +62,10 @@ |
680 |
raptor_parser* createParser( RdfSerialization serialization, |
raptor_parser* createParser( RdfSerialization serialization, |
681 |
const QString& userSerialization = QString() ) const; |
const QString& userSerialization = QString() ) const; |
682 |
|
|
683 |
- class Private; |
- mutable QMutex m_mutex; |
684 |
- Private * d; |
+ class Private; |
685 |
- |
+ Private * d; |
686 |
- |
+ |
687 |
+ mutable QMutex m_mutex; |
+ |
688 |
}; |
}; |
689 |
} |
} |
690 |
} |
} |
691 |
diff -Naur soprano/serializers/raptor/CMakeLists.txt soprano-2.6.51/serializers/raptor/CMakeLists.txt |
diff -Naur soprano-2.6.51/serializers/raptor/CMakeLists.txt soprano/serializers/raptor/CMakeLists.txt |
692 |
--- soprano/serializers/raptor/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/serializers/raptor/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
693 |
+++ soprano-2.6.51/serializers/raptor/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/serializers/raptor/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
694 |
@@ -9,8 +9,13 @@ |
@@ -9,13 +9,8 @@ |
695 |
${RAPTOR_INCLUDE_DIR} |
${RAPTOR_INCLUDE_DIR} |
696 |
) |
) |
697 |
|
|
698 |
+include(CheckFunctionExists) |
-include(CheckFunctionExists) |
699 |
set(CMAKE_REQUIRED_INCLUDES ${RAPTOR_INCLUDE_DIR}) |
set(CMAKE_REQUIRED_INCLUDES ${RAPTOR_INCLUDE_DIR}) |
700 |
set(CMAKE_REQUIRED_LIBRARIES ${RAPTOR_LIBRARIES}) |
set(CMAKE_REQUIRED_LIBRARIES ${RAPTOR_LIBRARIES}) |
701 |
+check_function_exists( raptor_new_iostream_from_handler2 HAVE_IOSTREAM_HANDLER2 ) |
-check_function_exists( raptor_new_iostream_from_handler2 HAVE_IOSTREAM_HANDLER2 ) |
702 |
+if(HAVE_IOSTREAM_HANDLER2) |
-if(HAVE_IOSTREAM_HANDLER2) |
703 |
+ add_definitions(-DHAVE_IOSTREAM_HANDLER2) |
- add_definitions(-DHAVE_IOSTREAM_HANDLER2) |
704 |
+endif(HAVE_IOSTREAM_HANDLER2) |
-endif(HAVE_IOSTREAM_HANDLER2) |
705 |
|
|
706 |
set(raptor_serializer_SRC |
set(raptor_serializer_SRC |
707 |
raptorserializer.cpp |
raptorserializer.cpp |
708 |
diff -Naur soprano/serializers/raptor/raptorserializer.cpp soprano-2.6.51/serializers/raptor/raptorserializer.cpp |
diff -Naur soprano-2.6.51/serializers/raptor/raptorserializer.cpp soprano/serializers/raptor/raptorserializer.cpp |
709 |
--- soprano/serializers/raptor/raptorserializer.cpp 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/serializers/raptor/raptorserializer.cpp 2011-06-05 10:38:25.000000000 +0200 |
710 |
+++ soprano-2.6.51/serializers/raptor/raptorserializer.cpp 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/serializers/raptor/raptorserializer.cpp 2011-07-19 18:49:58.000000000 +0200 |
711 |
@@ -38,135 +38,54 @@ |
@@ -38,54 +38,135 @@ |
712 |
class RaptorInitHelper |
class RaptorInitHelper |
713 |
{ |
{ |
714 |
public: |
public: |
715 |
- raptor_world* world; |
+ raptor_world* world; |
716 |
- |
+ |
717 |
RaptorInitHelper() { |
RaptorInitHelper() { |
718 |
- world = raptor_new_world(); |
- raptor_init(); |
719 |
- raptor_world_open(world); |
+ world = raptor_new_world(); |
720 |
+ raptor_init(); |
+ raptor_world_open(world); |
721 |
} |
} |
722 |
~RaptorInitHelper() { |
~RaptorInitHelper() { |
723 |
- raptor_free_world(world); |
- raptor_finish(); |
724 |
+ raptor_finish(); |
+ raptor_free_world(world); |
725 |
} |
} |
726 |
}; |
}; |
727 |
|
|
728 |
- /* Probably unnecessary for serializer*/ |
- bool convertNode( const Soprano::Node& node, const void** data, raptor_identifier_type* type, raptor_uri** dataType = 0, const unsigned char** lang = 0 ) |
729 |
- /* |
+ /* Probably unnecessary for serializer*/ |
730 |
- QString mimeTypeString( Soprano::RdfSerialization s, const QString& userSerialization ) |
+ /* |
731 |
- { |
+ QString mimeTypeString( Soprano::RdfSerialization s, const QString& userSerialization ) |
732 |
- if ( s == Soprano::SerializationTurtle ) { |
+ { |
733 |
- return "application/turtle"; // x-turtle does not work.... |
+ if ( s == Soprano::SerializationTurtle ) { |
734 |
- } |
+ return "application/turtle"; // x-turtle does not work.... |
735 |
- else { |
+ } |
736 |
- return serializationMimeType( s, userSerialization ); |
+ else { |
737 |
- } |
+ return serializationMimeType( s, userSerialization ); |
738 |
- }*/ |
+ } |
739 |
- |
+ }*/ |
740 |
- raptor_term * convertNode( raptor_world * world, const Soprano::Node& node) |
+ |
741 |
+ bool convertNode( const Soprano::Node& node, const void** data, raptor_identifier_type* type, raptor_uri** dataType = 0, const unsigned char** lang = 0 ) |
+ raptor_term * convertNode( raptor_world * world, const Soprano::Node& node) |
742 |
{ |
{ |
743 |
- raptor_term * answer = 0; |
+ raptor_term * answer = 0; |
744 |
- /* According to documentation, raptor_new_term family takes copy of |
+ /* According to documentation, raptor_new_term family takes copy of |
745 |
- * all given input parameters |
+ * all given input parameters |
746 |
- */ |
+ */ |
747 |
if ( node.isResource() ) { |
if ( node.isResource() ) { |
748 |
- raptor_uri * uri = raptor_new_uri(world, ( const unsigned char* )node.uri().toEncoded().data() ); |
- *data = raptor_new_uri( ( const unsigned char* )node.uri().toEncoded().data() ); |
749 |
- answer = raptor_new_term_from_uri(world,uri); |
- *type = RAPTOR_IDENTIFIER_TYPE_RESOURCE; |
750 |
- |
- return true; |
751 |
- raptor_free_uri(uri); |
+ raptor_uri * uri = raptor_new_uri(world, ( const unsigned char* )node.uri().toEncoded().data() ); |
752 |
+ *data = raptor_new_uri( ( const unsigned char* )node.uri().toEncoded().data() ); |
+ answer = raptor_new_term_from_uri(world,uri); |
753 |
+ *type = RAPTOR_IDENTIFIER_TYPE_RESOURCE; |
+ |
754 |
+ return true; |
+ raptor_free_uri(uri); |
755 |
} |
} |
756 |
else if ( node.isBlank() ) { |
else if ( node.isBlank() ) { |
757 |
- answer = raptor_new_term_from_blank( |
- *data = qstrdup( node.identifier().toUtf8().data() ); |
758 |
- world, (const unsigned char*)node.identifier().toUtf8().data() ); |
- *type = RAPTOR_IDENTIFIER_TYPE_ANONYMOUS; |
759 |
+ *data = qstrdup( node.identifier().toUtf8().data() ); |
- return true; |
760 |
+ *type = RAPTOR_IDENTIFIER_TYPE_ANONYMOUS; |
+ answer = raptor_new_term_from_blank( |
761 |
+ return true; |
+ world, (const unsigned char*)node.identifier().toUtf8().data() ); |
762 |
} |
} |
763 |
else if ( node.isLiteral() ) { |
else if ( node.isLiteral() ) { |
764 |
- // Because QByteArray.data() is valid as long as QByteArray itself is |
- *data = qstrdup( node.toString().toUtf8().data() ); |
765 |
- // alive, we store langBA ( and others _x_BA untill function exits |
+ // Because QByteArray.data() is valid as long as QByteArray itself is |
766 |
- |
+ // alive, we store langBA ( and others _x_BA untill function exits |
767 |
- //const unsigned char * literal = 0; |
+ |
768 |
- QByteArray langBA; |
+ //const unsigned char * literal = 0; |
769 |
- const unsigned char * lang = 0; |
+ QByteArray langBA; |
770 |
- raptor_uri * datatype = 0; |
+ const unsigned char * lang = 0; |
771 |
- |
+ raptor_uri * datatype = 0; |
772 |
+ *data = qstrdup( node.toString().toUtf8().data() ); |
+ |
773 |
if ( node.literal().isPlain() ) { |
if ( node.literal().isPlain() ) { |
774 |
if ( !node.language().isEmpty() ) |
if ( !node.language().isEmpty() ) |
775 |
- langBA = node.language().toUtf8(); |
- *lang = ( unsigned char* )qstrdup( ( const char* )node.language().toUtf8().data() ); |
776 |
- lang = ( const unsigned char* )( langBA.constData() ); |
+ langBA = node.language().toUtf8(); |
777 |
+ *lang = ( unsigned char* )qstrdup( ( const char* )node.language().toUtf8().data() ); |
+ lang = ( const unsigned char* )( langBA.constData() ); |
778 |
} |
} |
779 |
else { |
else { |
780 |
- datatype = raptor_new_uri( world, ( const unsigned char* )node.dataType().toEncoded().data() ); |
- *dataType = raptor_new_uri( ( const unsigned char* )node.dataType().toEncoded().data() ); |
781 |
+ *dataType = raptor_new_uri( ( const unsigned char* )node.dataType().toEncoded().data() ); |
+ datatype = raptor_new_uri( world, ( const unsigned char* )node.dataType().toEncoded().data() ); |
782 |
} |
} |
783 |
- |
- *type = RAPTOR_IDENTIFIER_TYPE_LITERAL; |
784 |
- // Now we costructs statement |
- return true; |
785 |
- answer = raptor_new_term_from_literal(world,(const unsigned char*)node.literal().toByteArray().constData(),datatype,lang); |
+ |
786 |
- |
+ // Now we costructs statement |
787 |
- // And free unnecessary resources |
+ answer = raptor_new_term_from_literal(world,(const unsigned char*)node.literal().toByteArray().constData(),datatype,lang); |
788 |
- if ( datatype) |
+ |
789 |
- raptor_free_uri(datatype); |
+ // And free unnecessary resources |
790 |
- |
+ if ( datatype) |
791 |
+ *type = RAPTOR_IDENTIFIER_TYPE_LITERAL; |
+ raptor_free_uri(datatype); |
792 |
+ return true; |
+ |
793 |
} |
} |
794 |
|
|
795 |
- return answer; |
- return false; |
796 |
+ return false; |
+ return answer; |
797 |
} |
} |
798 |
|
|
799 |
|
|
800 |
- raptor_statement* convertStatement(raptor_world * world, const Soprano::Statement& statement ) |
- raptor_statement* convertStatement( const Soprano::Statement& statement ) |
801 |
+ raptor_statement* convertStatement( const Soprano::Statement& statement ) |
+ raptor_statement* convertStatement(raptor_world * world, const Soprano::Statement& statement ) |
802 |
{ |
{ |
803 |
- // Get terms |
- raptor_statement* s = new raptor_statement; |
804 |
- raptor_term * subject_term = 0, *object_term = 0, * predicate_term = 0; |
- memset( s, 0, sizeof( raptor_statement ) ); |
805 |
- raptor_term * graph_term = 0; |
- convertNode( statement.subject(), &s->subject, &s->subject_type ); |
806 |
- |
- convertNode( statement.predicate(), &s->predicate, &s->predicate_type ); |
807 |
- subject_term = convertNode(world,statement.subject()); |
- convertNode( statement.object(), &s->object, &s->object_type, &s->object_literal_datatype, &s->object_literal_language ); |
808 |
- if ( !subject_term) { |
+ // Get terms |
809 |
- qDebug() << "Failed to convert subject to raptor_term"; |
+ raptor_term * subject_term = 0, *object_term = 0, * predicate_term = 0; |
810 |
- return 0; |
+ raptor_term * graph_term = 0; |
811 |
- } |
+ |
812 |
- |
+ subject_term = convertNode(world,statement.subject()); |
813 |
- predicate_term = convertNode(world,statement.predicate()); |
+ if ( !subject_term) { |
814 |
- if (!predicate_term) { |
+ qDebug() << "Failed to convert subject to raptor_term"; |
815 |
- qDebug() << "Failed to convert predicate to raptor_term"; |
+ return 0; |
816 |
- raptor_free_term(subject_term); |
+ } |
817 |
- return 0; |
+ |
818 |
- } |
+ predicate_term = convertNode(world,statement.predicate()); |
819 |
- |
+ if (!predicate_term) { |
820 |
- object_term = convertNode(world,statement.object()); |
+ qDebug() << "Failed to convert predicate to raptor_term"; |
821 |
- if (!object_term) { |
+ raptor_free_term(subject_term); |
822 |
- qDebug() << "Failed to convert object to raptor_term"; |
+ return 0; |
823 |
- raptor_free_term(subject_term); |
+ } |
824 |
- raptor_free_term(predicate_term); |
+ |
825 |
- return 0; |
+ object_term = convertNode(world,statement.object()); |
826 |
- } |
+ if (!object_term) { |
827 |
- |
+ qDebug() << "Failed to convert object to raptor_term"; |
828 |
- if ( !statement.context().isEmpty() ) { |
+ raptor_free_term(subject_term); |
829 |
- graph_term = convertNode(world,statement.context()); |
+ raptor_free_term(predicate_term); |
830 |
- if(!graph_term) { |
+ return 0; |
831 |
- qDebug() << "Failed to convert graph/context to raptor_term. Node is" << statement.context(); |
+ } |
832 |
- raptor_free_term(subject_term); |
+ |
833 |
- raptor_free_term(predicate_term); |
+ if ( !statement.context().isEmpty() ) { |
834 |
- raptor_free_term(object_term); |
+ graph_term = convertNode(world,statement.context()); |
835 |
- return 0; |
+ if(!graph_term) { |
836 |
- } |
+ qDebug() << "Failed to convert graph/context to raptor_term. Node is" << statement.context(); |
837 |
- } |
+ raptor_free_term(subject_term); |
838 |
- |
+ raptor_free_term(predicate_term); |
839 |
- |
+ raptor_free_term(object_term); |
840 |
- raptor_statement* s = raptor_new_statement_from_nodes( |
+ return 0; |
841 |
- world, |
+ } |
842 |
- subject_term, |
+ } |
843 |
- predicate_term, |
+ |
844 |
- object_term, |
+ |
845 |
- graph_term); |
+ raptor_statement* s = raptor_new_statement_from_nodes( |
846 |
- |
+ world, |
847 |
- if (!s) { |
+ subject_term, |
848 |
- qDebug() << "Failed to build raptor_statement from terms"; |
+ predicate_term, |
849 |
- raptor_free_term(subject_term); |
+ object_term, |
850 |
- raptor_free_term(predicate_term); |
+ graph_term); |
851 |
- raptor_free_term(object_term); |
+ |
852 |
- raptor_free_term(graph_term); |
+ if (!s) { |
853 |
- } |
+ qDebug() << "Failed to build raptor_statement from terms"; |
854 |
- |
+ raptor_free_term(subject_term); |
855 |
+ raptor_statement* s = new raptor_statement; |
+ raptor_free_term(predicate_term); |
856 |
+ memset( s, 0, sizeof( raptor_statement ) ); |
+ raptor_free_term(object_term); |
857 |
+ convertNode( statement.subject(), &s->subject, &s->subject_type ); |
+ raptor_free_term(graph_term); |
858 |
+ convertNode( statement.predicate(), &s->predicate, &s->predicate_type ); |
+ } |
859 |
+ convertNode( statement.object(), &s->object, &s->object_type, &s->object_literal_datatype, &s->object_literal_language ); |
+ |
860 |
return s; |
return s; |
861 |
} |
} |
862 |
|
|
863 |
|
|
864 |
- /* |
+ /* |
865 |
void free_node( const void* data, raptor_identifier_type type ) |
void free_node( const void* data, raptor_identifier_type type ) |
866 |
{ |
{ |
867 |
switch( type ) { |
switch( type ) { |
868 |
@@ -190,7 +109,6 @@ |
@@ -109,6 +190,7 @@ |
869 |
free( ( char* )s->object_literal_language ); |
free( ( char* )s->object_literal_language ); |
870 |
delete s; |
delete s; |
871 |
} |
} |
872 |
- */ |
+ */ |
873 |
|
|
874 |
|
|
875 |
int raptorIOStreamWriteByte( void* data, const int byte ) |
int raptorIOStreamWriteByte( void* data, const int byte ) |
876 |
@@ -203,7 +121,6 @@ |
@@ -121,6 +203,7 @@ |
877 |
else { |
else { |
878 |
( *s ) << ( char )byte; |
( *s ) << ( char )byte; |
879 |
} |
} |
880 |
- //qDebug() << "Write char:" << (char)(byte); |
+ //qDebug() << "Write char:" << (char)(byte); |
881 |
return 0; |
return 0; |
882 |
} |
} |
883 |
|
|
884 |
@@ -223,7 +140,6 @@ |
@@ -140,6 +223,7 @@ |
885 |
raptorIOStreamWriteByte( data, p[i] ); |
raptorIOStreamWriteByte( data, p[i] ); |
886 |
} |
} |
887 |
} |
} |
888 |
- //qDebug() << "Write string: " << p; |
+ //qDebug() << "Write string: " << p; |
889 |
break; |
break; |
890 |
} |
} |
891 |
default: |
default: |
892 |
@@ -237,36 +153,15 @@ |
@@ -153,15 +237,36 @@ |
893 |
Q_EXPORT_PLUGIN2(soprano_raptorserializer, Soprano::Raptor::Serializer) |
Q_EXPORT_PLUGIN2(soprano_raptorserializer, Soprano::Raptor::Serializer) |
894 |
|
|
895 |
|
|
896 |
- |
+ |
897 |
-/* We can not rely on RaptorInitHelper anymore because |
+/* We can not rely on RaptorInitHelper anymore because |
898 |
- * we need raptor_world in supportedUserSerializations. |
+ * we need raptor_world in supportedUserSerializations. |
899 |
- * Instead of constantly creating new raptor_world just to |
+ * Instead of constantly creating new raptor_world just to |
900 |
- * detect user supported serializations, it is easier to |
+ * detect user supported serializations, it is easier to |
901 |
- * embed raptor_world into class. |
+ * embed raptor_world into class. |
902 |
- * And we can not declare raptor_world as a member of |
+ * And we can not declare raptor_world as a member of |
903 |
- * Serializer directly, because raptor_world is a typedef, |
+ * Serializer directly, because raptor_world is a typedef, |
904 |
- * not a class. So it can not be forward declarated |
+ * not a class. So it can not be forward declarated |
905 |
- */ |
+ */ |
906 |
-class Soprano::Raptor::Serializer::Private |
+class Soprano::Raptor::Serializer::Private |
907 |
-{ |
+{ |
908 |
- public: |
+ public: |
909 |
- raptor_world * world; |
+ raptor_world * world; |
910 |
-}; |
+}; |
911 |
- |
+ |
912 |
Soprano::Raptor::Serializer::Serializer() |
Soprano::Raptor::Serializer::Serializer() |
913 |
: QObject(), |
: QObject(), |
914 |
Soprano::Serializer( "raptor" ) |
Soprano::Serializer( "raptor" ) |
915 |
{ |
{ |
916 |
- this->d = new Private(); |
+ this->d = new Private(); |
917 |
- this->d->world = raptor_new_world(); |
+ this->d->world = raptor_new_world(); |
918 |
- raptor_world_open(d->world); |
+ raptor_world_open(d->world); |
919 |
} |
} |
920 |
|
|
921 |
|
|
922 |
Soprano::Raptor::Serializer::~Serializer() |
Soprano::Raptor::Serializer::~Serializer() |
923 |
{ |
{ |
924 |
- raptor_free_world(d->world); |
+ raptor_free_world(d->world); |
925 |
- delete d; |
+ delete d; |
926 |
} |
} |
927 |
|
|
928 |
|
|
929 |
@@ -279,19 +174,17 @@ |
@@ -174,17 +279,19 @@ |
930 |
QStringList Soprano::Raptor::Serializer::supportedUserSerializations() const |
QStringList Soprano::Raptor::Serializer::supportedUserSerializations() const |
931 |
{ |
{ |
932 |
QStringList sl; |
QStringList sl; |
933 |
- const raptor_syntax_description * serializer_descr = 0; |
- int i = 0; |
934 |
- for ( int i = 0; 1; ++i ) { |
- const char* name = 0; |
935 |
- serializer_descr = |
- const char* label = 0; |
936 |
- raptor_world_get_serializer_description(d->world,i); |
- const char* mimeType = 0; |
937 |
- |
- const unsigned char* uri = 0; |
938 |
- /* raptor_world_get_serializer_description will return |
- while ( !raptor_serializers_enumerate( i, |
939 |
- * NULL when conter runs out of bonds and there is no |
- &name, |
940 |
- * more serializers |
- &label, |
941 |
- */ |
- &mimeType, |
942 |
- if (!serializer_descr) |
- &uri ) ) { |
943 |
- break; |
- sl << QString::fromUtf8( name ); |
944 |
- |
+ const raptor_syntax_description * serializer_descr = 0; |
945 |
- sl << QString::fromUtf8( serializer_descr->names[0] ); |
+ for ( int i = 0; 1; ++i ) { |
946 |
+ int i = 0; |
+ serializer_descr = |
947 |
+ const char* name = 0; |
+ raptor_world_get_serializer_description(d->world,i); |
948 |
+ const char* label = 0; |
+ |
949 |
+ const char* mimeType = 0; |
+ /* raptor_world_get_serializer_description will return |
950 |
+ const unsigned char* uri = 0; |
+ * NULL when conter runs out of bonds and there is no |
951 |
+ while ( !raptor_serializers_enumerate( i, |
+ * more serializers |
952 |
+ &name, |
+ */ |
953 |
+ &label, |
+ if (!serializer_descr) |
954 |
+ &mimeType, |
+ break; |
955 |
+ &uri ) ) { |
+ |
956 |
+ sl << QString::fromUtf8( name ); |
+ sl << QString::fromUtf8( serializer_descr->names[0] ); |
957 |
++i; |
++i; |
958 |
} |
} |
959 |
return sl; |
return sl; |
960 |
@@ -305,43 +198,28 @@ |
@@ -198,28 +305,43 @@ |
961 |
{ |
{ |
962 |
clearError(); |
clearError(); |
963 |
|
|
964 |
- raptor_world * world = this->d->world; |
- RaptorInitHelper raptorHelper; |
965 |
+ RaptorInitHelper raptorHelper; |
+ raptor_world * world = this->d->world; |
966 |
|
|
967 |
raptor_serializer* serializer = 0; |
raptor_serializer* serializer = 0; |
968 |
- QString mimeType = serializationMimeType(serialization,userSerialization); |
+ QString mimeType = serializationMimeType(serialization,userSerialization); |
969 |
- |
+ |
970 |
if ( serialization == SerializationRdfXml ) { |
if ( serialization == SerializationRdfXml ) { |
971 |
- serializer = raptor_new_serializer( world, "rdfxml-abbrev" ); // we always want the abbreviated xmlrdf |
- serializer = raptor_new_serializer( "rdfxml-abbrev" ); // we always want the abbreviated xmlrdf |
972 |
+ serializer = raptor_new_serializer( "rdfxml-abbrev" ); // we always want the abbreviated xmlrdf |
+ serializer = raptor_new_serializer( world, "rdfxml-abbrev" ); // we always want the abbreviated xmlrdf |
973 |
} |
} |
974 |
else { |
else { |
975 |
- const raptor_syntax_description * serializer_descr = 0; |
+ const raptor_syntax_description * serializer_descr = 0; |
976 |
for ( int i = 0; 1; ++i ) { |
for ( int i = 0; 1; ++i ) { |
977 |
- serializer_descr = |
- const char* syntax_name = 0; |
978 |
- raptor_world_get_serializer_description(world,i); |
- const char* syntax_label = 0; |
979 |
- |
- const char* mime_type = 0; |
980 |
- /* raptor_world_get_serializer_description will return |
- const unsigned char* uri_string = 0; |
981 |
- * NULL when conter runs out of bonds and there is no |
- if ( raptor_serializers_enumerate( i, |
982 |
- * more serializers |
- &syntax_name, |
983 |
- */ |
- &syntax_label, |
984 |
- if (!serializer_descr) |
- &mime_type, |
985 |
+ const char* syntax_name = 0; |
- &uri_string ) ) |
986 |
+ const char* syntax_label = 0; |
- break; |
987 |
+ const char* mime_type = 0; |
- if ( !qstrcmp( serializationMimeType( serialization, userSerialization ).toLatin1().data(), mime_type ) ) { |
988 |
+ const unsigned char* uri_string = 0; |
- serializer = raptor_new_serializer( syntax_name ); |
989 |
+ if ( raptor_serializers_enumerate( i, |
+ serializer_descr = |
990 |
+ &syntax_name, |
+ raptor_world_get_serializer_description(world,i); |
991 |
+ &syntax_label, |
+ |
992 |
+ &mime_type, |
+ /* raptor_world_get_serializer_description will return |
993 |
+ &uri_string ) ) |
+ * NULL when conter runs out of bonds and there is no |
994 |
|
+ * more serializers |
995 |
|
+ */ |
996 |
|
+ if (!serializer_descr) |
997 |
break; |
break; |
998 |
- |
+ |
999 |
- /* In serializer_descr->mime_types we have a array of pairs |
+ /* In serializer_descr->mime_types we have a array of pairs |
1000 |
- * (mime_type,Q) of mime_type for this syntax. It looks like |
+ * (mime_type,Q) of mime_type for this syntax. It looks like |
1001 |
- * we can ignore Q value in this case |
+ * we can ignore Q value in this case |
1002 |
- * Acording to documentation, this array can have zero elements |
+ * Acording to documentation, this array can have zero elements |
1003 |
- */ |
+ */ |
1004 |
- for( int mt_number = 0; mt_number < serializer_descr->mime_types_count; |
+ for( int mt_number = 0; mt_number < serializer_descr->mime_types_count; |
1005 |
- mt_number++) |
+ mt_number++) |
1006 |
- { |
+ { |
1007 |
- const char * mime_type_N = serializer_descr->mime_types[mt_number].mime_type; |
+ const char * mime_type_N = serializer_descr->mime_types[mt_number].mime_type; |
1008 |
- if ( !qstrcmp( serializationMimeType( serialization, userSerialization ).toLatin1().data(), mime_type_N ) ) { |
+ if ( !qstrcmp( serializationMimeType( serialization, userSerialization ).toLatin1().data(), mime_type_N ) ) { |
1009 |
- serializer = raptor_new_serializer( world, serializer_descr->names[0] ); |
+ serializer = raptor_new_serializer( world, serializer_descr->names[0] ); |
1010 |
- break; |
+ break; |
1011 |
- } |
+ } |
1012 |
- } |
} |
1013 |
- if ( serializer ) |
+ if ( serializer ) |
1014 |
+ if ( !qstrcmp( serializationMimeType( serialization, userSerialization ).toLatin1().data(), mime_type ) ) { |
+ break; |
|
+ serializer = raptor_new_serializer( syntax_name ); |
|
|
break; |
|
|
+ } |
|
1015 |
} |
} |
1016 |
} |
} |
1017 |
|
|
1018 |
@@ -354,8 +232,8 @@ |
@@ -232,8 +354,8 @@ |
1019 |
QHash<QString, QUrl> namespaces = prefixes(); |
QHash<QString, QUrl> namespaces = prefixes(); |
1020 |
for ( QHash<QString, QUrl>::const_iterator pfit = namespaces.constBegin(); |
for ( QHash<QString, QUrl>::const_iterator pfit = namespaces.constBegin(); |
1021 |
pfit != namespaces.constEnd(); ++pfit ) { |
pfit != namespaces.constEnd(); ++pfit ) { |
1022 |
- raptor_uri* ns = raptor_new_uri( world,reinterpret_cast<unsigned char*>( pfit.value().toEncoded().data() ) ); |
- raptor_uri* ns = raptor_new_uri( reinterpret_cast<unsigned char*>( pfit.value().toEncoded().data() ) ); |
1023 |
- raptor_serializer_set_namespace( serializer, |
- raptor_serialize_set_namespace( serializer, |
1024 |
+ raptor_uri* ns = raptor_new_uri( reinterpret_cast<unsigned char*>( pfit.value().toEncoded().data() ) ); |
+ raptor_uri* ns = raptor_new_uri( world,reinterpret_cast<unsigned char*>( pfit.value().toEncoded().data() ) ); |
1025 |
+ raptor_serialize_set_namespace( serializer, |
+ raptor_serializer_set_namespace( serializer, |
1026 |
ns, |
ns, |
1027 |
( unsigned char* )pfit.key().toLatin1().data() ); |
( unsigned char* )pfit.key().toLatin1().data() ); |
1028 |
raptor_free_uri( ns ); |
raptor_free_uri( ns ); |
1029 |
@@ -363,53 +241,42 @@ |
@@ -241,42 +363,53 @@ |
1030 |
|
|
1031 |
bool success = true; |
bool success = true; |
1032 |
|
|
1033 |
- raptor_iostream_handler raptorStreamHandler; |
-#ifdef HAVE_IOSTREAM_HANDLER2 |
1034 |
- // ATTENTION: Raptor documentation is incorrect! Always set |
- raptor_iostream_handler2 raptorStreamHandler = { |
1035 |
- // version to 2 and raptor_iostream_calculate_modes internal |
- 2, |
1036 |
- // call will correctly determine operation mode ( read,write,readwrite) |
- 0, |
1037 |
- raptorStreamHandler.version = 2; |
- 0, |
1038 |
- raptorStreamHandler.init = 0; |
- raptorIOStreamWriteByte, |
1039 |
- raptorStreamHandler.finish = 0; |
- raptorIOStreamWriteBytes, |
1040 |
- raptorStreamHandler.write_byte = raptorIOStreamWriteByte; |
- 0, |
1041 |
- raptorStreamHandler.write_bytes = raptorIOStreamWriteBytes; |
- 0, |
1042 |
- raptorStreamHandler.write_end = 0; |
- 0 |
1043 |
- raptorStreamHandler.read_bytes = 0; |
- }; |
1044 |
- raptorStreamHandler.read_eof = 0; |
- raptor_iostream* raptorStream = raptor_new_iostream_from_handler2( &stream, |
1045 |
- |
- &raptorStreamHandler ); |
1046 |
- raptor_iostream* raptorStream = raptor_new_iostream_from_handler( |
-#else |
1047 |
- world, |
- raptor_iostream_handler raptorStreamHandler = { |
1048 |
- &stream, |
- 0, |
1049 |
- &raptorStreamHandler |
- 0, |
1050 |
- ); |
- raptorIOStreamWriteByte, |
1051 |
- |
- raptorIOStreamWriteBytes, |
1052 |
- if (!raptorStream) { |
- 0 |
1053 |
- qDebug() << "Can not create raptor iostream"; |
- }; |
1054 |
- raptor_free_serializer(serializer); |
- raptor_iostream* raptorStream = raptor_new_iostream_from_handler( &stream, |
1055 |
- return false; |
- &raptorStreamHandler ); |
1056 |
- } |
-#endif |
1057 |
+#ifdef HAVE_IOSTREAM_HANDLER2 |
+ raptor_iostream_handler raptorStreamHandler; |
1058 |
+ raptor_iostream_handler2 raptorStreamHandler = { |
+ // ATTENTION: Raptor documentation is incorrect! Always set |
1059 |
+ 2, |
+ // version to 2 and raptor_iostream_calculate_modes internal |
1060 |
+ 0, |
+ // call will correctly determine operation mode ( read,write,readwrite) |
1061 |
+ 0, |
+ raptorStreamHandler.version = 2; |
1062 |
+ raptorIOStreamWriteByte, |
+ raptorStreamHandler.init = 0; |
1063 |
+ raptorIOStreamWriteBytes, |
+ raptorStreamHandler.finish = 0; |
1064 |
+ 0, |
+ raptorStreamHandler.write_byte = raptorIOStreamWriteByte; |
1065 |
+ 0, |
+ raptorStreamHandler.write_bytes = raptorIOStreamWriteBytes; |
1066 |
+ 0 |
+ raptorStreamHandler.write_end = 0; |
1067 |
+ }; |
+ raptorStreamHandler.read_bytes = 0; |
1068 |
+ raptor_iostream* raptorStream = raptor_new_iostream_from_handler2( &stream, |
+ raptorStreamHandler.read_eof = 0; |
1069 |
+ &raptorStreamHandler ); |
+ |
1070 |
+#else |
+ raptor_iostream* raptorStream = raptor_new_iostream_from_handler( |
1071 |
+ raptor_iostream_handler raptorStreamHandler = { |
+ world, |
1072 |
+ 0, |
+ &stream, |
1073 |
+ 0, |
+ &raptorStreamHandler |
1074 |
+ raptorIOStreamWriteByte, |
+ ); |
1075 |
+ raptorIOStreamWriteBytes, |
+ |
1076 |
+ 0 |
+ if (!raptorStream) { |
1077 |
+ }; |
+ qDebug() << "Can not create raptor iostream"; |
1078 |
+ raptor_iostream* raptorStream = raptor_new_iostream_from_handler( &stream, |
+ raptor_free_serializer(serializer); |
1079 |
+ &raptorStreamHandler ); |
+ return false; |
1080 |
+#endif |
+ } |
1081 |
|
|
1082 |
// raptor_serialize_start takes ownership of raptorStream |
// raptor_serialize_start takes ownership of raptorStream |
1083 |
- raptor_serializer_start_to_iostream( serializer,0, raptorStream ); |
- raptor_serialize_start( serializer, 0, raptorStream ); |
1084 |
+ raptor_serialize_start( serializer, 0, raptorStream ); |
+ raptor_serializer_start_to_iostream( serializer,0, raptorStream ); |
1085 |
|
|
1086 |
while ( it.next() ) { |
while ( it.next() ) { |
1087 |
- raptor_statement * rs = convertStatement(world, *it ); |
- raptor_statement* rs = convertStatement( *it ); |
1088 |
- if (rs) { |
- raptor_serialize_statement( serializer, rs ); |
1089 |
- //qDebug() << "Serializing statement: " << *it; |
- free_statement( rs ); |
1090 |
- raptor_serializer_serialize_statement(serializer, rs ); |
+ raptor_statement * rs = convertStatement(world, *it ); |
1091 |
- raptor_free_statement( rs ); |
+ if (rs) { |
1092 |
- } |
+ //qDebug() << "Serializing statement: " << *it; |
1093 |
- else { |
+ raptor_serializer_serialize_statement(serializer, rs ); |
1094 |
- qDebug() << "Fail to convert Soprano::Statement " << |
+ raptor_free_statement( rs ); |
1095 |
- *it << |
+ } |
1096 |
- " to raptor_statement"; |
+ else { |
1097 |
- success = false; |
+ qDebug() << "Fail to convert Soprano::Statement " << |
1098 |
- break; |
+ *it << |
1099 |
- } |
+ " to raptor_statement"; |
1100 |
+ raptor_statement* rs = convertStatement( *it ); |
+ success = false; |
1101 |
+ raptor_serialize_statement( serializer, rs ); |
+ break; |
1102 |
+ free_statement( rs ); |
+ } |
1103 |
} |
} |
1104 |
|
|
1105 |
- raptor_serializer_serialize_end( serializer ); |
- raptor_serialize_end( serializer ); |
1106 |
+ raptor_serialize_end( serializer ); |
+ raptor_serializer_serialize_end( serializer ); |
1107 |
raptor_free_serializer( serializer ); |
raptor_free_serializer( serializer ); |
1108 |
- raptor_free_iostream(raptorStream); |
+ raptor_free_iostream(raptorStream); |
1109 |
|
|
1110 |
return success; |
return success; |
1111 |
} |
} |
1112 |
diff -Naur soprano/serializers/raptor/raptorserializer.h soprano-2.6.51/serializers/raptor/raptorserializer.h |
diff -Naur soprano-2.6.51/serializers/raptor/raptorserializer.h soprano/serializers/raptor/raptorserializer.h |
1113 |
--- soprano/serializers/raptor/raptorserializer.h 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/serializers/raptor/raptorserializer.h 2011-06-05 10:38:25.000000000 +0200 |
1114 |
+++ soprano-2.6.51/serializers/raptor/raptorserializer.h 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/serializers/raptor/raptorserializer.h 2011-07-19 18:49:58.000000000 +0200 |
1115 |
@@ -28,6 +28,7 @@ |
@@ -28,7 +28,6 @@ |
1116 |
|
|
1117 |
#include "serializer.h" |
#include "serializer.h" |
1118 |
|
|
1119 |
+ |
- |
1120 |
namespace Soprano { |
namespace Soprano { |
1121 |
namespace Raptor { |
namespace Raptor { |
1122 |
class Serializer : public QObject, public Soprano::Serializer |
class Serializer : public QObject, public Soprano::Serializer |
1123 |
@@ -46,12 +47,6 @@ |
@@ -47,6 +46,12 @@ |
1124 |
QTextStream& stream, |
QTextStream& stream, |
1125 |
RdfSerialization serialization, |
RdfSerialization serialization, |
1126 |
const QString& userSerialization = QString() ) const; |
const QString& userSerialization = QString() ) const; |
1127 |
- private: |
+ private: |
1128 |
- /* See source file comments, that explain why it is necessary to |
+ /* See source file comments, that explain why it is necessary to |
1129 |
- * use Private class and RaptorInitHelper is not succifient anymore |
+ * use Private class and RaptorInitHelper is not succifient anymore |
1130 |
- */ |
+ */ |
1131 |
- class Private; |
+ class Private; |
1132 |
- Private * d; |
+ Private * d; |
1133 |
}; |
}; |
1134 |
} |
} |
1135 |
} |
} |
1136 |
diff -Naur soprano/soprano/inference/inferenceruleset.cpp soprano-2.6.51/soprano/inference/inferenceruleset.cpp |
diff -Naur soprano-2.6.51/soprano/inference/inferenceruleset.cpp soprano/soprano/inference/inferenceruleset.cpp |
1137 |
--- soprano/soprano/inference/inferenceruleset.cpp 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/soprano/inference/inferenceruleset.cpp 2011-06-05 10:38:25.000000000 +0200 |
1138 |
+++ soprano-2.6.51/soprano/inference/inferenceruleset.cpp 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/soprano/inference/inferenceruleset.cpp 2011-07-19 18:49:58.000000000 +0200 |
1139 |
@@ -27,10 +27,7 @@ |
@@ -27,7 +27,10 @@ |
1140 |
|
|
1141 |
#include <QtCore/QHash> |
#include <QtCore/QHash> |
1142 |
#include <QtCore/QList> |
#include <QtCore/QList> |
1143 |
-#ifdef Q_OS_WIN |
- |
1144 |
-#include <QtCore/QCoreApplication> |
+#ifdef Q_OS_WIN |
1145 |
-#include <QtCore/QDir> |
+#include <QtCore/QCoreApplication> |
1146 |
-#endif |
+#include <QtCore/QDir> |
1147 |
+ |
+#endif |
1148 |
|
|
1149 |
class Soprano::Inference::RuleSet::Private : public QSharedData |
class Soprano::Inference::RuleSet::Private : public QSharedData |
1150 |
{ |
{ |
1151 |
@@ -141,22 +138,5 @@ |
@@ -138,5 +141,22 @@ |
1152 |
|
|
1153 |
RuleParser parser; |
RuleParser parser; |
1154 |
parser.parseFile( path ); |
parser.parseFile( path ); |
1155 |
-#ifdef Q_OS_WIN |
+#ifdef Q_OS_WIN |
1156 |
- // Additionally try to look up the rules based on the runtime Path if |
+ // Additionally try to look up the rules based on the runtime Path if |
1157 |
- // they can not be found at the install prefix |
+ // they can not be found at the install prefix |
1158 |
- if (!parser.rules().count()) { |
+ if (!parser.rules().count()) { |
1159 |
- path = QDir( QCoreApplication::applicationDirPath() ).absoluteFilePath( ".." ); |
+ path = QDir( QCoreApplication::applicationDirPath() ).absoluteFilePath( ".." ); |
1160 |
- path += "/share/soprano/rules/"; |
+ path += "/share/soprano/rules/"; |
1161 |
- |
+ |
1162 |
- switch( set ) { |
+ switch( set ) { |
1163 |
- case RDFS: |
+ case RDFS: |
1164 |
- path += "rdfs.rules"; |
+ path += "rdfs.rules"; |
1165 |
- break; |
+ break; |
1166 |
- case NRL: |
+ case NRL: |
1167 |
- path += "nrl.rules"; |
+ path += "nrl.rules"; |
1168 |
- break; |
+ break; |
1169 |
- } |
+ } |
1170 |
- } |
+ } |
1171 |
-#endif |
+#endif |
1172 |
return parser.rules(); |
return parser.rules(); |
1173 |
} |
} |
1174 |
diff -Naur soprano/soprano/sopranodirs.cpp soprano-2.6.51/soprano/sopranodirs.cpp |
diff -Naur soprano-2.6.51/soprano/sopranodirs.cpp soprano/soprano/sopranodirs.cpp |
1175 |
--- soprano/soprano/sopranodirs.cpp 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/soprano/sopranodirs.cpp 2011-06-05 10:38:25.000000000 +0200 |
1176 |
+++ soprano-2.6.51/soprano/sopranodirs.cpp 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/soprano/sopranodirs.cpp 2011-07-19 18:49:58.000000000 +0200 |
1177 |
@@ -28,12 +28,8 @@ |
@@ -28,8 +28,12 @@ |
1178 |
#include <QtCore/QCoreApplication> |
#include <QtCore/QCoreApplication> |
1179 |
#include <QtCore/QDebug> |
#include <QtCore/QDebug> |
1180 |
|
|
1181 |
-#ifdef Q_OS_WIN |
- |
1182 |
-static inline QString getWinPrefix() |
-#if defined _WIN32 || defined _WIN64 |
1183 |
-{ |
+#ifdef Q_OS_WIN |
1184 |
- // returns the parent directory of the application |
+static inline QString getWinPrefix() |
1185 |
- return QDir( QCoreApplication::applicationDirPath() ).absoluteFilePath( ".." ); |
+{ |
1186 |
-} |
+ // returns the parent directory of the application |
1187 |
+ |
+ return QDir( QCoreApplication::applicationDirPath() ).absoluteFilePath( ".." ); |
1188 |
+#if defined _WIN32 || defined _WIN64 |
+} |
1189 |
#define PATH_SEPARATOR ';' |
#define PATH_SEPARATOR ';' |
1190 |
#else |
#else |
1191 |
#define PATH_SEPARATOR ':' |
#define PATH_SEPARATOR ':' |
1192 |
@@ -127,8 +123,6 @@ |
@@ -123,6 +127,8 @@ |
1193 |
paths << QLatin1String( SOPRANO_PREFIX"/lib"SOPRANO_LIB_SUFFIX ); |
paths << QLatin1String( SOPRANO_PREFIX"/lib"SOPRANO_LIB_SUFFIX ); |
1194 |
#ifdef Q_OS_WIN |
#ifdef Q_OS_WIN |
1195 |
paths << QLatin1String( SOPRANO_PREFIX"/bin" ); |
paths << QLatin1String( SOPRANO_PREFIX"/bin" ); |
1196 |
- paths << getWinPrefix() + QLatin1String( "/bin" ); |
+ paths << getWinPrefix() + QLatin1String( "/bin" ); |
1197 |
- paths << getWinPrefix() + QLatin1String( "/lib"SOPRANO_LIB_SUFFIX ); |
+ paths << getWinPrefix() + QLatin1String( "/lib"SOPRANO_LIB_SUFFIX ); |
1198 |
#else |
#else |
1199 |
paths << QLatin1String( "/usr/lib"SOPRANO_LIB_SUFFIX ); |
paths << QLatin1String( "/usr/lib"SOPRANO_LIB_SUFFIX ); |
1200 |
paths << QLatin1String( "/usr/local/lib"SOPRANO_LIB_SUFFIX ); |
paths << QLatin1String( "/usr/local/lib"SOPRANO_LIB_SUFFIX ); |
1201 |
@@ -142,9 +136,6 @@ |
@@ -136,6 +142,9 @@ |
1202 |
{ |
{ |
1203 |
QStringList paths; |
QStringList paths; |
1204 |
paths << QLatin1String( SOPRANO_PREFIX"/share" ) |
paths << QLatin1String( SOPRANO_PREFIX"/share" ) |
1205 |
-#ifdef Q_OS_WIN |
+#ifdef Q_OS_WIN |
1206 |
- << getWinPrefix() + QLatin1String( "/share" ) |
+ << getWinPrefix() + QLatin1String( "/share" ) |
1207 |
-#endif |
+#endif |
1208 |
<< Soprano::envDirList( "SOPRANO_DIRS" ) |
<< Soprano::envDirList( "SOPRANO_DIRS" ) |
1209 |
<< Soprano::envDirList( "XDG_DATA_DIRS" ); |
<< Soprano::envDirList( "XDG_DATA_DIRS" ); |
1210 |
return paths; |
return paths; |
1211 |
@@ -155,9 +146,6 @@ |
@@ -146,6 +155,9 @@ |
1212 |
{ |
{ |
1213 |
QStringList paths; |
QStringList paths; |
1214 |
paths << QLatin1String( SOPRANO_PREFIX"/bin" ) |
paths << QLatin1String( SOPRANO_PREFIX"/bin" ) |
1215 |
-#ifdef Q_OS_WIN |
+#ifdef Q_OS_WIN |
1216 |
- << getWinPrefix() + QLatin1String( "/bin" ) |
+ << getWinPrefix() + QLatin1String( "/bin" ) |
1217 |
-#endif |
+#endif |
1218 |
<< envDirList( "PATH" ); |
<< envDirList( "PATH" ); |
1219 |
return paths; |
return paths; |
1220 |
} |
} |
1221 |
diff -Naur soprano/test/CMakeLists.txt soprano-2.6.51/test/CMakeLists.txt |
diff -Naur soprano-2.6.51/test/CMakeLists.txt soprano/test/CMakeLists.txt |
1222 |
--- soprano/test/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/test/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
1223 |
+++ soprano-2.6.51/test/CMakeLists.txt 2011-06-05 10:38:25.000000000 +0200 |
+++ soprano/test/CMakeLists.txt 2011-07-19 18:49:58.000000000 +0200 |
1224 |
@@ -135,12 +135,6 @@ |
@@ -135,6 +135,12 @@ |
1225 |
target_link_libraries(parsertest soprano ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}) |
target_link_libraries(parsertest soprano ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}) |
1226 |
add_test(parsertest ${EXECUTABLE_OUTPUT_PATH}/parsertest) |
add_test(parsertest ${EXECUTABLE_OUTPUT_PATH}/parsertest) |
1227 |
|
|
1228 |
-# serializer test |
+# serializer test |
1229 |
-qt4_automoc(serializetest serializetest.cpp) |
+qt4_automoc(serializetest serializetest.cpp) |
1230 |
-add_executable(serializertest serializetest.cpp) |
+add_executable(serializertest serializetest.cpp) |
1231 |
-target_link_libraries(serializertest soprano ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}) |
+target_link_libraries(serializertest soprano ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}) |
1232 |
-add_test(serializertest ${EXECUTABLE_OUTPUT_PATH}/serializertest) |
+add_test(serializertest ${EXECUTABLE_OUTPUT_PATH}/serializertest) |
1233 |
- |
+ |
1234 |
# Error test |
# Error test |
1235 |
qt4_automoc(errortest errortest.cpp) |
qt4_automoc(errortest errortest.cpp) |
1236 |
add_executable(errortest errortest.cpp) |
add_executable(errortest errortest.cpp) |
1237 |
diff -Naur soprano/test/serializetest.cpp soprano-2.6.51/test/serializetest.cpp |
diff -Naur soprano-2.6.51/test/serializetest.cpp soprano/test/serializetest.cpp |
1238 |
--- soprano/test/serializetest.cpp 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/test/serializetest.cpp 1970-01-01 01:00:00.000000000 +0100 |
1239 |
+++ soprano-2.6.51/test/serializetest.cpp 1970-01-01 01:00:00.000000000 +0100 |
+++ soprano/test/serializetest.cpp 2011-07-19 18:49:58.000000000 +0200 |
1240 |
@@ -1,167 +0,0 @@ |
@@ -0,0 +1,167 @@ |
1241 |
-/* |
+/* |
1242 |
- * This file is part of Soprano Project. |
+ * This file is part of Soprano Project. |
1243 |
- * |
+ * |
1244 |
- * Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org> |
+ * Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org> |
1245 |
- * |
+ * |
1246 |
- * This library is free software; you can redistribute it and/or |
+ * This library is free software; you can redistribute it and/or |
1247 |
- * modify it under the terms of the GNU Library General Public |
+ * modify it under the terms of the GNU Library General Public |
1248 |
- * License as published by the Free Software Foundation; either |
+ * License as published by the Free Software Foundation; either |
1249 |
- * version 2 of the License, or (at your option) any later version. |
+ * version 2 of the License, or (at your option) any later version. |
1250 |
- * |
+ * |
1251 |
- * This library is distributed in the hope that it will be useful, |
+ * This library is distributed in the hope that it will be useful, |
1252 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1253 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1254 |
- * Library General Public License for more details. |
+ * Library General Public License for more details. |
1255 |
- * |
+ * |
1256 |
- * You should have received a copy of the GNU Library General Public License |
+ * You should have received a copy of the GNU Library General Public License |
1257 |
- * along with this library; see the file COPYING.LIB. If not, write to |
+ * along with this library; see the file COPYING.LIB. If not, write to |
1258 |
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
1259 |
- * Boston, MA 02110-1301, USA. |
+ * Boston, MA 02110-1301, USA. |
1260 |
- */ |
+ */ |
1261 |
- |
+ |
1262 |
-#include "serializetest.h" |
+#include "serializetest.h" |
1263 |
-#include "config-testdata.h" |
+#include "config-testdata.h" |
1264 |
- |
+ |
1265 |
-#include "serializer.h" |
+#include "serializer.h" |
1266 |
-#include "parser.h" |
+#include "parser.h" |
1267 |
-#include "pluginmanager.h" |
+#include "pluginmanager.h" |
1268 |
-#include "statementiterator.h" |
+#include "statementiterator.h" |
1269 |
-#include "simplestatementiterator.h" |
+#include "simplestatementiterator.h" |
1270 |
-#include "statement.h" |
+#include "statement.h" |
1271 |
-#include "vocabulary.h" |
+#include "vocabulary.h" |
1272 |
- |
+ |
1273 |
-#include <QtTest/QTest> |
+#include <QtTest/QTest> |
1274 |
-#include <QtCore/QFile> |
+#include <QtCore/QFile> |
1275 |
-#include <QtCore/QDebug> |
+#include <QtCore/QDebug> |
1276 |
- |
+ |
1277 |
- |
+ |
1278 |
-using namespace Soprano; |
+using namespace Soprano; |
1279 |
- |
+ |
1280 |
-#include "testdata.h" |
+#include "testdata.h" |
1281 |
- |
+ |
1282 |
- |
+ |
1283 |
-void SerializerTest::init() |
+void SerializerTest::init() |
1284 |
-{ |
+{ |
1285 |
-#if 0 |
+#if 0 |
1286 |
- // Init reference statements list |
+ // Init reference statements list |
1287 |
- const Parser * parser = PluginManager::instance()->discoverParserForSerialization(SerializationTrig); |
+ const Parser * parser = PluginManager::instance()->discoverParserForSerialization(SerializationTrig); |
1288 |
- QVERIFY(parser); |
+ QVERIFY(parser); |
1289 |
- StatementIterator refIt = parser->parseFile( |
+ StatementIterator refIt = parser->parseFile( |
1290 |
- SOPRANO_TEST_DATA_DIR"/trig-testdata.trig", |
+ SOPRANO_TEST_DATA_DIR"/trig-testdata.trig", |
1291 |
- QUrl("http://soprano.sf.net/testdata/"), |
+ QUrl("http://soprano.sf.net/testdata/"), |
1292 |
- SerializationTrig); |
+ SerializationTrig); |
1293 |
- this->referenceStatements = refIt.allStatements(); |
+ this->referenceStatements = refIt.allStatements(); |
1294 |
-#endif |
+#endif |
1295 |
-} |
+} |
1296 |
- |
+ |
1297 |
-Q_DECLARE_METATYPE( Soprano::RdfSerialization ) |
+Q_DECLARE_METATYPE( Soprano::RdfSerialization ) |
1298 |
- |
+ |
1299 |
-void SerializerTest::testSerializer_data() |
+void SerializerTest::testSerializer_data() |
1300 |
-{ |
+{ |
1301 |
- |
+ |
1302 |
- QTest::addColumn<Soprano::RdfSerialization>( "serialization" ); |
+ QTest::addColumn<Soprano::RdfSerialization>( "serialization" ); |
1303 |
- QTest::addColumn<bool>( "withContext" ); |
+ QTest::addColumn<bool>( "withContext" ); |
1304 |
- |
+ |
1305 |
- QTest::newRow("rdf_xml") << SerializationRdfXml << false; |
+ QTest::newRow("rdf_xml") << SerializationRdfXml << false; |
1306 |
- QTest::newRow("turtle") << SerializationTurtle << false; |
+ QTest::newRow("turtle") << SerializationTurtle << false; |
1307 |
- QTest::newRow("trig") << SerializationTrig << true; |
+ QTest::newRow("trig") << SerializationTrig << true; |
1308 |
-} |
+} |
1309 |
- |
+ |
1310 |
- |
+ |
1311 |
- |
+ |
1312 |
-void SerializerTest::testSerializer() |
+void SerializerTest::testSerializer() |
1313 |
-{ |
+{ |
1314 |
- QFETCH( RdfSerialization, serialization ); |
+ QFETCH( RdfSerialization, serialization ); |
1315 |
- QFETCH( bool, withContext ); |
+ QFETCH( bool, withContext ); |
1316 |
- |
+ |
1317 |
- //qDebug() << "Serialization: " << serializationMimeType(serialization); |
+ //qDebug() << "Serialization: " << serializationMimeType(serialization); |
1318 |
- QList<const Serializer*> serializers = PluginManager::instance()->allSerializers(); |
+ QList<const Serializer*> serializers = PluginManager::instance()->allSerializers(); |
1319 |
- |
+ |
1320 |
- |
+ |
1321 |
- /* Step 1 - create reference statements */ |
+ /* Step 1 - create reference statements */ |
1322 |
- QList<Statement> referenceStatements = testData(withContext); |
+ QList<Statement> referenceStatements = testData(withContext); |
1323 |
- //QList<Statement> testStatements = testData( withContext ); |
+ //QList<Statement> testStatements = testData( withContext ); |
1324 |
- |
+ |
1325 |
- Q_FOREACH( const Serializer * serializer, serializers ) { |
+ Q_FOREACH( const Serializer * serializer, serializers ) { |
1326 |
- if ( serializer->supportsSerialization( serialization ) ) { |
+ if ( serializer->supportsSerialization( serialization ) ) { |
1327 |
- // Find if we have Parser for this serialization, to parse data back. |
+ // Find if we have Parser for this serialization, to parse data back. |
1328 |
- // If not, then oops ) |
+ // If not, then oops ) |
1329 |
- const Parser * back_parser = PluginManager::instance()->discoverParserForSerialization(serialization); |
+ const Parser * back_parser = PluginManager::instance()->discoverParserForSerialization(serialization); |
1330 |
- if ( !back_parser ) { |
+ if ( !back_parser ) { |
1331 |
- qDebug() << "We can not found parser for" << |
+ qDebug() << "We can not found parser for" << |
1332 |
- serializationMimeType(serialization) << |
+ serializationMimeType(serialization) << |
1333 |
- " Skipping it"; |
+ " Skipping it"; |
1334 |
- continue; |
+ continue; |
1335 |
- } |
+ } |
1336 |
- |
+ |
1337 |
- // Now serialize reference data |
+ // Now serialize reference data |
1338 |
- QByteArray data_array; |
+ QByteArray data_array; |
1339 |
- QTextStream serializationStorage(&data_array,QIODevice::ReadWrite); |
+ QTextStream serializationStorage(&data_array,QIODevice::ReadWrite); |
1340 |
- |
+ |
1341 |
- bool result = serializer->serialize( |
+ bool result = serializer->serialize( |
1342 |
- /*what*/Util::SimpleStatementIterator(referenceStatements), |
+ /*what*/Util::SimpleStatementIterator(referenceStatements), |
1343 |
- /*where*/serializationStorage, |
+ /*where*/serializationStorage, |
1344 |
- /*type*/serialization |
+ /*type*/serialization |
1345 |
- ); |
+ ); |
1346 |
- QVERIFY(result); |
+ QVERIFY(result); |
1347 |
- |
+ |
1348 |
- //qDebug() << "Serialization storage: " << data_array; |
+ //qDebug() << "Serialization storage: " << data_array; |
1349 |
- |
+ |
1350 |
- // Now parse gained text stream back |
+ // Now parse gained text stream back |
1351 |
- QTextStream readStorageStream(&data_array, QIODevice::ReadOnly); |
+ QTextStream readStorageStream(&data_array, QIODevice::ReadOnly); |
1352 |
- StatementIterator it = back_parser->parseStream( |
+ StatementIterator it = back_parser->parseStream( |
1353 |
- readStorageStream, |
+ readStorageStream, |
1354 |
- QUrl("http://soprano.sf.net/testdata/"), |
+ QUrl("http://soprano.sf.net/testdata/"), |
1355 |
- serialization); |
+ serialization); |
1356 |
- |
+ |
1357 |
- QList<Statement> all = it.allStatements(); |
+ QList<Statement> all = it.allStatements(); |
1358 |
- |
+ |
1359 |
- |
+ |
1360 |
- // Now compare recieved with reference |
+ // Now compare recieved with reference |
1361 |
- QCOMPARE( all.count(), referenceStatements.count() ); |
+ QCOMPARE( all.count(), referenceStatements.count() ); |
1362 |
- |
+ |
1363 |
- Q_FOREACH( Statement s, referenceStatements ) { |
+ Q_FOREACH( Statement s, referenceStatements ) { |
1364 |
- bool contains = all.contains(s); |
+ bool contains = all.contains(s); |
1365 |
- if ( !contains ) { |
+ if ( !contains ) { |
1366 |
- qDebug() << "Not found in parsed: " << s; |
+ qDebug() << "Not found in parsed: " << s; |
1367 |
- } |
+ } |
1368 |
- |
+ |
1369 |
- QVERIFY( contains ); |
+ QVERIFY( contains ); |
1370 |
- } |
+ } |
1371 |
- |
+ |
1372 |
- } |
+ } |
1373 |
- } |
+ } |
1374 |
-} |
+} |
1375 |
- |
+ |
1376 |
- |
+ |
1377 |
-#if 0 |
+#if 0 |
1378 |
-void SerializerTest::testEncoding() |
+void SerializerTest::testEncoding() |
1379 |
-{ |
+{ |
1380 |
- // FIXME: provide test data for all supported encodings (no big problem so far since we only have the raptor parser) |
+ // FIXME: provide test data for all supported encodings (no big problem so far since we only have the raptor parser) |
1381 |
- |
+ |
1382 |
- // parse both files, same content, different encodings and compare the results |
+ // parse both files, same content, different encodings and compare the results |
1383 |
- const QString utf8File = SOPRANO_TEST_DATA_DIR"/rdf_xml-testdata-utf8.rdf"; |
+ const QString utf8File = SOPRANO_TEST_DATA_DIR"/rdf_xml-testdata-utf8.rdf"; |
1384 |
- const QString isoFile = SOPRANO_TEST_DATA_DIR"/rdf_xml-testdata-iso8859.rdf"; |
+ const QString isoFile = SOPRANO_TEST_DATA_DIR"/rdf_xml-testdata-iso8859.rdf"; |
1385 |
- |
+ |
1386 |
- const Soprano::Parser* parser = PluginManager::instance()->discoverParserForSerialization( SerializationRdfXml ); |
+ const Soprano::Parser* parser = PluginManager::instance()->discoverParserForSerialization( SerializationRdfXml ); |
1387 |
- if ( parser ) { |
+ if ( parser ) { |
1388 |
- QList<Statement> utf8Statements = parser->parseFile( utf8File, QUrl(), SerializationRdfXml ).allStatements(); |
+ QList<Statement> utf8Statements = parser->parseFile( utf8File, QUrl(), SerializationRdfXml ).allStatements(); |
1389 |
- QList<Statement> isoStatements = parser->parseFile( isoFile, QUrl(), SerializationRdfXml ).allStatements(); |
+ QList<Statement> isoStatements = parser->parseFile( isoFile, QUrl(), SerializationRdfXml ).allStatements(); |
1390 |
- |
+ |
1391 |
- // brute force comparision, time is not an issue, no need to get inventive. ;) |
+ // brute force comparision, time is not an issue, no need to get inventive. ;) |
1392 |
- foreach( const Statement& s, utf8Statements ) { |
+ foreach( const Statement& s, utf8Statements ) { |
1393 |
- if ( !isoStatements.contains( s ) ) qDebug() << s; |
+ if ( !isoStatements.contains( s ) ) qDebug() << s; |
1394 |
- QVERIFY( isoStatements.contains( s ) ); |
+ QVERIFY( isoStatements.contains( s ) ); |
1395 |
- } |
+ } |
1396 |
- foreach( const Statement& s, isoStatements ) { |
+ foreach( const Statement& s, isoStatements ) { |
1397 |
- if ( !utf8Statements.contains( s ) ) qDebug() << s; |
+ if ( !utf8Statements.contains( s ) ) qDebug() << s; |
1398 |
- QVERIFY( utf8Statements.contains( s ) ); |
+ QVERIFY( utf8Statements.contains( s ) ); |
1399 |
- } |
+ } |
1400 |
- } |
+ } |
1401 |
-} |
+} |
1402 |
-#endif |
+#endif |
1403 |
- |
+ |
1404 |
-QTEST_MAIN( SerializerTest ) |
+QTEST_MAIN( SerializerTest ) |
1405 |
- |
+ |
1406 |
-#include "serializetest.moc" |
+#include "serializetest.moc" |
1407 |
- |
+ |
1408 |
diff -Naur soprano/test/serializetest.h soprano-2.6.51/test/serializetest.h |
diff -Naur soprano-2.6.51/test/serializetest.h soprano/test/serializetest.h |
1409 |
--- soprano/test/serializetest.h 2011-07-19 18:49:58.000000000 +0200 |
--- soprano-2.6.51/test/serializetest.h 1970-01-01 01:00:00.000000000 +0100 |
1410 |
+++ soprano-2.6.51/test/serializetest.h 1970-01-01 01:00:00.000000000 +0100 |
+++ soprano/test/serializetest.h 2011-07-19 18:49:58.000000000 +0200 |
1411 |
@@ -1,52 +0,0 @@ |
@@ -0,0 +1,52 @@ |
1412 |
-/* |
+/* |
1413 |
- * This file is part of Soprano Project. |
+ * This file is part of Soprano Project. |
1414 |
- * |
+ * |
1415 |
- * Copyright (C) 2007-2008 Sebastian Trueg <strueg@mandriva.com> |
+ * Copyright (C) 2007-2008 Sebastian Trueg <strueg@mandriva.com> |
1416 |
- * |
+ * |
1417 |
- * This library is free software; you can redistribute it and/or |
+ * This library is free software; you can redistribute it and/or |
1418 |
- * modify it under the terms of the GNU Library General Public |
+ * modify it under the terms of the GNU Library General Public |
1419 |
- * License as published by the Free Software Foundation; either |
+ * License as published by the Free Software Foundation; either |
1420 |
- * version 2 of the License, or (at your option) any later version. |
+ * version 2 of the License, or (at your option) any later version. |
1421 |
- * |
+ * |
1422 |
- * This library is distributed in the hope that it will be useful, |
+ * This library is distributed in the hope that it will be useful, |
1423 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1424 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1425 |
- * Library General Public License for more details. |
+ * Library General Public License for more details. |
1426 |
- * |
+ * |
1427 |
- * You should have received a copy of the GNU Library General Public License |
+ * You should have received a copy of the GNU Library General Public License |
1428 |
- * along with this library; see the file COPYING.LIB. If not, write to |
+ * along with this library; see the file COPYING.LIB. If not, write to |
1429 |
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
1430 |
- * Boston, MA 02110-1301, USA. |
+ * Boston, MA 02110-1301, USA. |
1431 |
- */ |
+ */ |
1432 |
- |
+ |
1433 |
-#ifndef SOPRANO_SERIALIZER_TEST_H |
+#ifndef SOPRANO_SERIALIZER_TEST_H |
1434 |
-#define SOPRANO_SERIALIZER_TEST_H |
+#define SOPRANO_SERIALIZER_TEST_H |
1435 |
- |
+ |
1436 |
-#include <QtCore/QObject> |
+#include <QtCore/QObject> |
1437 |
-#include <QtCore/QList> |
+#include <QtCore/QList> |
1438 |
- |
+ |
1439 |
-#include "statement.h" |
+#include "statement.h" |
1440 |
- |
+ |
1441 |
- |
+ |
1442 |
-/* Workflow: |
+/* Workflow: |
1443 |
- * 1) Prepare one QList<Statement> with data, used as reference |
+ * 1) Prepare one QList<Statement> with data, used as reference |
1444 |
- * 2) For each serializer: |
+ * 2) For each serializer: |
1445 |
- * 2.1) Serialize reference to memory |
+ * 2.1) Serialize reference to memory |
1446 |
- * 2.2) Parse this memory back to QList<Statement> |
+ * 2.2) Parse this memory back to QList<Statement> |
1447 |
- * 2.3) Compare with reference |
+ * 2.3) Compare with reference |
1448 |
- */ |
+ */ |
1449 |
-class SerializerTest: public QObject |
+class SerializerTest: public QObject |
1450 |
-{ |
+{ |
1451 |
- Q_OBJECT |
+ Q_OBJECT |
1452 |
- |
+ |
1453 |
-private Q_SLOTS: |
+private Q_SLOTS: |
1454 |
- void init(); |
+ void init(); |
1455 |
- void testSerializer_data(); |
+ void testSerializer_data(); |
1456 |
- void testSerializer(); |
+ void testSerializer(); |
1457 |
- //void testEncoding(); |
+ //void testEncoding(); |
1458 |
- private: |
+ private: |
1459 |
- //QList<Soprano::Statement> referenceStatements; |
+ //QList<Soprano::Statement> referenceStatements; |
1460 |
-}; |
+}; |
1461 |
- |
+ |
1462 |
-#endif |
+#endif |
1463 |
- |
+ |