net-spider-pangraph 0.1.0.0 → 0.1.1.0
raw patch · 4 files changed
+27/−2 lines, 4 filesdep ~net-spider
Dependency ranges changed: net-spider
Files
- ChangeLog.md +6/−0
- net-spider-pangraph.cabal +2/−2
- src/NetSpider/Pangraph.hs +8/−0
- src/NetSpider/Pangraph/Atom.hs +11/−0
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for net-spider-pangraph +## 0.1.1.0 -- 2019-07-15++* Add `attributesFromGraphML` function.+* Add `ToAtom` instance to `NetSpider.GraphML.Writer.AttributeValue`.++ ## 0.1.0.0 -- 2019-05-03 * First version. Released on an unsuspecting world.
net-spider-pangraph.cabal view
@@ -1,5 +1,5 @@ name: net-spider-pangraph-version: 0.1.0.0+version: 0.1.1.0 author: Toshio Ito <debug.ito@gmail.com> maintainer: Toshio Ito <debug.ito@gmail.com> license: BSD3@@ -23,7 +23,7 @@ NetSpider.Pangraph.Atom -- other-modules: build-depends: base >=4.11.1.0 && <4.13,- net-spider >=0.3.0.0 && <0.4,+ net-spider >=0.3.1.0 && <0.4, bytestring >=0.10.8.2 && <0.11, text >=1.2.3.1 && <1.3, pangraph >=0.2.1 && <0.3,
src/NetSpider/Pangraph.hs view
@@ -21,6 +21,7 @@ -- * Utility timestampAttributes, writePangraph,+ attributesFromGraphML, -- * Re-exports Attribute, Key,@@ -33,6 +34,7 @@ import Data.Text (pack) import Data.Text.Encoding (encodeUtf8) import Data.Time.LocalTime (TimeZone(..))+import qualified NetSpider.GraphML.Writer as NGraphML import NetSpider.Snapshot ( SnapshotNode, SnapshotLink, nodeId, nodeAttributes, nodeTimestamp, isOnBoundary,@@ -138,3 +140,9 @@ -- | Write 'P.Pangraph' to the given file in GraphML format. writePangraph :: P.Pangraph -> FilePath -> IO () writePangraph p file = BS.writeFile file $ GraphML.write p++-- | Make Pangraph attributes from GraphML's attributes.+--+-- @since 0.1.1.0+attributesFromGraphML :: NGraphML.ToAttributes a => a -> [Attribute]+attributesFromGraphML = toAttributes . NGraphML.toAttributes
src/NetSpider/Pangraph/Atom.hs view
@@ -20,6 +20,7 @@ import Data.Text.Encoding (encodeUtf8) import qualified Data.Text.Lazy as TL import Data.Word (Word, Word8, Word16, Word32)+import qualified NetSpider.GraphML.Writer as GraphML -- | 'Atom' is the type for Node ID and attributes in Pangraph data -- model.@@ -88,3 +89,13 @@ instance ToAtom Bool where toAtom = showAtom++instance ToAtom GraphML.AttributeValue where+ toAtom v =+ case v of+ GraphML.AttrBoolean b -> showAtom b+ GraphML.AttrInt i -> showAtom i+ GraphML.AttrLong l -> showAtom l+ GraphML.AttrFloat f -> showAtom f+ GraphML.AttrDouble d -> showAtom d+ GraphML.AttrString t -> showAtom t