Commits

Doug Burke committed eaefc6b

LName: now restricted to ASCII characters

  • Participants
  • Parent commits f48287c
  • Tags 0.7.0.2

Comments (0)

Files changed (4)

+0.7.0.2:
+
+  Swish.QName.LName now requires all characters to be ASCII. This
+  avoids downstream later when trying to convert a QName to a URI.
+
 0.7.0.1:
 
   URI parsing has changed slightly. The only user-visible change is that
 
 Some things I want to/should do (not in order)
 
+- Replace list be a set for NSGraph (fairly invasive change and
+  needs bench marking). See issue #12
+  https://bitbucket.org/doug_burke/swish/issue/12/
+
+- Support IRI rather than URI. See issue #13
+  https://bitbucket.org/doug_burke/swish/issue/13/
+
 - Look at using an interned URI in Namespace.
 
 - Can LookupMap be replaced by Map? This would require removing the
   since this is closer to the RDF semantics, and may make some operations
   a bit easier?
 
-- add RDF/XML parser and formatter.
+  Note that there is a possibility that Lit x is going to be
+  considered to be TypedLit x xsd:string - see issue #14
+  https://bitbucket.org/doug_burke/swish/issue/14/
+
+- add RDF/XML parser and formatter. See issue #7
+  https://bitbucket.org/doug_burke/swish/issue/7/
 
 - Should there be a type-level constaint that an RDF Arc can only have
   a literal in the object position?
 
-- can items be moved out of Swidh.RDF.RDFGraph (e.g. the RDFlabel
+- can items be moved out of Swish.RDF.RDFGraph (e.g. the RDFlabel
   re-exports)?
 
 - do we need to export rdfQuerySubs2 from Swish.RDF.RDFQuery (since this

src/Swish/QName.hs

 --  Stability   :  experimental
 --  Portability :  OverloadedStrings
 --
---  This module defines an algebraic datatype for qualified names (QNames).
+--  This module defines an algebraic datatype for qualified names (QNames),
+--  which represents a 'URI' as the combination of a namespace 'URI'
+--  and a local component ('LName'), which can be empty.
+--
+--  Although RDF supports using IRIs, the use of 'URI' here precludes this.
+--  There is currently no attempt to convert from an IRI into a URI.
 --
 --------------------------------------------------------------------------------
 
 
 import Control.Monad (liftM)
 
-import Data.String (IsString(..))
+import Data.Char (isAscii)
 import Data.Maybe (fromMaybe)
 import Data.Interned (intern, unintern)
 import Data.Interned.URI (InternedURI)
+import Data.String (IsString(..))
 
 import Network.URI (URI(..), URIAuth(..), parseURIReference)
 
 At present, the local name can not 
 contain spaces or the \'#\', \':\', or \'/\' characters. This restriction is
 experimental.
+
+The additional restriction of 'Data.Char.isAscii' was added in version @0.7.0.2@.
 -}
 newtype LName = LName T.Text
     deriving (Eq, Ord)
 
 -- | Create a local name.
 newLName :: T.Text -> Maybe LName
-newLName l = if T.any (`elem` " #:/") l then Nothing else Just (LName l)
+-- newLName l = if T.any (`elem` " #:/") l then Nothing else Just (LName l)
+newLName l = if T.any (\c -> c `elem` " #:/" || not (isAscii c)) l then Nothing else Just (LName l)
 
 -- | Extract the local name.
 getLName :: LName -> T.Text
 Name:               swish
-Version:            0.7.0.1
+Version:            0.7.0.2
 Stability:          experimental
 License:            LGPL
 License-file:       LICENSE 
   .
   * Complete, ready-to-run, command-line and script-driven programs.
   .
+  Changes in version @0.7.0.2@:
+  .
+  * The @Swish.QName.LName@ type now requires all characters to be
+  ASCII. This avoids downstream errors when trying to convert a
+  @QName@ to a @URI@.
+  .
   Changes in version @0.7.0.1@:
   .
   * Internal changes to parsing of URI values for NTriples, Turtle, and N3
  Executable         SwishTest
    Main-Is:        tests/SwishTest.hs
 
+ -- How can we include data files that are only used for
+ -- benchmark/tests and do not get installed?
+ Benchmark            bench-ntriples
+   Type:             exitcode-stdio-1.0
+   Hs-Source-Dirs:   bench/
+   Other-Modules:    Paths_swish
+   Main-Is:          NTriples.hs
+   Build-Depends:    base,
+                     criterion,
+                     deepseq,
+                     network,
+                     swish,
+                     text
+
+   ghc-options:      -Wall -fno-warn-orphans
+
 Executable         Swish
    Main-Is:        SwishApp.hs
    Hs-Source-Dirs: app/